From 79ecadb909986de8a6970df8b3ee1bb2da399b1f Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 27 May 2019 11:18:05 -0400 Subject: [PATCH] Fuck the industry domination of C++ and its standard not forcing compliance in both C and C++ modes, if this is the case here. If not, then fuck MSVC. --- common/errors.c | 2 +- common/uipriv.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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);