More raw_convert long/long stuff.
authorCarl Hetherington <cth@carlh.net>
Mon, 12 Sep 2016 19:57:26 +0000 (20:57 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 12 Sep 2016 19:57:26 +0000 (20:57 +0100)
src/locale_convert.cc
src/locale_convert.h
src/raw_convert.cc
src/raw_convert.h

index 129ee50fd3bad985d8ca927d9aa3b40e2ec2010d..89c797599a4374eb60286f8d0a630ce6f9e88d48 100644 (file)
@@ -185,7 +185,7 @@ dcp::locale_convert (string x, int, bool)
 }
 
 template<>
-long int
+long
 dcp::locale_convert (string x, int, bool)
 {
        long int y = 0;
@@ -193,6 +193,15 @@ dcp::locale_convert (string x, int, bool)
        return y;
 }
 
+template<>
+long long
+dcp::locale_convert (string x, int, bool)
+{
+       long long y = 0;
+       sscanf (x.c_str(), "%lld", &y);
+       return y;
+}
+
 template<>
 float
 dcp::locale_convert (string x, int, bool)
index 0572840915de05bc80f3d1f9c6880e82f8ea8162..ccce7b829e9c7cbc5d1447cf66e7af93bf901eff 100644 (file)
@@ -112,7 +112,11 @@ int
 locale_convert (std::string x, int, bool);
 
 template <>
-long int
+long
+locale_convert (std::string x, int, bool);
+
+template <>
+long long
 locale_convert (std::string x, int, bool);
 
 template <>
index 432ce394273aabd08986c7fc04f12d416305185b..281772e7a86f4aadd7969932e1d6362853837044 100644 (file)
@@ -166,6 +166,13 @@ 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)
index 8ce5220e0ae52b5fb4f379e4170bf8116634125a..af2a1e37db5ec2fc400674a7e2d9102fcc658315 100644 (file)
@@ -112,6 +112,10 @@ template <>
 long
 raw_convert (std::string v, int, bool);
 
+template <>
+long long
+raw_convert (std::string v, int, bool);
+
 template <>
 int
 raw_convert (char const * v, int, bool);