Add another type to raw/locale convert.
authorCarl Hetherington <cth@carlh.net>
Wed, 12 Jun 2019 15:08:25 +0000 (16:08 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 12 Jun 2019 15:08:25 +0000 (16:08 +0100)
src/locale_convert.cc
src/locale_convert.h
src/raw_convert.cc
src/raw_convert.h

index 5164f89fdc2de45c32917dca6345d15f39fa06f3..46d5507f83bb2eb9532360281268c430ce37b62a 100644 (file)
@@ -242,6 +242,19 @@ dcp::locale_convert (string x, int, bool)
        return y;
 }
 
+template<>
+unsigned long
+dcp::locale_convert (string x, int, bool)
+{
+       unsigned long y = 0;
+#ifdef LIBDCP_WINDOWS
+       __mingw_sscanf (x.c_str(), "%lud", &y);
+#else
+       sscanf (x.c_str(), "%lud", &y);
+#endif
+       return y;
+}
+
 template<>
 long long
 dcp::locale_convert (string x, int, bool)
index 7d09c8e7e6e93f65115115fe4417e8931d78a7f1..d8d84711dc3667a3d85ac4e909d2ebd65dafeb52 100644 (file)
@@ -135,6 +135,10 @@ template <>
 long
 locale_convert (std::string x, int, bool);
 
+template <>
+unsigned long
+locale_convert (std::string x, int, bool);
+
 template <>
 long long
 locale_convert (std::string x, int, bool);
index f51a10f6806c6cbac22d2c92dc9a41f6045b6509..7b4e6c6d03f0a2b6398e10808164a8d330229437 100644 (file)
@@ -196,6 +196,13 @@ dcp::raw_convert (string v, int precision, bool fixed)
        return locale_convert<long> (make_local (v), precision, fixed);
 }
 
+template <>
+unsigned long
+dcp::raw_convert (string v, int precision, bool fixed)
+{
+       return locale_convert<unsigned long> (make_local (v), precision, fixed);
+}
+
 template <>
 long long
 dcp::raw_convert (string v, int precision, bool fixed)
index 4945c7f8bcc3f2f69f7d8ab88b2086579894804d..c7b04823732ed342c1f80eaf8ed0cbf5871b8bc8 100644 (file)
@@ -128,6 +128,10 @@ template <>
 long
 raw_convert (std::string v, int, bool);
 
+template <>
+unsigned long
+raw_convert (std::string v, int, bool);
+
 template <>
 long long
 raw_convert (std::string v, int, bool);