Windows build fixes.
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 23:38:33 +0000 (00:38 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 13 Aug 2016 20:22:37 +0000 (21:22 +0100)
src/lib/compose.hpp
src/lib/environment_info.cc

index 8ccd12b503556c834760e1afcf636fb989cbb4f2..477000e5dce9fd56e52e2b3e19b1a5a5cba4a946 100644 (file)
@@ -120,6 +120,30 @@ namespace StringPrivate
     s += to_string (obj);
   }
 
+  template <>
+  inline void write(std::string& s, const int16_t& obj)
+  {
+    char buffer[64];
+#ifdef DCPOMATIC_WINDOWS
+    __mingw_snprintf(buffer, 64, "%" PRId16, obj);
+#else
+    snprintf(buffer, 64, "%" PRId16, obj);
+#endif
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, const uint16_t& obj)
+  {
+    char buffer[64];
+#ifdef DCPOMATIC_WINDOWS
+    __mingw_snprintf(buffer, 64, "%" PRIu16, obj);
+#else
+    snprintf(buffer, 64, "%" PRIu16, obj);
+#endif
+    s += buffer;
+  }
+
   template <>
   inline void write(std::string& s, const int32_t& obj)
   {
@@ -203,17 +227,16 @@ namespace StringPrivate
   }
 
   template <>
-  inline void write(std::string& s, wchar_t const & obj)
+  inline void write(std::string& s, const std::string& obj)
   {
-    std::wstring ws (&obj);
-    std::string w (ws.begin(), ws.end());
-    s += w;
+    s += obj;
   }
 
-  template <>
-  inline void write(std::string& s, const std::string& obj)
+  inline void write(std::string& s, wchar_t const * const & obj)
   {
-    s += obj;
+    std::wstring ws (obj);
+    std::string w (ws.begin(), ws.end());
+    s += w;
   }
 
   template <>
index b5093e4d6c01a24505e7380286dc80c26bd7c687..4cdadafb659211b7aa43a2ebe334e516357caf31 100644 (file)
@@ -113,8 +113,8 @@ environment_info ()
        GetVersionEx (&os_info);
        info.push_back (
                String::compose (
-                       "Windows version %1.%2.%3 SP %4",
-                       os_info.dwMajorVersion, os_info.dwMinorVersion, os_info.dwBuildNumber, os_info.szCSDVersion
+                       "Windows version %1.%2.%3",
+                       (int) os_info.dwMajorVersion, (int) os_info.dwMinorVersion, (int) os_info.dwBuildNumber
                        )
                );
 #endif