Use _WIN32 instead of WIN32 to detect Windows

`WIN32` is not defined when building a 64-bit executable on Windows with Clang. `_WIN32` is the more appropriate option here.
http://web.archive.org/web/20191012035921/http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system contains a handy table/matrix of the options and why this is best.
This commit is contained in:
Stephen Shkardoon
2023-08-13 14:11:41 +12:00
parent 9ae8c79c3a
commit 23f2a2fc9f
44 changed files with 128 additions and 128 deletions

View File

@@ -46,7 +46,7 @@
#include "../rtengine/procparams.h"
#include "pathutils.h"
#ifndef WIN32
#ifndef _WIN32
#include <glibmm/fileutils.h>
#include <glib.h>
#include <glib/gstdio.h>
@@ -121,7 +121,7 @@ int processLineParams ( int argc, char **argv )
// GTK --argument, we're skipping it
break;
#ifdef WIN32
#ifdef _WIN32
case 'w': // This case is handled outside this function
break;
@@ -167,7 +167,7 @@ int processLineParams ( int argc, char **argv )
printf(" %s <file> Start Image Editor with file.\n\n",Glib::path_get_basename (argv[0]).c_str());
std::cout << std::endl;
printf("Options:\n");
#ifdef WIN32
#ifdef _WIN32
printf(" -w Do not open the Windows console\n");
#endif
printf(" -v Print RawTherapee version number and exit\n");
@@ -210,7 +210,7 @@ bool init_rt()
TIFFSetWarningHandler (nullptr); // avoid annoying message boxes
}
#ifndef WIN32
#ifndef _WIN32
// Move the old path to the new one if the new does not exist
if (Glib::file_test (Glib::build_filename (options.rtdir, "cache"), Glib::FILE_TEST_IS_DIR) && !Glib::file_test (options.cacheBaseDir, Glib::FILE_TEST_IS_DIR)) {
@@ -362,7 +362,7 @@ int main (int argc, char **argv)
Glib::init(); // called by Gtk::Main, but this may be important for thread handling, so we call it ourselves now
Gio::init ();
#ifdef WIN32
#ifdef _WIN32
if (GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)) == 0x0003) {
// started from msys2 console => do not buffer stdout
setbuf(stdout, NULL);
@@ -373,7 +373,7 @@ int main (int argc, char **argv)
char exname[512] = {0};
Glib::ustring exePath;
// get the path where the rawtherapee executable is stored
#ifdef WIN32
#ifdef _WIN32
WCHAR exnameU[512] = {0};
GetModuleFileNameW (NULL, exnameU, 511);
WideCharToMultiByte (CP_UTF8, 0, exnameU, -1, exname, 511, 0, 0 );
@@ -416,7 +416,7 @@ int main (int argc, char **argv)
options.rtSettings.lensfunDbBundleDirectory = LENSFUN_DB_PATH;
#endif
#ifdef WIN32
#ifdef _WIN32
bool consoleOpened = false;
// suppression of annoying error boxes
@@ -567,7 +567,7 @@ int main (int argc, char **argv)
}
}
#ifdef WIN32
#ifdef _WIN32
if (consoleOpened) {
printf ("Press any key to exit RawTherapee\n");