diff --git a/common/errors.c b/common/errors.c index 91bdcfd8..b6c6a273 100644 --- a/common/errors.c +++ b/common/errors.c @@ -30,7 +30,7 @@ void uiprivInternalError(const char *fmt, ...) } static const char *messages[uiprivNumProgrammerErrors] = { - [uiprivProgrammerErrorWrongStructSize] = "wrong size %zu for %s", + [uiprivProgrammerErrorWrongStructSize] = "wrong size %" uiprivSizetPrintf " for %s", [uiprivProgrammerErrorIndexOutOfRange] = "index %d out of range in %s()", [uiprivProgrammerErrorNullPointer] = "invalid null pointer for %s passed into %s()", [uiprivProgrammerErrorIntIDNotFound] = "%s identifier %d not found in %s()", diff --git a/common/uipriv.h b/common/uipriv.h index eb5ca28e..a64633bd 100644 --- a/common/uipriv.h +++ b/common/uipriv.h @@ -11,6 +11,13 @@ extern "C" { #define uiprivFunc __func__ #endif +// TODO WHY IS THIS NEEDED?!?!?!?!!?!??!Q https://stackoverflow.com/questions/15610053/correct-printf-format-specifier-for-size-t-zu-or-iu SAYS THAT VS2013 DOES SUPPORT %zu +#ifdef _MSC_VER +#define uiprivSizetPrintf "Iu" +#else +#define uiprivSizetPrintf "zu" +#endif + // init.c extern const char **uiprivSysInitErrors(void); extern int uiprivSysInit(void *options, uiInitError *err);