Attempts to fix Windows build.
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 09:50:22 +0000 (10:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 09:50:22 +0000 (10:50 +0100)
src/compose.hpp
src/decrypted_kdm.cc

index b78a8b9ebb172c95aa3f887c9134e9ee2afcf55e..4ce60e336cae889381ce550e47bd6c1b9e923e1a 100644 (file)
@@ -124,31 +124,39 @@ namespace StringPrivate
   inline void write(std::string& s, const int64_t& obj)
   {
     char buffer[64];
+#ifdef LIBDCP_WINDOWS
+    __mingw_snprintf(buffer, 64, "%" PRId64, obj);
+#else
     snprintf(buffer, 64, "%" PRId64, obj);
+#endif
     s += buffer;
   }
 
   template <>
-  inline void write(std::string& s, const int& obj)
+  inline void write(std::string& s, const uint64_t& obj)
   {
     char buffer[64];
-    snprintf(buffer, 64, "%d", obj);
+#ifdef LIBDCP_WINDOWS
+    __mingw_snprintf(buffer, 64, "%" PRIu64, obj);
+#else
+    snprintf(buffer, 64, "%" PRIu64, obj);
+#endif
     s += buffer;
   }
 
   template <>
-  inline void write(std::string& s, const unsigned int& obj)
+  inline void write(std::string& s, const int& obj)
   {
     char buffer[64];
-    snprintf(buffer, 64, "%ud", obj);
+    snprintf(buffer, 64, "%d", obj);
     s += buffer;
   }
 
   template <>
-  inline void write(std::string& s, const long unsigned int& obj)
+  inline void write(std::string& s, const unsigned int& obj)
   {
     char buffer[64];
-    snprintf(buffer, 64, "%lu", obj);
+    snprintf(buffer, 64, "%ud", obj);
     s += buffer;
   }
 
index ef6a6208fa35be2ef62b4091a48f61598fd0444f..05ea73a383b3a34e4192bd0a75af45afbf82d1df 100644 (file)
@@ -78,7 +78,11 @@ DecryptedKDM::put_uuid (uint8_t ** d, string id)
 {
        /* 32 hex digits plus some hyphens */
        DCP_ASSERT (id.length() == 36);
+#ifdef LIBDCP_WINDOWS
+       __mingw_sscanf (
+#else
        sscanf (
+#endif
                id.c_str(),
                "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
                *d + 0, *d + 1, *d + 2, *d + 3, *d + 4, *d + 5, *d + 6, *d + 7,