diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-07-13 00:54:11 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-07-13 00:54:11 +0200 |
commit | 4b093972ea139d057dd523b583352be69bae7edb (patch) | |
tree | 1bc8edf1594f4c81bbdd6a68cf7d22f5a2b21341 /src/Globals.h | |
parent | Add doxy-comments. (diff) | |
parent | Merge pull request #1154 from mc-server/trappedchests (diff) | |
download | cuberite-4b093972ea139d057dd523b583352be69bae7edb.tar cuberite-4b093972ea139d057dd523b583352be69bae7edb.tar.gz cuberite-4b093972ea139d057dd523b583352be69bae7edb.tar.bz2 cuberite-4b093972ea139d057dd523b583352be69bae7edb.tar.lz cuberite-4b093972ea139d057dd523b583352be69bae7edb.tar.xz cuberite-4b093972ea139d057dd523b583352be69bae7edb.tar.zst cuberite-4b093972ea139d057dd523b583352be69bae7edb.zip |
Diffstat (limited to 'src/Globals.h')
-rw-r--r-- | src/Globals.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/Globals.h b/src/Globals.h index c5768facf..0c11429bd 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -71,9 +71,24 @@ #define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex))) - #define SIZE_T_FMT "%zu" - #define SIZE_T_FMT_PRECISION(x) "%" #x "zu" - #define SIZE_T_FMT_HEX "%zx" + #if defined(_WIN32) + // We're compiling on MinGW, which uses an old MSVCRT library that has no support for size_t printfing. + // We need direct size formats: + #if defined(_WIN64) + #define SIZE_T_FMT "%I64u" + #define SIZE_T_FMT_PRECISION(x) "%" #x "I64u" + #define SIZE_T_FMT_HEX "%I64x" + #else + #define SIZE_T_FMT "%u" + #define SIZE_T_FMT_PRECISION(x) "%" #x "u" + #define SIZE_T_FMT_HEX "%x" + #endif + #else + // We're compiling on Linux, so we can use libc's size_t printf format: + #define SIZE_T_FMT "%zu" + #define SIZE_T_FMT_PRECISION(x) "%" #x "zu" + #define SIZE_T_FMT_HEX "%zx" + #endif #define NORETURN __attribute((__noreturn__)) |