Rationalise raw/locale_convert stuff and fix build on OS X.
[libdcp.git] / src / locale_convert.cc
index 549a104172903135bb94e4e3db0e57cb42e0f1cf..64b21274915f88c46516590a5bace8f0bb52ed06 100644 (file)
@@ -48,19 +48,54 @@ dcp::locale_convert (int x, int, bool)
 
 template<>
 string
-dcp::locale_convert (int64_t x, int, bool)
+dcp::locale_convert (unsigned int x, int, bool)
 {
        char buffer[64];
-       snprintf (buffer, sizeof(buffer), "%" PRId64, x);
+       snprintf (buffer, sizeof(buffer), "%u", x);
        return buffer;
 }
 
 template<>
 string
-dcp::locale_convert (uint64_t x, int, bool)
+dcp::locale_convert (long int x, int, bool)
 {
        char buffer[64];
-       snprintf (buffer, sizeof(buffer), "%" PRIu64, x);
+       snprintf (buffer, sizeof(buffer), "%ld", x);
+       return buffer;
+}
+
+template<>
+string
+dcp::locale_convert (unsigned long int x, int, bool)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%lu", x);
+       return buffer;
+}
+
+template<>
+string
+dcp::locale_convert (long long int x, int, bool)
+{
+       char buffer[64];
+#ifdef LIBDCP_WINDOWS
+       __mingw_snprintf (buffer, sizeof(buffer), "%lld", x);
+#else
+       snprintf (buffer, sizeof(buffer), "%lld", x);
+#endif
+       return buffer;
+}
+
+template<>
+string
+dcp::locale_convert (unsigned long long int x, int, bool)
+{
+       char buffer[64];
+#ifdef LIBDCP_WINDOWS
+       __mingw_snprintf (buffer, sizeof(buffer), "%llu", x);
+#else
+       snprintf (buffer, sizeof(buffer), "%llu", x);
+#endif
        return buffer;
 }
 
@@ -115,6 +150,13 @@ dcp::locale_convert (char const * x, int, bool)
        return x;
 }
 
+template<>
+string
+dcp::locale_convert (boost::filesystem::path x, int, bool)
+{
+       return x.string();
+}
+
 template<>
 int
 dcp::locale_convert (string x, int, bool)