From 8954a7ca0f70bbf167c9119d26c7bca8407e8da6 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Mon, 24 Oct 2011 20:28:15 +0300 Subject: Change the wrong, but mostly supported WIN32 macro to the correct _WIN32, enforced by -std=c++0x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer --- libs/enet/include/enet/enet.h | 2 +- libs/enet/protocol.c | 4 ++-- libs/enet/unix.c | 2 +- libs/enet/win32.c | 2 +- mana.cbp | 1 - src/chatlog.cpp | 4 ++-- src/client.cpp | 18 +++++++++--------- src/gui/setup_video.cpp | 4 ++-- src/log.cpp | 4 ++-- src/main.cpp | 4 ++-- src/main.h | 2 +- src/utils/copynpaste.cpp | 2 +- src/utils/mkdir.cpp | 8 ++++---- src/utils/specialfolder.cpp | 2 +- src/utils/specialfolder.h | 2 +- 15 files changed, 30 insertions(+), 31 deletions(-) diff --git a/libs/enet/include/enet/enet.h b/libs/enet/include/enet/enet.h index 02dc2c0a..c5338676 100644 --- a/libs/enet/include/enet/enet.h +++ b/libs/enet/include/enet/enet.h @@ -12,7 +12,7 @@ extern "C" #include -#ifdef WIN32 +#ifdef _WIN32 #include "enet/win32.h" #else #include "enet/unix.h" diff --git a/libs/enet/protocol.c b/libs/enet/protocol.c index d7c3fede..b51ab469 100644 --- a/libs/enet/protocol.c +++ b/libs/enet/protocol.c @@ -1575,7 +1575,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent; #ifdef ENET_DEBUG -#ifdef WIN32 +#ifdef _WIN32 printf ( #else fprintf (stderr, @@ -1625,7 +1625,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED; shouldCompress = compressedSize; #ifdef ENET_DEBUG_COMPRESS -#ifdef WIN32 +#ifdef _WIN32 printf ( #else fprintf (stderr, diff --git a/libs/enet/unix.c b/libs/enet/unix.c index 69715413..75c78bc8 100644 --- a/libs/enet/unix.c +++ b/libs/enet/unix.c @@ -2,7 +2,7 @@ @file unix.c @brief ENet Unix system specific functions */ -#ifndef WIN32 +#ifndef _WIN32 #include #include diff --git a/libs/enet/win32.c b/libs/enet/win32.c index e1fae233..0b32e633 100644 --- a/libs/enet/win32.c +++ b/libs/enet/win32.c @@ -2,7 +2,7 @@ @file win32.c @brief ENet Win32 system specific functions */ -#ifdef WIN32 +#ifdef _WIN32 #include #define ENET_BUILDING_LIB 1 diff --git a/mana.cbp b/mana.cbp index fa4495c0..4261269f 100644 --- a/mana.cbp +++ b/mana.cbp @@ -22,7 +22,6 @@ - diff --git a/src/chatlog.cpp b/src/chatlog.cpp index f33b1aff..011fa3aa 100644 --- a/src/chatlog.cpp +++ b/src/chatlog.cpp @@ -29,7 +29,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #elif defined __APPLE__ #include @@ -167,7 +167,7 @@ void ChatLogger::setServerName(const std::string &serverName) void ChatLogger::makeDir(const std::string &dir) { -#ifdef WIN32 +#ifdef _WIN32 mkdir(dir.c_str()); #else mkdir(dir.c_str(), 0750); diff --git a/src/client.cpp b/src/client.cpp index 5736cec4..642d9376 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -86,7 +86,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #include "utils/specialfolder.h" #else @@ -278,7 +278,7 @@ Client::Client(const Options &options): std::string path = options.brandingPath; // Strip blah.mana from the path -#ifdef WIN32 +#ifdef _WIN32 int loc1 = path.find_last_of('/'); int loc2 = path.find_last_of('\\'); int loc = std::max(loc1, loc2); @@ -297,14 +297,14 @@ Client::Client(const Options &options): resman->addToSearchPath(mLocalDataDir, false); std::string iconFile = branding.getValue("appIcon", "icons/mana"); -#ifdef WIN32 +#ifdef _WIN32 iconFile += ".ico"; #else iconFile += ".png"; #endif iconFile = resman->getPath(iconFile); logger->log("Loading icon from file: %s", iconFile.c_str()); -#ifdef WIN32 +#ifdef _WIN32 static SDL_SysWMinfo pInfo; SDL_GetWMInfo(&pInfo); // Attempt to load icon from .ico file @@ -1069,7 +1069,7 @@ void Client::action(const gcn::ActionEvent &event) void Client::initRootDir() { mRootDir = PHYSFS_getBaseDir(); -#ifdef WIN32 +#ifdef _WIN32 std::string portableName = mRootDir + "portable.xml"; struct stat statbuf; @@ -1135,7 +1135,7 @@ void Client::initHomeDir() #elif defined __HAIKU__ mLocalDataDir = std::string(PHYSFS_getUserDir()) + "/config/data/Mana"; -#elif defined WIN32 +#elif defined _WIN32 mLocalDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); if (mLocalDataDir.empty()) mLocalDataDir = std::string(PHYSFS_getUserDir()); @@ -1163,7 +1163,7 @@ void Client::initHomeDir() mConfigDir = std::string(PHYSFS_getUserDir()) + "/config/settings/Mana" + branding.getValue("appName", "manasource"); -#elif defined WIN32 +#elif defined _WIN32 mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA); if (mConfigDir.empty()) mConfigDir = mLocalDataDir; @@ -1315,7 +1315,7 @@ void Client::initUpdatesDir() { if (!resman->mkdir("/" + mUpdatesDir)) { -#if defined WIN32 +#if defined _WIN32 std::string newDir = mLocalDataDir + "\\" + mUpdatesDir; std::string::size_type loc = newDir.find("/", 0); @@ -1351,7 +1351,7 @@ void Client::initScreenshotDir() } else if (mScreenshotDir.empty()) { -#ifdef WIN32 +#ifdef _WIN32 mScreenshotDir = getSpecialFolderLocation(CSIDL_MYPICTURES); if (mScreenshotDir.empty()) mScreenshotDir = getSpecialFolderLocation(CSIDL_DESKTOP); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d72b402b..ea5dc140 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -301,7 +301,7 @@ void Setup_Video::apply() * See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode */ -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) // checks for opengl usage if (!config.getBoolValue("opengl")) { @@ -327,7 +327,7 @@ void Setup_Video::apply() logger->error(errorMessage.str()); } } -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) } else { diff --git a/src/log.cpp b/src/log.cpp index bb8a78bb..f430589b 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -21,7 +21,7 @@ #include "log.h" -#ifdef WIN32 +#ifdef _WIN32 #include #elif __APPLE__ #include @@ -106,7 +106,7 @@ void Logger::log(const char *log_text, ...) void Logger::error(const std::string &error_text) { log("Error: %s", error_text.c_str()); -#ifdef WIN32 +#ifdef _WIN32 MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ Str255 msg; diff --git a/src/main.cpp b/src/main.cpp index 08ae4a8c..fccc4c9d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -165,14 +165,14 @@ static void parseOptions(int argc, char *argv[], Client::Options &options) } } -#ifdef WIN32 +#ifdef _WIN32 extern "C" char const *_nl_locale_name_default(void); #endif static void initInternationalization() { #if ENABLE_NLS -#ifdef WIN32 +#ifdef _WIN32 SetEnvironmentVariable("LANG", _nl_locale_name_default()); // mingw doesn't like LOCALEDIR to be defined for some reason bindtextdomain("mana", "translations/"); diff --git a/src/main.h b/src/main.h index 82ece500..169ee7d1 100644 --- a/src/main.h +++ b/src/main.h @@ -52,7 +52,7 @@ #ifdef HAVE_CONFIG_H #include "../config.h" -#elif defined WIN32 +#elif defined _WIN32 #include "winver.h" #elif defined __APPLE__ #define PACKAGE_VERSION "0.5.3" diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 3d2e3b80..458a6d27 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -35,7 +35,7 @@ #include #include "copynpaste.h" -#ifdef WIN32 +#ifdef _WIN32 bool RetrieveBuffer(std::string& text, std::string::size_type& pos) { bool ret = false; diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp index 75ab8595..ee40488e 100644 --- a/src/utils/mkdir.cpp +++ b/src/utils/mkdir.cpp @@ -22,7 +22,7 @@ #include #include -#if defined WIN32 +#if defined _WIN32 #include #endif @@ -51,7 +51,7 @@ int mkdir_r(const char *pathname) { } for (p=tmp; *p; p++) { -#if defined WIN32 +#if defined _WIN32 if (*p == '/' || *p == '\\') #else if (*p == '/') @@ -77,13 +77,13 @@ int mkdir_r(const char *pathname) { return -1; } -#if defined WIN32 +#if defined _WIN32 if (!CreateDirectory(tmp, 0)) #else if (mkdir(tmp, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) #endif { -#if defined WIN32 +#if defined _WIN32 // hack, hack. just assume that x: might be a drive // letter, and try again if (!(strlen(tmp) == 2 && diff --git a/src/utils/specialfolder.cpp b/src/utils/specialfolder.cpp index 63337578..0c82ce68 100644 --- a/src/utils/specialfolder.cpp +++ b/src/utils/specialfolder.cpp @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -#ifdef WIN32 +#ifdef _WIN32 #include "specialfolder.h" #include diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h index eef6416b..0c3e999c 100644 --- a/src/utils/specialfolder.h +++ b/src/utils/specialfolder.h @@ -21,7 +21,7 @@ #ifndef SPECIALFOLDER_H #define SPECIALFOLDER_H -#ifdef WIN32 +#ifdef _WIN32 #include #include std::string getSpecialFolderLocation(int folderId); -- cgit v1.2.3-70-g09d2