Fix missing version string when Popen communicate returns byte strings.
[libdcp.git] / src / raw_convert.cc
index aed965adc214a3eb5e8d7efe3362434cf228e2c5..35a57a5293df5986dece3820771cdfe46e77f8e6 100644 (file)
 using std::string;
 using std::wstring;
 
+/** @param v Numeric value as an ASCII string */
 static
 string
 make_raw (string v)
 {
        struct lconv* lc = localeconv ();
-       boost::algorithm::replace_all (v, lc->decimal_point, ".");
+       /* thousands_sep may be . so remove them before changing decimal points */
        boost::algorithm::replace_all (v, lc->thousands_sep, "");
+       boost::algorithm::replace_all (v, lc->decimal_point, ".");
        return v;
 }
 
@@ -159,6 +161,20 @@ dcp::raw_convert (string v, int precision, bool fixed)
        return locale_convert<int> (make_local (v), precision, fixed);
 }
 
+template <>
+long
+dcp::raw_convert (string v, int precision, bool fixed)
+{
+       return locale_convert<long> (make_local (v), precision, fixed);
+}
+
+template <>
+long long
+dcp::raw_convert (string v, int precision, bool fixed)
+{
+       return locale_convert<long long> (make_local (v), precision, fixed);
+}
+
 template <>
 int
 dcp::raw_convert (char const * v, int precision, bool fixed)