diff --git a/src/util.h b/src/util.h index efb76e49b8b..d80b3c28b2d 100644 --- a/src/util.h +++ b/src/util.h @@ -56,13 +56,22 @@ static const int64 CENT = 1000000; /* Format characters for (s)size_t and ptrdiff_t */ #if defined(_MSC_VER) || defined(__MSVCRT__) + /* (s)size_t and ptrdiff_t have the same size specifier in MSVC: + http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.100%29.aspx + */ #define PRIszx "Ix" #define PRIszu "Iu" #define PRIszd "Id" -#else + #define PRIpdx "Ix" + #define PRIpdu "Iu" + #define PRIpdd "Id" +#else /* C99 standard */ #define PRIszx "zx" #define PRIszu "zu" #define PRIszd "zd" + #define PRIpdx "tx" + #define PRIpdu "tu" + #define PRIpdd "td" #endif // This is needed because the foreach macro can't get over the comma in pair @@ -154,6 +163,8 @@ std::string real_strprintf(const std::string &format, int dummy, ...); #define strprintf(format, ...) real_strprintf(format, 0, __VA_ARGS__) std::string vstrprintf(const char *format, va_list ap); +bool ATTR_WARN_PRINTF(1,2) error(const char *format, ...); + /* Redefine printf so that it directs output to debug.log * * Do this *after* defining the other printf-like functions, because otherwise the @@ -162,7 +173,6 @@ std::string vstrprintf(const char *format, va_list ap); */ #define printf OutputDebugStringF -bool error(const char *format, ...); void LogException(std::exception* pex, const char* pszThread); void PrintException(std::exception* pex, const char* pszThread); void PrintExceptionContinue(std::exception* pex, const char* pszThread);