diff options
author | Mattes D <github@xoft.cz> | 2015-01-24 13:32:13 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-01-27 14:53:28 +0100 |
commit | b93903db23289eb38126325801c4e3f9192ff123 (patch) | |
tree | bc5c0ebc1e8d979d2ef28d84550af56c48ad8101 /Tools/RCONClient/Globals.h | |
parent | Migrated RCON server to cNetwork API. (diff) | |
download | cuberite-b93903db23289eb38126325801c4e3f9192ff123.tar cuberite-b93903db23289eb38126325801c4e3f9192ff123.tar.gz cuberite-b93903db23289eb38126325801c4e3f9192ff123.tar.bz2 cuberite-b93903db23289eb38126325801c4e3f9192ff123.tar.lz cuberite-b93903db23289eb38126325801c4e3f9192ff123.tar.xz cuberite-b93903db23289eb38126325801c4e3f9192ff123.tar.zst cuberite-b93903db23289eb38126325801c4e3f9192ff123.zip |
Diffstat (limited to '')
-rw-r--r-- | Tools/RCONClient/Globals.h | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/Tools/RCONClient/Globals.h b/Tools/RCONClient/Globals.h index a3a2f2846..dc7669270 100644 --- a/Tools/RCONClient/Globals.h +++ b/Tools/RCONClient/Globals.h @@ -22,6 +22,18 @@ #define ALIGN_8 #define ALIGN_16 + #define FORMATSTRING(formatIndex, va_argsIndex) + + // MSVC has its own custom version of zu format + #define SIZE_T_FMT "%Iu" + #define SIZE_T_FMT_PRECISION(x) "%" #x "Iu" + #define SIZE_T_FMT_HEX "%Ix" + + #define NORETURN __declspec(noreturn) + + // Use non-standard defines in <cmath> + #define _USE_MATH_DEFINES + #elif defined(__GNUC__) // TODO: Can GCC explicitly mark classes as abstract (no instances can be created)? @@ -38,6 +50,29 @@ // Some portability macros :) #define stricmp strcasecmp + #define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex))) + + #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__)) + #else #error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler" @@ -74,6 +109,8 @@ typedef unsigned long long UInt64; typedef unsigned int UInt32; typedef unsigned short UInt16; +typedef unsigned char Byte; + @@ -94,7 +131,7 @@ typedef unsigned short UInt16; #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN - #define _WIN32_WINNT 0x501 // We want to target WinXP and higher + #define _WIN32_WINNT 0x502 // We want to target WinXP SP2 and higher #include <Windows.h> #include <winsock2.h> @@ -175,7 +212,8 @@ typedef unsigned short UInt16; #include "StringUtils.h" #include "OSSupport/CriticalSection.h" #include "OSSupport/File.h" -#include "MCLogger.h" +#include "OSSupport/Event.h" +#include "Logger.h" |