Check CPL hash in the PKL on verify.
[libdcp.git] / src / locale_convert.cc
index 89c797599a4374eb60286f8d0a630ce6f9e88d48..5e7c350f4098138370ee763c3deeae548330c066 100644 (file)
 using std::string;
 using std::wstring;
 
+template<>
+string
+dcp::locale_convert (unsigned char x, int, bool)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%hhd", x);
+       return buffer;
+}
+
+template<>
+string
+dcp::locale_convert (unsigned short int x, int, bool)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%hd", x);
+       return buffer;
+}
+
 template<>
 string
 dcp::locale_convert (int x, int, bool)
@@ -61,7 +79,11 @@ string
 dcp::locale_convert (long int x, int, bool)
 {
        char buffer[64];
+#ifdef LIBDCP_WINDOWS
+       __mingw_snprintf (buffer, sizeof(buffer), "%ld", x);
+#else
        snprintf (buffer, sizeof(buffer), "%ld", x);
+#endif
        return buffer;
 }
 
@@ -175,6 +197,33 @@ dcp::locale_convert (boost::filesystem::path x, int, bool)
        return x.string();
 }
 
+template<>
+unsigned char
+dcp::locale_convert (string x, int, bool)
+{
+       unsigned char y = 0;
+       sscanf (x.c_str(), "%hhu", &y);
+       return y;
+}
+
+template<>
+unsigned short int
+dcp::locale_convert (string x, int, bool)
+{
+       unsigned short int y = 0;
+       sscanf (x.c_str(), "%hu", &y);
+       return y;
+}
+
+template<>
+unsigned int
+dcp::locale_convert (string x, int, bool)
+{
+       int y = 0;
+       sscanf (x.c_str(), "%u", &y);
+       return y;
+}
+
 template<>
 int
 dcp::locale_convert (string x, int, bool)
@@ -198,7 +247,11 @@ long long
 dcp::locale_convert (string x, int, bool)
 {
        long long y = 0;
+#ifdef LIBDCP_WINDOWS
+       __mingw_sscanf (x.c_str(), "%lld", &y);
+#else
        sscanf (x.c_str(), "%lld", &y);
+#endif
        return y;
 }