From 92e3bafcb82ac8c2ed6782cd1e6e6cf3703cd6ca Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 12 Aug 2016 14:02:09 +0100 Subject: Try to fix 32/64-bit int confusion with compose.hpp. --- src/lib/compose.hpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/compose.hpp b/src/lib/compose.hpp index 85a9e9b0f..425aceabf 100644 --- a/src/lib/compose.hpp +++ b/src/lib/compose.hpp @@ -121,42 +121,50 @@ namespace StringPrivate } template <> - inline void write(std::string& s, const int64_t& obj) + inline void write(std::string& s, const int32_t& obj) { char buffer[64]; #ifdef DCPOMATIC_WINDOWS - __mingw_snprintf(buffer, 64, "%" PRId64, obj); + __mingw_snprintf(buffer, 64, "%" PRId32, obj); #else - snprintf(buffer, 64, "%" PRId64, obj); + snprintf(buffer, 64, "%" PRId32, obj); #endif s += buffer; } template <> - inline void write(std::string& s, const uint64_t& obj) + inline void write(std::string& s, const uint32_t& obj) { char buffer[64]; #ifdef DCPOMATIC_WINDOWS - __mingw_snprintf(buffer, 64, "%" PRIu64, obj); + __mingw_snprintf(buffer, 64, "%" PRIu32, obj); #else - snprintf(buffer, 64, "%" PRIu64, obj); + snprintf(buffer, 64, "%" PRIu32, obj); #endif s += buffer; } template <> - inline void write(std::string& s, const int& obj) + inline void write(std::string& s, const int64_t& obj) { char buffer[64]; - snprintf(buffer, 64, "%d", obj); +#ifdef DCPOMATIC_WINDOWS + __mingw_snprintf(buffer, 64, "%" PRId64, obj); +#else + snprintf(buffer, 64, "%" PRId64, obj); +#endif s += buffer; } template <> - inline void write(std::string& s, const unsigned int& obj) + inline void write(std::string& s, const uint64_t& obj) { char buffer[64]; - snprintf(buffer, 64, "%ud", obj); +#ifdef DCPOMATIC_WINDOWS + __mingw_snprintf(buffer, 64, "%" PRIu64, obj); +#else + snprintf(buffer, 64, "%" PRIu64, obj); +#endif s += buffer; } -- cgit v1.2.3