From c540d7244531d501f16b485a3e45e358f98853be Mon Sep 17 00:00:00 2001 From: glx Date: Sun, 9 Dec 2018 02:28:14 +0100 Subject: [PATCH] Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32 --- src/ai/ai_info.cpp | 4 ++-- src/bootstrap_gui.cpp | 2 +- src/core/endian_type.hpp | 4 ++-- src/debug.cpp | 4 ++-- src/fileio.cpp | 18 +++++++++--------- src/fileio_func.h | 4 ++-- src/fios.cpp | 8 ++++---- src/fontdetection.cpp | 2 +- src/game/game_info.cpp | 4 ++-- src/ini.cpp | 4 ++-- src/network/core/core.cpp | 6 +++--- src/network/core/host.cpp | 2 +- src/network/core/os_abstraction.h | 6 +++--- src/openttd.cpp | 10 +++++----- src/script/script_scanner.cpp | 2 +- src/sdl.h | 2 +- src/settings.cpp | 4 ++-- src/settingsgen/settingsgen.cpp | 4 ++-- src/stdafx.h | 18 +++++++++--------- src/strgen/strgen.cpp | 12 ++++++------ src/string.cpp | 8 ++++---- src/strings.cpp | 6 +++--- src/table/win32_settings.ini | 4 ++-- src/video/dedicated_v.cpp | 6 +++--- src/video/sdl_v.cpp | 4 ++-- 25 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 9c27006c47..43a4345460 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -32,9 +32,9 @@ static bool CheckAPIVersion(const char *api_version) strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0; } -#if defined(WIN32) +#if defined(_WIN32) #undef GetClassName -#endif /* WIN32 */ +#endif /* _WIN32 */ template <> const char *GetClassName() { return "AIInfo"; } /* static */ void AIInfo::RegisterAPI(Squirrel *engine) diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 62f5450c5b..3fb52a1f9e 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -220,7 +220,7 @@ bool HandleBootstrap() if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure; /* If there is no network or no freetype, then there is nothing we can do. Go straight to failure. */ -#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(WIN32) || defined(__APPLE__)) +#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(_WIN32) || defined(__APPLE__)) if (!_network_available) goto failure; /* First tell the game we're bootstrapping. */ diff --git a/src/core/endian_type.hpp b/src/core/endian_type.hpp index 453bf5402c..4058c5c19a 100644 --- a/src/core/endian_type.hpp +++ b/src/core/endian_type.hpp @@ -26,7 +26,7 @@ #define TTD_BIG_ENDIAN 1 /* Windows has always LITTLE_ENDIAN */ -#if defined(WIN32) || defined(__OS2__) || defined(WIN64) +#if defined(_WIN32) || defined(__OS2__) # define TTD_ENDIAN TTD_LITTLE_ENDIAN #elif defined(OSX) # include @@ -42,6 +42,6 @@ # else # define TTD_ENDIAN TTD_BIG_ENDIAN # endif -#endif /* WIN32 || __OS2__ || WIN64 */ +#endif /* _WIN32 || __OS2__ */ #endif /* ENDIAN_TYPE_HPP */ diff --git a/src/debug.cpp b/src/debug.cpp index f8f3f0ad56..13df98db34 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -17,7 +17,7 @@ #include "fileio_func.h" #include "settings_type.h" -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) #include "os/windows/win32.h" #endif @@ -139,7 +139,7 @@ static void debug_print(const char *dbg, const char *buf) } else { char buffer[512]; seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf); -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) TCHAR system_buf[512]; convert_to_fs(buffer, system_buf, lengthof(system_buf), true); _fputts(system_buf, stderr); diff --git a/src/fileio.cpp b/src/fileio.cpp index 5530965e96..0e6d86e3c7 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -15,7 +15,7 @@ #include "fios.h" #include "string_func.h" #include "tar_type.h" -#ifdef WIN32 +#ifdef _WIN32 #include # define access _taccess #elif defined(__HAIKU__) @@ -361,7 +361,7 @@ char *FioFindFullPath(char *buf, const char *last, Subdirectory subdir, const ch FOR_ALL_SEARCHPATHS(sp) { FioGetFullPath(buf, last, sp, subdir, filename); if (FileExists(buf)) return buf; -#if !defined(WIN32) +#if !defined(_WIN32) /* Be, as opening files, aware that sometimes the filename * might be in uppercase when it is in lowercase on the * disk. Of course Windows doesn't care about casing. */ @@ -399,7 +399,7 @@ char *FioGetDirectory(char *buf, const char *last, Subdirectory subdir) static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subdirectory subdir, size_t *filesize) { -#if defined(WIN32) && defined(UNICODE) +#if defined(_WIN32) && defined(UNICODE) /* fopen is implemented as a define with ellipses for * Unicode support (prepend an L). As we are not sending * a string, but a variable, it 'renames' the variable, @@ -416,12 +416,12 @@ static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath s seprintf(buf, lastof(buf), "%s%s%s", _searchpaths[sp], _subdirs[subdir], filename); } -#if defined(WIN32) +#if defined(_WIN32) if (mode[0] == 'r' && GetFileAttributes(OTTD2FS(buf)) == INVALID_FILE_ATTRIBUTES) return NULL; #endif f = fopen(buf, mode); -#if !defined(WIN32) +#if !defined(_WIN32) if (f == NULL && strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1))) { f = fopen(buf, mode); } @@ -535,7 +535,7 @@ void FioCreateDirectory(const char *name) { /* Ignore directory creation errors; they'll surface later on, and most * of the time they are 'directory already exists' errors anyhow. */ -#if defined(WIN32) +#if defined(_WIN32) CreateDirectory(OTTD2FS(name), NULL); #elif defined(OS2) && !defined(__INNOTEK_LIBC__) mkdir(OTTD2FS(name)); @@ -979,14 +979,14 @@ bool ExtractTar(const char *tar_filename, Subdirectory subdir) return true; } -#if defined(WIN32) +#if defined(_WIN32) /** * Determine the base (personal dir and game data dir) paths * @param exe the path from the current path to the executable * @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc) */ extern void DetermineBasePaths(const char *exe); -#else /* defined(WIN32) */ +#else /* defined(_WIN32) */ /** * Changes the working directory to the path of the give executable. @@ -1149,7 +1149,7 @@ extern void cocoaSetApplicationBundleDir(); _searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL; #endif } -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ const char *_personal_dir; diff --git a/src/fileio_func.h b/src/fileio_func.h index 6383180744..f5ef58ac06 100644 --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -118,7 +118,7 @@ public: DECLARE_ENUM_AS_BIT_SET(TarScanner::Mode) /* Implementation of opendir/readdir/closedir for Windows */ -#if defined(WIN32) +#if defined(_WIN32) struct DIR; struct dirent { // XXX - only d_name implemented @@ -136,7 +136,7 @@ int closedir(DIR *d); /* Use system-supplied opendir/readdir/closedir functions */ # include # include -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ /** * A wrapper around opendir() which will convert the string from diff --git a/src/fios.cpp b/src/fios.cpp index f4a25e1ed2..73365ddc29 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -20,9 +20,9 @@ #include "string_func.h" #include -#ifndef WIN32 +#ifndef _WIN32 # include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include "table/strings.h" @@ -153,7 +153,7 @@ const char *FiosBrowseTo(const FiosItem *item) { switch (item->type) { case FIOS_TYPE_DRIVE: -#if defined(WIN32) || defined(__OS2__) +#if defined(_WIN32) || defined(__OS2__) seprintf(_fios_path, _fios_path_last, "%c:" PATHSEP, item->title[0]); #endif break; @@ -318,7 +318,7 @@ bool FiosFileScanner::AddFile(const char *filename, size_t basepath_length, cons } FiosItem *fios = file_list.Append(); -#ifdef WIN32 +#ifdef _WIN32 struct _stat sb; if (_tstat(OTTD2FS(filename), &sb) == 0) { #else diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp index 14eef9f640..4279d60f3b 100644 --- a/src/fontdetection.cpp +++ b/src/fontdetection.cpp @@ -28,7 +28,7 @@ extern FT_Library _library; * Windows support * ======================================================================================== */ -#ifdef WIN32 +#ifdef _WIN32 #include "core/alloc_func.hpp" #include "core/math_func.hpp" #include diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp index 9761532965..f8c04608b7 100644 --- a/src/game/game_info.cpp +++ b/src/game/game_info.cpp @@ -29,9 +29,9 @@ static bool CheckAPIVersion(const char *api_version) strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0; } -#if defined(WIN32) +#if defined(_WIN32) #undef GetClassName -#endif /* WIN32 */ +#endif /* _WIN32 */ template <> const char *GetClassName() { return "GSInfo"; } /* static */ void GameInfo::RegisterAPI(Squirrel *engine) diff --git a/src/ini.cpp b/src/ini.cpp index 905ebfacf8..6767d8525d 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -19,7 +19,7 @@ # include #endif -#ifdef WIN32 +#ifdef _WIN32 # include # include # include "core/mem_func.hpp" @@ -87,7 +87,7 @@ bool IniFile::SaveToDisk(const char *filename) fclose(f); #endif -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) /* _tcsncpy = strcpy is TCHAR is char, but isn't when TCHAR is wchar. */ #undef strncpy /* Allocate space for one more \0 character. */ diff --git a/src/network/core/core.cpp b/src/network/core/core.cpp index 7a2ad92a29..c8db860dd5 100644 --- a/src/network/core/core.cpp +++ b/src/network/core/core.cpp @@ -64,7 +64,7 @@ bool NetworkCoreInitialize() #endif /* __MORPHOS__ / __AMIGA__ */ /* Let's load the network in windows */ -#ifdef WIN32 +#ifdef _WIN32 { WSADATA wsa; DEBUG(net, 3, "[core] loading windows socket library"); @@ -73,7 +73,7 @@ bool NetworkCoreInitialize() return false; } } -#endif /* WIN32 */ +#endif /* _WIN32 */ return true; } @@ -94,7 +94,7 @@ void NetworkCoreShutdown() if (SocketBase != NULL) CloseLibrary(SocketBase); #endif -#if defined(WIN32) +#if defined(_WIN32) WSACleanup(); #endif } diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp index e431dde9fc..216839032b 100644 --- a/src/network/core/host.cpp +++ b/src/network/core/host.cpp @@ -107,7 +107,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // GE freeifaddrs(ifap); } -#elif defined(WIN32) +#elif defined(_WIN32) static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Win32 implementation { SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h index c24cc9f8fe..c320cd9102 100644 --- a/src/network/core/os_abstraction.h +++ b/src/network/core/os_abstraction.h @@ -21,7 +21,7 @@ #ifdef ENABLE_NETWORK /* Windows stuff */ -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) #include #include #include @@ -125,7 +125,7 @@ static inline void OTTDfreeaddrinfo(struct addrinfo *ai) } #define freeaddrinfo OTTDfreeaddrinfo #endif /* __MINGW32__ && __CYGWIN__ */ -#endif /* WIN32 */ +#endif /* _WIN32 */ /* UNIX stuff */ #if defined(UNIX) && !defined(__OS2__) @@ -290,7 +290,7 @@ typedef unsigned long in_addr_t; */ static inline bool SetNonBlocking(SOCKET d) { -#ifdef WIN32 +#ifdef _WIN32 u_long nonblocking = 1; #else int nonblocking = 1; diff --git a/src/openttd.cpp b/src/openttd.cpp index 03c8aa2869..703f04f010 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -168,7 +168,7 @@ static void ShowHelp() " -P password = Password to join company\n" " -D [ip][:port] = Start dedicated server\n" " -l ip[:port] = Redirect DEBUG()\n" -#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) +#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(_WIN32) " -f = Fork into the background (dedicated only)\n" #endif #endif /* ENABLE_NETWORK */ @@ -212,7 +212,7 @@ static void ShowHelp() /* ShowInfo put output to stderr, but version information should go * to stdout; this is the only exception */ -#if !defined(WIN32) && !defined(WIN64) +#if !defined(_WIN32) printf("%s\n", buf); #else ShowInfo(buf); @@ -250,7 +250,7 @@ static void WriteSavegameInfo(const char *name) /* ShowInfo put output to stderr, but version information should go * to stdout; this is the only exception */ -#if !defined(WIN32) && !defined(WIN64) +#if !defined(_WIN32) printf("%s\n", buf); #else ShowInfo(buf); @@ -514,7 +514,7 @@ static const OptionData _options[] = { GETOPT_SHORT_VALUE('l'), GETOPT_SHORT_VALUE('p'), GETOPT_SHORT_VALUE('P'), -#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) +#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(_WIN32) GETOPT_SHORT_NOVAL('f'), #endif #endif /* ENABLE_NETWORK */ @@ -614,7 +614,7 @@ int openttd_main(int argc, char *argv[]) case 'r': ParseResolution(&resolution, mgo.opt); break; case 't': scanner->startyear = atoi(mgo.opt); break; case 'd': { -#if defined(WIN32) +#if defined(_WIN32) CreateConsole(); #endif if (mgo.opt != NULL) SetDebugString(mgo.opt); diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index 57265669f9..fe6d41cf92 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -134,7 +134,7 @@ void ScriptScanner::RegisterScript(ScriptInfo *info) if (this->info_list.find(script_name) != this->info_list.end()) { /* This script was already registered */ -#ifdef WIN32 +#ifdef _WIN32 /* Windows doesn't care about the case */ if (strcasecmp(this->info_list[script_name]->GetMainScript(), info->GetMainScript()) == 0) { #else diff --git a/src/sdl.h b/src/sdl.h index ff1092358f..9033899a59 100644 --- a/src/sdl.h +++ b/src/sdl.h @@ -15,7 +15,7 @@ const char *SdlOpen(uint32 x); void SdlClose(uint32 x); -#ifdef WIN32 +#ifdef _WIN32 #define DYNAMICALLY_LOADED_SDL #endif diff --git a/src/settings.cpp b/src/settings.cpp index 0dc1e24d45..3e61cc87f8 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1668,9 +1668,9 @@ static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescP { if (basic_settings) { proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL); -#if defined(WIN32) && !defined(DEDICATED) +#if defined(_WIN32) && !defined(DEDICATED) proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL); -#endif /* WIN32 */ +#endif /* _WIN32 */ } if (other_settings) { diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index ac6db6581c..298539417e 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -18,7 +18,7 @@ #include -#if (!defined(WIN32) && !defined(WIN64)) || defined(__CYGWIN__) +#if !defined(_WIN32) || defined(__CYGWIN__) #include #include #endif @@ -512,7 +512,7 @@ int CDECL main(int argc, char *argv[]) unlink(tmp_output); } else { /* Rename tmp2.xxx to output file. */ -#if defined(WIN32) || defined(WIN64) +#if defined(_WIN32) unlink(output_file); #endif if (rename(tmp_output, output_file) == -1) error("rename() failed"); diff --git a/src/stdafx.h b/src/stdafx.h index fb384ca823..6e96e98fde 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -167,7 +167,7 @@ #include // alloca() #endif -#if defined(WIN32) +#if defined(_WIN32) #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #endif @@ -232,18 +232,18 @@ #define FALLTHROUGH #endif - #if defined(WIN32) && !defined(_WIN64) && !defined(WIN64) +# if defined(_WIN32) && !defined(_WIN64) #if !defined(_W64) #define _W64 #endif typedef _W64 int INT_PTR, *PINT_PTR; typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; - #endif /* WIN32 && !_WIN64 && !WIN64 */ +# endif /* _WIN32 && !_WIN64 */ - #if defined(_WIN64) || defined(WIN64) +# if defined(_WIN64) #define fseek _fseeki64 - #endif /* _WIN64 || WIN64 */ +# endif /* _WIN64 */ /* zlib from vcpkg use cdecl calling convention without enforcing it in the headers */ # if defined(WITH_ZLIB) @@ -281,7 +281,7 @@ /* NOTE: the string returned by these functions is only valid until the next * call to the same function and is not thread- or reentrancy-safe */ #if !defined(STRGEN) && !defined(SETTINGSGEN) - #if defined(WIN32) || defined(WIN64) +# if defined(_WIN32) char *getcwd(char *buf, size_t size); #include #include @@ -292,14 +292,14 @@ const char *FS2OTTD(const TCHAR *name); const TCHAR *OTTD2FS(const char *name, bool console_cp = false); - #else +# else #define fopen(file, mode) fopen(OTTD2FS(file), mode) const char *FS2OTTD(const char *name); const char *OTTD2FS(const char *name); - #endif /* WIN32 */ +# endif /* _WIN32 */ #endif /* STRGEN || SETTINGSGEN */ -#if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) +#if defined(_WIN32) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) #define PATHSEP "\\" #define PATHSEPCHAR '\\' #else diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index c231717dac..44cbd127a1 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -21,14 +21,14 @@ #include #include -#if (!defined(WIN32) && !defined(WIN64)) || defined(__CYGWIN__) +#if !defined(_WIN32) || defined(__CYGWIN__) #include #include #endif -#if defined WIN32 || defined __WATCOMC__ +#if defined(_WIN32) || defined(__WATCOMC__) #include -#endif /* WIN32 || __WATCOMC__ */ +#endif /* _WIN32 || __WATCOMC__ */ #ifdef __MORPHOS__ #ifdef stderr @@ -333,9 +333,9 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { unlink(this->filename); } else { /* else rename tmp.xxx into filename */ - #if defined(WIN32) || defined(WIN64) +# if defined(_WIN32) unlink(this->real_filename); - #endif +# endif if (rename(this->filename, this->real_filename) == -1) error("rename() failed"); } } @@ -377,7 +377,7 @@ static inline void ottd_mkdir(const char *directory) { /* Ignore directory creation errors; they'll surface later on, and most * of the time they are 'directory already exists' errors anyhow. */ -#if defined(WIN32) || defined(__WATCOMC__) +#if defined(_WIN32) || defined(__WATCOMC__) mkdir(directory); #else mkdir(directory, 0755); diff --git a/src/string.cpp b/src/string.cpp index 96e1d82754..ae1b556aff 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -25,7 +25,7 @@ #include // required by vsnprintf implementation for MSVC #endif -#ifdef WIN32 +#ifdef _WIN32 #include "os/windows/win32.h" #endif @@ -359,7 +359,7 @@ bool IsValidChar(WChar key, CharSetFilter afilter) } } -#ifdef WIN32 +#ifdef _WIN32 #if defined(_MSC_VER) && _MSC_VER < 1900 /** * Almost POSIX compliant implementation of \c vsnprintf for VC compiler. @@ -395,7 +395,7 @@ int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap) } #endif /* _MSC_VER */ -#endif /* WIN32 */ +#endif /* _WIN32 */ /** * Safer implementation of snprintf; same as snprintf except: @@ -592,7 +592,7 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front) } #endif /* WITH_ICU_SORT */ -#if defined(WIN32) && !defined(STRGEN) && !defined(SETTINGSGEN) +#if defined(_WIN32) && !defined(STRGEN) && !defined(SETTINGSGEN) int res = OTTDStringCompare(s1, s2); if (res != 0) return res - 2; // Convert to normal C return values. #endif diff --git a/src/strings.cpp b/src/strings.cpp index 164d8a3c9f..2cc3a23be2 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1786,7 +1786,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang) strecpy(_config_language_file, c_file, lastof(_config_language_file)); SetCurrentGrfLangID(_current_language->newgrflangid); -#ifdef WIN32 +#ifdef _WIN32 extern void Win32SetCurrentLocaleName(const char *iso_code); Win32SetCurrentLocaleName(_current_language->isocode); #endif @@ -1837,7 +1837,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang) /* Win32 implementation in win32.cpp. * OS X implementation in os/macosx/macos.mm. */ -#if !(defined(WIN32) || defined(__APPLE__)) +#if !(defined(_WIN32) || defined(__APPLE__)) /** * Determine the current charset based on the environment * First check some default values, after this one we passed ourselves @@ -1865,7 +1865,7 @@ const char *GetCurrentLocale(const char *param) } #else const char *GetCurrentLocale(const char *param); -#endif /* !(defined(WIN32) || defined(__APPLE__)) */ +#endif /* !(defined(_WIN32) || defined(__APPLE__)) */ int CDECL StringIDSorter(const StringID *a, const StringID *b) { diff --git a/src/table/win32_settings.ini b/src/table/win32_settings.ini index 1e0c9ad023..70c18a424e 100644 --- a/src/table/win32_settings.ini +++ b/src/table/win32_settings.ini @@ -8,14 +8,14 @@ [pre-amble] /* win32_v.cpp only settings */ -#if defined(WIN32) && !defined(DEDICATED) +#if defined(_WIN32) && !defined(DEDICATED) extern bool _force_full_redraw, _window_maximize; extern uint _display_hz; static const SettingDescGlobVarList _win32_settings[] = { [post-amble] }; -#endif /* WIN32 */ +#endif /* _WIN32 */ [templates] SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat), SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat), diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index aaadd94614..47fa64231a 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -73,7 +73,7 @@ static void DedicatedSignalHandler(int sig) } #endif -#if defined(WIN32) +#if defined(_WIN32) # include /* GetTickCount */ # include # include @@ -150,7 +150,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm) ScreenSizeChanged(); BlitterFactory::GetCurrentBlitter()->PostResize(); -#if defined(WIN32) +#if defined(_WIN32) /* For win32 we need to allocate a console (debug mode does the same) */ CreateConsole(); CreateWindowsConsoleThread(); @@ -173,7 +173,7 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm) void VideoDriver_Dedicated::Stop() { -#ifdef WIN32 +#ifdef _WIN32 CloseWindowsConsoleThread(); #endif free(_dedicated_video_mem); diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index f40c4b6461..e96decb451 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -264,7 +264,7 @@ static void GetAvailableVideoMode(uint *w, uint *h) *h = _resolutions[best].height; } -#ifdef WIN32 +#ifdef _WIN32 /* Let's redefine the LoadBMP macro with because we are dynamically * loading SDL and need to 'SDL_CALL' all functions */ #undef SDL_LoadBMP @@ -500,7 +500,7 @@ static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character) } /* check scancode for BACKQUOTE key, because we want the key left of "1", not anything else (on non-US keyboards) */ -#if defined(WIN32) || defined(__OS2__) +#if defined(_WIN32) || defined(__OS2__) if (sym->scancode == 41) key = WKC_BACKQUOTE; #elif defined(__APPLE__) if (sym->scancode == 10) key = WKC_BACKQUOTE;