diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-07-01 16:20:19 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-07-01 16:20:19 +0000 |
commit | b9b20e32cab7b5d3d481eda3381bb53ffb9a1801 (patch) | |
tree | 51628f57791deb8ce24f9016b30d03ec29c86b0a /src | |
parent | 427c4ba42ff64cdf4f9c370cfd9c29785a85d27c (diff) | |
download | plus-b9b20e32cab7b5d3d481eda3381bb53ffb9a1801.tar.gz plus-b9b20e32cab7b5d3d481eda3381bb53ffb9a1801.tar.bz2 plus-b9b20e32cab7b5d3d481eda3381bb53ffb9a1801.tar.xz plus-b9b20e32cab7b5d3d481eda3381bb53ffb9a1801.zip |
Change the wrong, but mostly supported WIN32 macro to the correct _WIN32
ManaPlus was apparently forked before Mana 8954a7ca0f70bbf1. However,
running a bulk sed replace was easier than cherry-picking, resolving
14 years of conflicts and then still having to do a bulk sed to catch the rest.
Special thanks to Meway (for attempting to build on windows)
and Bjorn (for pointing to that commit)
****
mana/verse!211
Diffstat (limited to 'src')
46 files changed, 203 insertions, 201 deletions
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index 7bede5777..3e6c7490b 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -32,12 +32,12 @@ #include <dirent.h> #include <iostream> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #include <sys/time.h> #elif defined __APPLE__ #include <Carbon/Carbon.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/configmanager.cpp b/src/configmanager.cpp index 4417bfe16..b0de0d5b2 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -109,7 +109,7 @@ void ConfigManager::initConfiguration() config.setValue("opengl", CAST_S32(RENDER_NORMAL_OPENGL)); #elif (defined ANDROID) config.setValue("opengl", CAST_S32(RENDER_GLES_OPENGL)); -#elif (defined WIN32) +#elif (defined _WIN32) config.setValue("opengl", CAST_S32(RENDER_SAFE_OPENGL)); #else // (defined __APPLE__) diff --git a/src/defaults.cpp b/src/defaults.cpp index 354393946..5513dc74c 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -311,12 +311,12 @@ void setConfigDefaults(Configuration &cfg) AddDEF("downloadProxyType", 0); AddDEF("downloadProxyTunnel", false); AddDEF("blur", false); -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) AddDEF("centerwindow", true); -#else // defined(WIN32) || defined(__APPLE__) +#else // defined(_WIN32) || defined(__APPLE__) AddDEF("centerwindow", false); -#endif // defined(WIN32) || defined(__APPLE__) +#endif // defined(_WIN32) || defined(__APPLE__) AddDEF("audioFrequency", 44100); AddDEF("audioChannels", 2); diff --git a/src/dirs.cpp b/src/dirs.cpp index 1a39f9e1e..394815a83 100644 --- a/src/dirs.cpp +++ b/src/dirs.cpp @@ -56,14 +56,14 @@ #include <CoreFoundation/CFBundle.h> #endif // __APPLE__ -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) #include "fs/specialfolder.h" #undef ERROR -#endif // WIN32 +#endif // _WIN32 #include <sys/stat.h> @@ -245,7 +245,7 @@ void Dirs::mountDataDir() Append_false); #endif // defined __native_client__ -#ifndef WIN32 +#ifndef _WIN32 // Add branding/data to VirtFS search path if (!settings.options.brandingPath.empty()) { @@ -261,7 +261,7 @@ void Dirs::mountDataDir() Append_false); } } -#endif // WIN32 +#endif // _WIN32 } void Dirs::initRootDir() @@ -349,7 +349,7 @@ void Dirs::initLocalDataDir() #elif defined __HAIKU__ settings.localDataDir = pathJoin(VirtFs::getUserDir(), "config/cache/Mana"); -#elif defined WIN32 +#elif defined _WIN32 settings.localDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); if (settings.localDataDir.empty()) settings.localDataDir = VirtFs::getUserDir(); @@ -407,7 +407,7 @@ void Dirs::initConfigDir() settings.configDir = pathJoin(VirtFs::getUserDir(), "config/settings/Mana", branding.getValue("appName", "ManaPlus")); -#elif defined WIN32 +#elif defined _WIN32 settings.configDir = getSpecialFolderLocation(CSIDL_APPDATA); if (settings.configDir.empty()) { @@ -499,10 +499,10 @@ void Dirs::initUpdatesDir() settings.updatesDir = updates.str(); } -#ifdef WIN32 +#ifdef _WIN32 if (settings.updatesDir.find(":") != std::string::npos) replaceAll(settings.updatesDir, ":", "_"); -#endif // WIN32 +#endif // _WIN32 const std::string updateDir("/" + settings.updatesDir); @@ -511,7 +511,7 @@ void Dirs::initUpdatesDir() { if (!VirtFs::mkdir(updateDir)) { -#if defined WIN32 +#if defined _WIN32 std::string newDir = pathJoin(settings.localDataDir, settings.updatesDir); if (!CreateDirectory(newDir.c_str(), nullptr) && @@ -523,7 +523,7 @@ void Dirs::initUpdatesDir() errorMessage = _("Error creating updates directory!"); client->setState(State::ERROR); } -#else // defined WIN32 +#else // defined _WIN32 logger->log("Error: %s/%s can't be made, but doesn't exist!", settings.localDataDir.c_str(), @@ -531,7 +531,7 @@ void Dirs::initUpdatesDir() // TRANSLATORS: update server initialisation error errorMessage = _("Error creating updates directory!"); client->setState(State::ERROR); -#endif // defined WIN32 +#endif // defined _WIN32 } } const std::string updateLocal = pathJoin(updateDir, "local"); diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 5abfd9d14..0ca6512f1 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -26,10 +26,10 @@ #include "enums/simpletypes/enumdefines.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR #undef IGNORE -#endif // WIN32 +#endif // _WIN32 /** * All the key functions. diff --git a/src/enums/state.h b/src/enums/state.h index 4784428dc..b24d40f8a 100644 --- a/src/enums/state.h +++ b/src/enums/state.h @@ -26,9 +26,9 @@ #include "enums/simpletypes/enumdefines.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 enumStart(State) { diff --git a/src/fs/files.cpp b/src/fs/files.cpp index 5a041b698..59fd31f11 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -209,7 +209,7 @@ int Files::copyFile(const std::string &restrict srcName, bool Files::existsLocal(const std::string &path) { struct stat statbuf; -#ifdef WIN32 +#ifdef _WIN32 // in windows path\file.ext\ by default detected as exists // if file.ext is not directory, need return false const bool res = (stat(path.c_str(), &statbuf) == 0); @@ -221,9 +221,9 @@ bool Files::existsLocal(const std::string &path) return false; } return true; -#else // WIN32 +#else // _WIN32 return stat(path.c_str(), &statbuf) == 0; -#endif // WIN32 +#endif // _WIN32 } bool Files::loadTextFileLocal(const std::string &fileName, @@ -303,7 +303,7 @@ void Files::enumFiles(StringVect &files, const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (skipSymlinks == true) { struct stat statbuf; @@ -313,7 +313,7 @@ void Files::enumFiles(StringVect &files, continue; } } -#endif // WIN32 +#endif // _WIN32 files.push_back(file); } closedir(dir); diff --git a/src/fs/mkdir.cpp b/src/fs/mkdir.cpp index ee344324c..45a025c6a 100644 --- a/src/fs/mkdir.cpp +++ b/src/fs/mkdir.cpp @@ -24,16 +24,16 @@ #include "utils/cast.h" -#if defined WIN32 +#if defined _WIN32 #include <limits.h> #include <windows.h> -#endif // defined WIN32 +#endif // defined _WIN32 #include <sys/stat.h> #include "debug.h" -#if defined WIN32 +#if defined _WIN32 int mkdir_r(const char *const pathname) { if (!pathname) @@ -103,7 +103,7 @@ int mkdir_r(const char *const pathname) } return 0; } -#else // WIN32 +#else // _WIN32 /// Create a directory, making leading components first if necessary int mkdir_r(const char *const pathname) @@ -164,4 +164,4 @@ int mkdir_r(const char *const pathname) delete []tmp; return 0; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp index 897d2ff41..492f5a449 100644 --- a/src/fs/paths.cpp +++ b/src/fs/paths.cpp @@ -42,22 +42,22 @@ #define realpath(N, R) strcpy(R, N) #endif // __native_client__ -#ifdef WIN32 +#ifdef _WIN32 #include "fs/specialfolder.h" #define realpath(N, R) _fullpath((R), (N), _MAX_PATH) -#endif +#endif // _WIN32 #if defined __OpenBSD__ #include <limits> #else #include <climits> -#endif // WIN32 +#endif // __OpenBSD__ -#ifndef WIN32 +#ifndef _WIN32 #include <unistd.h> #include <sys/types.h> #include <pwd.h> -#endif // WIN32 +#endif // _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") @@ -148,7 +148,7 @@ void prepareFsPath(std::string &path) std::string &fixDirSeparators(std::string &str) { -#ifdef WIN32 +#ifdef _WIN32 return replaceAll(str, "/", "\\"); #else return str; @@ -169,7 +169,7 @@ std::string removeLast(const std::string &str) return str; } -#ifdef WIN32 +#ifdef _WIN32 std::string getSelfName() { return "manaplus.exe"; @@ -195,18 +195,18 @@ std::string getSelfName() return ""; } -#else // WIN32 +#else // _WIN32 std::string getSelfName() { return ""; } -#endif // WIN32 +#endif // _WIN32 std::string getPicturesDir() { -#ifdef WIN32 +#ifdef _WIN32 std::string dir = getSpecialFolderLocation(CSIDL_MYPICTURES); if (dir.empty()) dir = getSpecialFolderLocation(CSIDL_DESKTOP); @@ -244,7 +244,7 @@ std::string getPicturesDir() } } } -#endif // WIN32 +#endif // _WIN32 return pathJoin(VirtFs::getUserDir(), "Desktop"); } @@ -257,11 +257,11 @@ std::string getHomePath() dir += dirSeparator; return dir; #else // defined(UNITTESTS) && defined(UNITESTSDIR) -#ifdef WIN32 +#ifdef _WIN32 return getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); #elif defined(__SWITCH__) return VirtFs::getBaseDir(); -#else +#else // _WIN32 const char *path = getenv("HOME"); if (path == nullptr) { @@ -279,7 +279,7 @@ std::string getHomePath() if (findLast(dir, std::string(dirSeparator)) == false) dir += dirSeparator; return dir; -#endif // WIN32 +#endif // _WIN32 #endif // defined(UNITTESTS) && defined(UNITESTSDIR) } diff --git a/src/fs/specialfolder.cpp b/src/fs/specialfolder.cpp index 807ea093b..34e37aec6 100644 --- a/src/fs/specialfolder.cpp +++ b/src/fs/specialfolder.cpp @@ -20,7 +20,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef WIN32 +#ifdef _WIN32 #include "fs/specialfolder.h" #include <windows.h> @@ -57,4 +57,4 @@ std::string getSpecialFolderLocation(const int folderId) return ret; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/fs/specialfolder.h b/src/fs/specialfolder.h index 618a2d90d..832750768 100644 --- a/src/fs/specialfolder.h +++ b/src/fs/specialfolder.h @@ -23,12 +23,12 @@ #ifndef UTILS_SPECIALFOLDER_H #define UTILS_SPECIALFOLDER_H -#ifdef WIN32 +#ifdef _WIN32 #include <shlobj.h> #include <string> #include "localconsts.h" std::string getSpecialFolderLocation(const int folderId) A_WARN_UNUSED; -#endif // WIN32 +#endif // _WIN32 #endif // UTILS_SPECIALFOLDER_H diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp index 42b93188e..13d15eb09 100644 --- a/src/fs/virtfs/fs.cpp +++ b/src/fs/virtfs/fs.cpp @@ -64,11 +64,11 @@ namespace VirtFs void updateDirSeparator() { -#ifdef WIN32 +#ifdef _WIN32 dirSeparator = "\\"; -#else // WIN32 +#else // _WIN32 dirSeparator = "/"; -#endif // WIN32 +#endif // _WIN32 } const char *getDirSeparator() diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp index 7832dcce6..c623638ca 100644 --- a/src/fs/virtfs/fsdir.cpp +++ b/src/fs/virtfs/fsdir.cpp @@ -204,7 +204,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { struct stat statbuf; @@ -214,7 +214,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 bool found(false); FOR_EACH (StringVectCIter, itn, names) @@ -256,7 +256,7 @@ namespace FsDir name.c_str()) return false; } -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) return false; @@ -265,7 +265,7 @@ namespace FsDir S_ISLNK(statbuf.st_mode) != 0; #else return false; -#endif // WIN32 +#endif // _WIN32 } void freeList(List *restrict const handle) @@ -549,7 +549,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -558,7 +558,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) @@ -599,7 +599,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -608,7 +608,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) @@ -649,7 +649,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -658,7 +658,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) diff --git a/src/game.cpp b/src/game.cpp index bd90937f0..d9df74ddc 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -147,10 +147,10 @@ #include "mumblemanager.h" #endif // USE_MUMBLE -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> #undef ERROR -#endif // WIN32 +#endif // _WIN32 #include <fstream> diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 81d01496d..16375b8a4 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -22,7 +22,7 @@ #include "graphicsmanager.h" #ifdef USE_OPENGL -#ifndef WIN32 +#ifndef _WIN32 #ifdef ANDROID #include <GLES2/gl2.h> @@ -43,7 +43,7 @@ PRAGMA48(GCC diagnostic pop) #include <GL/glx.h> #endif // USE_X11 #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 #endif // USE_OPENGL #include "settings.h" @@ -682,7 +682,7 @@ void GraphicsManager::updatePlanformExtensions() SDL_VERSION(&info.version) if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { -#ifdef WIN32 +#ifdef _WIN32 if (!mwglGetExtensionsString) return; @@ -755,7 +755,7 @@ void GraphicsManager::updatePlanformExtensions() } logger->log("width=%d", DisplayWidth(display, screenNum)); } -#endif // WIN32 +#endif // _WIN32 } } @@ -1398,9 +1398,9 @@ void GraphicsManager::initOpenGLFunctions() logger->log1("shaders not supported"); } -#ifdef WIN32 +#ifdef _WIN32 assignFunctionARB(wglGetExtensionsString) -#endif // WIN32 +#endif // _WIN32 #endif // __native_client__ } @@ -1670,7 +1670,7 @@ void GraphicsManager::detectPixelSize() SDL_VERSION(&info.version) if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) { -#ifdef WIN32 +#ifdef _WIN32 #ifdef USE_SDL2 HDC hdc = GetDC(info.info.win.window); #else @@ -1698,7 +1698,7 @@ void GraphicsManager::detectPixelSize() mWidthMM = DisplayWidthMM(display, screenNum); mHeightMM = DisplayHeightMM(display, screenNum); } -#endif // WIN32 +#endif // _WIN32 } #if defined ANDROID #ifdef USE_SDL2 diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index 655ef0c2c..a33872e5e 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -57,9 +57,9 @@ #include "debug.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 Window *deathNotice = nullptr; DialogsManager *dialogsManager = nullptr; diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index b1847cde1..ef23dc0bc 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -51,9 +51,9 @@ #include "utils/delete2.h" #include "utils/gettext.h" -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include <sstream> diff --git a/src/gui/widgets/tabs/setup_misc.cpp b/src/gui/widgets/tabs/setup_misc.cpp index ea159e8cf..f874497b7 100644 --- a/src/gui/widgets/tabs/setup_misc.cpp +++ b/src/gui/widgets/tabs/setup_misc.cpp @@ -563,13 +563,13 @@ Setup_Misc::Setup_Misc(const Widget2 *const widget) : MainConfig_true); #endif // ANDROID -#ifndef WIN32 +#ifndef _WIN32 // TRANSLATORS: settings option new SetupItemTextField(_("Screenshot directory"), "", "screenshotDirectory3", this, "screenshotDirectory3Event", MainConfig_true, UseBase64_true); -#endif // WIN32 +#endif // _WIN32 // TRANSLATORS: settings option new SetupItemIntTextField(_("Network delay between sub servers"), diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index c980280e8..662e6f356 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -239,11 +239,11 @@ void Setup_Video::apply() * See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode */ -#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) // checks for opengl usage if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE) { -#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) if (!WindowManager::setFullScreen(fullscreen)) { fullscreen = !fullscreen; @@ -267,7 +267,7 @@ void Setup_Video::apply() logger->safeError(errorMsg.str()); } } -#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) } else { @@ -284,7 +284,7 @@ void Setup_Video::apply() nullptr, 260); } -#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) config.setValue("screen", fullscreen); } @@ -415,7 +415,7 @@ void Setup_Video::action(const ActionEvent &event) if (width != mainGraphics->mActualWidth || height != mainGraphics->mActualHeight) { -#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE) { @@ -459,11 +459,11 @@ void Setup_Video::action(const ActionEvent &event) 260); } } -#else // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#else // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) mainGraphics->setWindowSize(width, height); WindowManager::doResizeVideo(width, height, false); -#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) +#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID) } config.setValue("oldscreen", config.getBoolValue("screen")); diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp index 7f0dcdae9..4ddf7ef71 100644 --- a/src/gui/widgets/tabs/setup_visual.cpp +++ b/src/gui/widgets/tabs/setup_visual.cpp @@ -230,12 +230,12 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : "vsyncEvent", mVSyncList, 100, MainConfig_true); -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) // TRANSLATORS: settings option new SetupItemCheckBox(_("Center game window"), "", "centerwindow", this, "centerwindowEvent", MainConfig_true); -#endif // defined(WIN32) || defined(__APPLE__) +#endif // defined(_WIN32) || defined(__APPLE__) // TRANSLATORS: settings option new SetupItemCheckBox(_("Allow screensaver to run"), @@ -269,7 +269,7 @@ void Setup_Visual::apply() { SetupTabScroll::apply(); WindowManager::applyGrabMode(); -#ifndef WIN32 +#ifndef _WIN32 WindowManager::applyScale(); -#endif // WIN32 +#endif // _WIN32 } diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index a198efe8f..a234fdd55 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -91,9 +91,9 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_image.h> -#ifdef WIN32 +#ifdef _WIN32 #include <SDL_syswm.h> -#endif // WIN32 +#endif // _WIN32 PRAGMA48(GCC diagnostic pop) #include "debug.h" @@ -419,17 +419,17 @@ void WindowManager::setIcon() { #if !defined(ANDROID) && !defined(__SWITCH__) std::string iconFile = branding.getValue("appIcon", "icons/manaplus"); -#ifdef WIN32 +#ifdef _WIN32 iconFile.append(".ico"); -#else // WIN32 +#else // _WIN32 iconFile.append(".png"); -#endif // WIN32 +#endif // _WIN32 iconFile = VirtFs::getPath(iconFile); logger->log("Loading icon from file: %s", iconFile.c_str()); -#ifdef WIN32 +#ifdef _WIN32 static SDL_SysWMinfo pInfo; if (mainGraphics) SDL::getWindowWMInfo(mainGraphics->getWindow(), &pInfo); @@ -468,7 +468,7 @@ void WindowManager::setIcon() reinterpret_cast<LONG>(icon)); #endif // WIN64 } -#else // WIN32 +#else // _WIN32 mIcon = MIMG_Load(iconFile.c_str()); if (mIcon != nullptr) @@ -482,7 +482,7 @@ void WindowManager::setIcon() SDL::SetWindowIcon(mainGraphics->getWindow(), mIcon); } -#endif // WIN32 +#endif // _WIN32 #endif // ANDROID } diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 09a39b6ea..210c0d2bc 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -38,9 +38,9 @@ #include "utils/gettext.h" #include "utils/performance.h" -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index b5be96164..c28032404 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -53,9 +53,9 @@ #include "debug.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 static const int MAX_SERVERLIST = 15; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 87a2b1894..9e124a9ec 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -471,7 +471,7 @@ void UpdaterWindow::loadPatch() #if defined(ANDROID) const std::string url = "androidDownloadUrl"; const std::string text = "androidDownloadUrl"; -#elif defined(WIN32) +#elif defined(_WIN32) const std::string url = "windowsDownloadUrl"; const std::string text = "windowsDownloadUrl"; #else // defined(ANDROID) diff --git a/src/logger.cpp b/src/logger.cpp index 7c37ecdf4..b695948fb 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -33,11 +33,11 @@ #include <iostream> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #elif defined __APPLE__ #include <Carbon/Carbon.h> -#endif // WIN32 +#endif // _WIN32 #include <sys/time.h> @@ -441,7 +441,7 @@ void Logger::safeError(const std::string &error_text) error_text.c_str(), nullptr); #else // USE_SDL2 -#ifdef WIN32 +#ifdef _WIN32 MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ // Str255 msg; @@ -459,10 +459,10 @@ void Logger::safeError(const std::string &error_text) error_text).append("\""); if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; -#else // WIN32 +#else // _WIN32 std::cerr << "Error: " << error_text << std::endl; -#endif // WIN32 +#endif // _WIN32 #endif // USE_SDL2 exit(1); @@ -478,7 +478,7 @@ void Logger::error(const std::string &error_text) error_text.c_str(), nullptr); #else // USE_SDL2 -#ifdef WIN32 +#ifdef _WIN32 MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ // Str255 msg; @@ -496,10 +496,10 @@ void Logger::error(const std::string &error_text) "Please see log file for more information.\""); if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; -#else // WIN32 +#else // _WIN32 std::cerr << "Error: " << error_text << std::endl; -#endif // WIN32 +#endif // _WIN32 #endif // USE_SDL2 exit(1); diff --git a/src/main.cpp b/src/main.cpp index 58525134c..4b858c541 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,12 +23,12 @@ #include "maingui.h" -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL.h> PRAGMA48(GCC diagnostic pop) -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/main.h b/src/main.h index 4119c16f1..332668ffe 100644 --- a/src/main.h +++ b/src/main.h @@ -120,7 +120,7 @@ #define PACKAGE_OS "GNU Hurd" #elif defined __HAIKU__ #define PACKAGE_OS "Haiku" -#elif defined WIN32 || defined _WIN32 || defined __WIN32__ || defined __NT__ \ +#elif defined _WIN32 || defined __WIN32__ || defined __NT__ \ || defined WIN64 || defined _WIN64 || defined __WIN64__ \ || defined __MINGW32__ || defined _MSC_VER #define PACKAGE_OS "Windows" diff --git a/src/maingui.cpp b/src/maingui.cpp index 56a1658c8..eb4cd40c1 100644 --- a/src/maingui.cpp +++ b/src/maingui.cpp @@ -171,9 +171,9 @@ int mainGui(int argc, char *argv[]) Mix_Init(MIX_INIT_OGG); #endif // SDL_MIXER_VERSION_ATLEAST(1, 2, 11) -#ifdef WIN32 +#ifdef _WIN32 SetCurrentDirectory(VirtFs::getBaseDir()); -#endif // WIN32 +#endif // _WIN32 setPriority(true); client = new Client; diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index f24df7242..fe8da60c4 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -32,9 +32,9 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) -#ifndef WIN32 +#ifndef _WIN32 #include <sys/mman.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" @@ -54,13 +54,13 @@ MumbleManager::~MumbleManager() { if (mLinkedMem) { -#ifdef WIN32 +#ifdef _WIN32 UnmapViewOfFile(mLinkedMem); #elif defined BSD4_4 -#else // WIN32 +#else // _WIN32 munmap(mLinkedMem, sizeof(LinkedMem)); -#endif // WIN32 +#endif // _WIN32 mLinkedMem = nullptr; } @@ -100,7 +100,7 @@ void MumbleManager::init() return; logger->log1("MumbleManager::init"); -#ifdef WIN32 +#ifdef _WIN32 HANDLE hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink"); if (!hMapObject) @@ -120,7 +120,7 @@ void MumbleManager::init() return; } #elif defined BSD4_4 -#else // WIN32 +#else // _WIN32 char memName[256]; snprintf(memName, sizeof(memName), "/MumbleLink.%u", getuid()); @@ -145,7 +145,7 @@ void MumbleManager::init() return; } -#endif // WIN32 +#endif // _WIN32 wcsncpy(mLinkedMemCache.name, L"ManaVerse", 256); wcsncpy(mLinkedMemCache.description, L"ManaVerse Plugin", 2048); diff --git a/src/progs/dyecmd/client.cpp b/src/progs/dyecmd/client.cpp index 40eaa71cd..a1d69fd30 100644 --- a/src/progs/dyecmd/client.cpp +++ b/src/progs/dyecmd/client.cpp @@ -79,7 +79,7 @@ #include "net/ipc.h" -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> @@ -87,9 +87,9 @@ PRAGMA48(GCC diagnostic pop) #include <sys/time.h> #include "fs/specialfolder.h" #undef ERROR -#else // WIN32 +#else // _WIN32 #include <ctime> -#endif // WIN32 +#endif // _WIN32 #ifdef ANDROID #ifndef USE_SDL2 @@ -261,9 +261,10 @@ void Client::gameInit() eventsManager.init(); eventsManager.enableEvents(); -#ifdef WIN32 +#ifdef _WIN32 Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 + #ifndef USE_SDL2 WindowManager::setIcon(); #endif // USE_SDL2 @@ -287,10 +288,10 @@ void Client::gameInit() SDL::allowScreenSaver(config.getBoolValue("allowscreensaver")); initGraphics(); -#ifndef WIN32 +#ifndef _WIN32 Dirs::extractDataDir(); Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 Dirs::updateDataPath(); @@ -776,7 +777,7 @@ void Client::moveButtons(const int width) { int x = width - mSetupButton->getWidth() - mButtonPadding; mSetupButton->setPosition(x, mButtonPadding); -#ifndef WIN32 +#ifndef _WIN32 x -= mPerfomanceButton->getWidth() + mButtonSpacing; mPerfomanceButton->setPosition(x, mButtonPadding); @@ -795,7 +796,7 @@ void Client::moveButtons(const int width) x -= mCloseButton->getWidth() + mButtonSpacing; mCloseButton->setPosition(x, mButtonPadding); #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 } } diff --git a/src/progs/manaverse/client.cpp b/src/progs/manaverse/client.cpp index 9430bcf5d..eb299dcbe 100644 --- a/src/progs/manaverse/client.cpp +++ b/src/progs/manaverse/client.cpp @@ -146,14 +146,14 @@ #include "configuration.h" #endif // USE_OPENGL -#ifdef WIN32 +#ifdef _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_syswm.h> PRAGMA48(GCC diagnostic pop) #include "fs/specialfolder.h" #undef ERROR -#endif // WIN32 +#endif // _WIN32 #ifdef ANDROID #ifndef USE_SDL2 @@ -393,9 +393,9 @@ void Client::gameInit() eventsManager.init(); eventsManager.enableEvents(); -#ifdef WIN32 +#ifdef _WIN32 Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 #ifndef USE_SDL2 WindowManager::setIcon(); #endif // USE_SDL2 @@ -425,10 +425,10 @@ void Client::gameInit() touchManager.init(); -#ifndef WIN32 +#ifndef _WIN32 Dirs::extractDataDir(); Dirs::mountDataDir(); -#endif // WIN32 +#endif // _WIN32 Dirs::updateDataPath(); @@ -1881,7 +1881,7 @@ void Client::moveButtons(const int width) { int x = width - mSetupButton->getWidth() - mButtonPadding; mSetupButton->setPosition(x, mButtonPadding); -#ifndef WIN32 +#ifndef _WIN32 x -= mPerfomanceButton->getWidth() + mButtonSpacing; mPerfomanceButton->setPosition(x, mButtonPadding); @@ -1900,7 +1900,7 @@ void Client::moveButtons(const int width) x -= mCloseButton->getWidth() + mButtonSpacing; mCloseButton->setPosition(x, mButtonPadding); #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 } } diff --git a/src/render/opengl/mgl.hpp b/src/render/opengl/mgl.hpp index 9dce907a4..4599c3855 100644 --- a/src/render/opengl/mgl.hpp +++ b/src/render/opengl/mgl.hpp @@ -140,6 +140,6 @@ defName(glTextureSubImage2D); defName(glTextureSubImage2DEXT); defName(glClearTexImage); defName(glClearTexSubImage); -#ifdef WIN32 +#ifdef _WIN32 defName(wglGetExtensionsString); -#endif +#endif // _WIN32 diff --git a/src/render/opengl/mglfunctions.h b/src/render/opengl/mglfunctions.h index b583e3625..dfc31718b 100644 --- a/src/render/opengl/mglfunctions.h +++ b/src/render/opengl/mglfunctions.h @@ -28,7 +28,7 @@ LOGGER_H -#ifdef WIN32 +#ifdef _WIN32 #define getFunction(name) wglGetProcAddress(name) #elif defined ANDROID #define getFunction(name) eglGetProcAddress(name) @@ -38,10 +38,10 @@ LOGGER_H #define getFunction(name) glGetProcAddressREGAL(name) #elif defined(__SWITCH__) #define getFunction(name) SDL_GL_GetProcAddress(name) -#else // WIN32 +#else // _WIN32 #define getFunction(name) glXGetProcAddress(\ reinterpret_cast<const GLubyte*>(name)) -#endif // WIN32 +#endif // _WIN32 #define assignFunction(func) \ { \ diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h index 2d8759796..e3954aa1b 100644 --- a/src/render/opengl/mgltypes.h +++ b/src/render/opengl/mgltypes.h @@ -231,11 +231,11 @@ typedef void (APIENTRY *glDebugMessageCallback_t) (GLDEBUGPROC_t callback, const void *userParam); -#ifdef WIN32 +#ifdef _WIN32 typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc); -#else // WIN32 +#else // _WIN32 #define CALLBACK -#endif // WIN32 +#endif // _WIN32 #endif // USE_OPENGL #endif // RENDER_OPENGL_MGLTYPES_H diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 14dc07ae9..57229de5d 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -35,11 +35,11 @@ #include <algorithm> -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#else // WIN32 +#else // _WIN32 #include <ctime> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/sdl2gfx/SDL2_rotozoom.cpp b/src/sdl2gfx/SDL2_rotozoom.cpp index a37e1c51e..597678318 100644 --- a/src/sdl2gfx/SDL2_rotozoom.cpp +++ b/src/sdl2gfx/SDL2_rotozoom.cpp @@ -29,9 +29,9 @@ Changed for ManaPlus (C) 2013-2017 ManaPlus developers */ -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> -#endif +#endif // _WIN32 #include <stdlib.h> #include <string.h> diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index b4f67f373..7ef221880 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -64,10 +64,10 @@ PRAGMA48(GCC diagnostic pop) #include <unistd.h> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #define sleep(seconds) Sleep((seconds) * 1000) -#endif // WIN32 +#endif // _WIN32 #include <sys/time.h> diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index efb149439..f5b30428e 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -26,9 +26,9 @@ #include <fstream> -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #ifdef __native_client__ #include <sys/time.h> diff --git a/src/unittests/catch.hpp b/src/unittests/catch.hpp index 64d1cafc4..f51e1ab35 100644 --- a/src/unittests/catch.hpp +++ b/src/unittests/catch.hpp @@ -1999,7 +1999,7 @@ namespace Catch { #define CATCH_PLATFORM_MAC #elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #define CATCH_PLATFORM_IPHONE -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +#elif defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER) #define CATCH_PLATFORM_WINDOWS #endif @@ -3940,7 +3940,7 @@ namespace Tbc { #include <stdexcept> #include <memory> -#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +#if defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER) #define CLARA_PLATFORM_WINDOWS #endif diff --git a/src/unittests/doctest.h b/src/unittests/doctest.h index c7a745bb0..02d187480 100644 --- a/src/unittests/doctest.h +++ b/src/unittests/doctest.h @@ -264,6 +264,7 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom constr #if !defined(_WIN32) && !defined(__QNX__) && !defined(DOCTEST_CONFIG_POSIX_SIGNALS) #define DOCTEST_CONFIG_POSIX_SIGNALS #endif // _WIN32 + #if defined(DOCTEST_CONFIG_NO_POSIX_SIGNALS) && defined(DOCTEST_CONFIG_POSIX_SIGNALS) #undef DOCTEST_CONFIG_POSIX_SIGNALS #endif // DOCTEST_CONFIG_NO_POSIX_SIGNALS @@ -294,10 +295,10 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom constr #if DOCTEST_MSVC #define DOCTEST_SYMBOL_EXPORT __declspec(dllexport) #define DOCTEST_SYMBOL_IMPORT __declspec(dllimport) -#else // MSVC +#else // DOCTEST_MSVC #define DOCTEST_SYMBOL_EXPORT __attribute__((dllexport)) #define DOCTEST_SYMBOL_IMPORT __attribute__((dllimport)) -#endif // MSVC +#endif // DOCTEST_MSVC #else // _WIN32 #define DOCTEST_SYMBOL_EXPORT __attribute__((visibility("default"))) #define DOCTEST_SYMBOL_IMPORT diff --git a/src/unittests/fs/files.cc b/src/unittests/fs/files.cc index 767c4b5e8..9255195ca 100644 --- a/src/unittests/fs/files.cc +++ b/src/unittests/fs/files.cc @@ -116,12 +116,12 @@ TEST_CASE("Files saveTextFile", "") Files::saveTextFile(dir, "tempfile.txt", "test line\ntext line2"); std::string data = VirtFs::loadTextFileString("test/tempfile.txt"); ::remove((dir + "/tempfile.txt").c_str()); -#ifdef WIN32 +#ifdef _WIN32 REQUIRE(data == "test line\r\ntext line2\r\n"); -#else // WIN32 +#else // _WIN32 REQUIRE(data == "test line\ntext line2\n"); -#endif // WIN32 +#endif // _WIN32 ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 73e857da2..7bbc5176c 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -63,7 +63,7 @@ PRAGMA48(GCC diagnostic pop) #include <unistd.h> #elif defined __native_client__ #include "utils/naclmessages.h" -#elif defined WIN32 +#elif defined _WIN32 #include "utils/cast.h" PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") @@ -94,7 +94,7 @@ bool sendBuffer(const std::string &restrict text) #else // USE_SDL2 -#ifdef WIN32 +#ifdef _WIN32 bool retrieveBuffer(std::string& text, size_t& pos) { bool ret = false; @@ -508,7 +508,7 @@ bool sendBuffer(const std::string &restrict text) naclPostMessage("clipboard-copy", text); return true; } -#else // WIN32 +#else // _WIN32 bool retrieveBuffer(std::string &text A_UNUSED, size_t &pos A_UNUSED) { @@ -519,5 +519,5 @@ bool sendBuffer(const std::string &restrict text A_UNUSED) { return false; } -#endif // WIN32 +#endif // _WIN32 #endif // USE_SDL2 diff --git a/src/utils/env.cpp b/src/utils/env.cpp index 10feebca7..5ecbda7b9 100644 --- a/src/utils/env.cpp +++ b/src/utils/env.cpp @@ -29,14 +29,14 @@ void updateEnv() { -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) if (config.getBoolValue("centerwindow")) setEnv("SDL_VIDEO_CENTERED", "1"); else setEnv("SDL_VIDEO_CENTERED", "0"); -#endif // defined(WIN32) || defined(__APPLE__) +#endif // defined(_WIN32) || defined(__APPLE__) -#ifndef WIN32 +#ifndef _WIN32 const int vsync = settings.options.test.empty() ? config.getIntValue("vsync") : 1; // __GL_SYNC_TO_VBLANK is nvidia variable. @@ -54,20 +54,20 @@ void updateEnv() default: break; } -#endif // WIN32 +#endif // _WIN32 } void setEnv(const char *const name, const char *const value) { if ((name == nullptr) || (value == nullptr)) return; -#ifdef WIN32 +#ifdef _WIN32 if (putenv(const_cast<char*>((std::string(name) + "=" + value).c_str()))) -#else // WIN32 +#else // _WIN32 if (setenv(name, value, 1) != 0) -#endif // WIN32 +#endif // _WIN32 { logger->log("setenv failed: %s=%s", name, value); } diff --git a/src/utils/gettexthelper.cpp b/src/utils/gettexthelper.cpp index 0069b0bfd..fadc19530 100644 --- a/src/utils/gettexthelper.cpp +++ b/src/utils/gettexthelper.cpp @@ -34,10 +34,10 @@ #include <libintl.h> #include <locale.h> -#ifdef WIN32 +#ifdef _WIN32 #include <string> extern "C" char const *_nl_locale_name_default(void); -#endif // WIN32 +#endif // _WIN32 #elif defined(ENABLE_CUSTOMNLS) #include "utils/translation/podict.h" #ifdef __native_client__ @@ -45,9 +45,9 @@ extern "C" char const *_nl_locale_name_default(void); #endif // __native_client__ #endif // ENABLE_NLS -#if defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(WIN32) +#if defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(_WIN32) #include "utils/env.h" -#endif // defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(WIN32) +#endif // defined(ENABLE_NLS) || defined(ENABLE_CUSTOMNLS) && !defined(_WIN32) #include "debug.h" @@ -55,7 +55,7 @@ extern "C" char const *_nl_locale_name_default(void); static std::string setLangEnv() { std::string lang = config.getStringValue("lang"); -#if defined(ENABLE_NLS) && defined(WIN32) +#if defined(ENABLE_NLS) && defined(_WIN32) if (lang.empty()) lang = std::string(_nl_locale_name_default()); #elif defined(ENABLE_CUSTOMNLS) && defined(__native_client__) @@ -66,18 +66,18 @@ static std::string setLangEnv() naclPostMessage("get-uilanguage", ""); lang = naclWaitForMessage(handle); } -#endif // defined(ENABLE_NLS) && defined(WIN32) +#endif // defined(ENABLE_NLS) && defined(_WIN32) if (!lang.empty()) { -#ifdef WIN32 +#ifdef _WIN32 putenv(const_cast<char*>(("LANG=" + lang).c_str())); putenv(const_cast<char*>(("LANGUAGE=" + lang).c_str())); -#else // WIN32 +#else // _WIN32 setEnv("LANG", lang.c_str()); setEnv("LANGUAGE", lang.c_str()); -#endif // WIN32 +#endif // _WIN32 } return lang; @@ -88,11 +88,11 @@ void GettextHelper::initLang() { #ifdef ENABLE_NLS const std::string lang = setLangEnv(); -#ifdef WIN32 +#ifdef _WIN32 // mingw doesn't like LOCALEDIR to be defined for some reason if (lang != "C") bindTextDomain("translations/"); -#else // WIN32 +#else // _WIN32 #ifdef ANDROID #ifdef USE_SDL2 bindTextDomain((std::string(getenv("APPDIR")).append("/locale")).c_str()); @@ -115,7 +115,7 @@ void GettextHelper::initLang() #endif // __APPLE__ #endif // ENABLE_PORTABLE #endif // ANDROID -#endif // WIN32 +#endif // _WIN32 char *locale = setlocale(LC_MESSAGES, lang.c_str()); if (locale) diff --git a/src/utils/process.cpp b/src/utils/process.cpp index 11cdf1c53..b5d47f957 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -36,13 +36,13 @@ PRAGMA48(GCC diagnostic pop) #include "debug.h" -#if defined(WIN32) || defined(__linux__) || \ +#if defined(_WIN32) || defined(__linux__) || \ defined(__linux) || defined(__APPLE__) const int timeOut = 10; -#endif // defined(WIN32) || defined(__linux__) || +#endif // defined(_WIN32) || defined(__linux__) || // defined(__linux) || defined(__APPLE__) -#ifdef WIN32 +#ifdef _WIN32 #include "utils/stringutils.h" @@ -245,7 +245,7 @@ bool execFile(const std::string &pathName A_UNUSED, return false; } -#endif // WIN32 +#endif // _WIN32 #if defined WIN64 bool openBrowser(std::string url) @@ -254,7 +254,7 @@ bool openBrowser(std::string url) replaceAll(url, " ", "").c_str(), nullptr, nullptr, SW_SHOWNORMAL)) > 32; } -#elif defined WIN32 +#elif defined _WIN32 bool openBrowser(std::string url) { return reinterpret_cast<int32_t>(ShellExecute(nullptr, "open", @@ -312,9 +312,9 @@ bool openBrowser(std::string url A_UNUSED) return false; } -#endif // WIN32 +#endif // _WIN32 -#ifdef WIN32 +#ifdef _WIN32 void setPriority(const bool big) { HANDLE hCurrentProcess = GetCurrentProcess(); @@ -323,9 +323,9 @@ void setPriority(const bool big) else SetPriorityClass(hCurrentProcess, BELOW_NORMAL_PRIORITY_CLASS); } -#else // WIN32 +#else // _WIN32 void setPriority(const bool big A_UNUSED) { } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index cc9e830b8..446d9d234 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -38,9 +38,9 @@ #include <algorithm> #include <sstream> -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" @@ -1027,7 +1027,7 @@ std::string escapeString(std::string str) void sanitizePath(std::string &path) { -#ifdef WIN32 +#ifdef _WIN32 const char sepStr = '\\'; const std::string sep2Str = "\\\\"; const std::string sepWrongStr = "/"; @@ -1043,7 +1043,7 @@ void sanitizePath(std::string &path) std::string pathJoin(std::string str1, const std::string &str2) { -#ifdef WIN32 +#ifdef _WIN32 const char sep = '\\'; std::string sepStr = "\\"; #else @@ -1082,7 +1082,7 @@ std::string pathJoin(std::string str1, const std::string &str2, const std::string &str3) { -#ifdef WIN32 +#ifdef _WIN32 const char sep = '\\'; std::string sepStr = "\\"; #else |