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

@ -51,7 +51,7 @@
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <io.h> #include <io.h>
#endif #endif
#ifdef WIN32 #ifdef _WIN32
#include <sys/utime.h> #include <sys/utime.h>
#include <winsock2.h> #include <winsock2.h>
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
@ -3846,7 +3846,7 @@ void CLASS bad_pixels (const char *cfname)
free (fname); free (fname);
if (errno != ERANGE) return; if (errno != ERANGE) return;
} }
#if defined(WIN32) || defined(DJGPP) #if defined(_WIN32) || defined(DJGPP)
if (fname[1] == ':') if (fname[1] == ':')
memmove (fname, fname+2, len-2); memmove (fname, fname+2, len-2);
for (cp=fname; *cp; cp++) for (cp=fname; *cp; cp++)
@ -9979,7 +9979,7 @@ int CLASS main (int argc, const char **argv)
fprintf (stderr,_("Will not write an image to the terminal!\n")); fprintf (stderr,_("Will not write an image to the terminal!\n"));
return 1; return 1;
} }
#if defined(WIN32) || defined(DJGPP) || defined(__CYGWIN__) #if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__)
if (setmode(1,O_BINARY) < 0) { if (setmode(1,O_BINARY) < 0) {
perror ("setmode()"); perror ("setmode()");
return 1; return 1;

View File

@ -86,7 +86,7 @@
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <io.h> #include <io.h>
#endif #endif
#ifdef WIN32 #ifdef _WIN32
#include <sys/utime.h> #include <sys/utime.h>
#include <winsock2.h> #include <winsock2.h>
#ifndef strcasecmp #ifndef strcasecmp
@ -4516,7 +4516,7 @@ mask_set:
// free (fname); // free (fname);
// if (errno != ERANGE) return; // if (errno != ERANGE) return;
// } // }
//#if defined(WIN32) || defined(DJGPP) //#if defined(_WIN32) || defined(DJGPP)
// if (fname[1] == ':') // if (fname[1] == ':')
// memmove (fname, fname+2, len-2); // memmove (fname, fname+2, len-2);
// for (cp=fname; *cp; cp++) // for (cp=fname; *cp; cp++)

View File

@ -33,7 +33,7 @@ public:
typedef unsigned short ushort; typedef unsigned short ushort;
typedef unsigned char uchar; typedef unsigned char uchar;
typedef unsigned short (*dcrawImage_t)[4]; typedef unsigned short (*dcrawImage_t)[4];
#ifdef WIN32 #ifdef _WIN32
typedef __int64 INT64; typedef __int64 INT64;
typedef unsigned __int64 UINT64; typedef unsigned __int64 UINT64;
#else #else

View File

@ -221,7 +221,7 @@ bool DynamicProfileRules::loadRules()
try { try {
rule.profilepath = kf.get_string (group, "profilepath"); rule.profilepath = kf.get_string (group, "profilepath");
#if defined (WIN32) #if defined (_WIN32)
// if this is Windows, replace any "/" in the path with "\\" // if this is Windows, replace any "/" in the path with "\\"
size_t pos = rule.profilepath.find("/"); size_t pos = rule.profilepath.find("/");
while (pos != Glib::ustring::npos) { while (pos != Glib::ustring::npos) {
@ -229,7 +229,7 @@ bool DynamicProfileRules::loadRules()
pos = rule.profilepath.find("/", pos); pos = rule.profilepath.find("/", pos);
} }
#endif #endif
#if !defined (WIN32) #if !defined (_WIN32)
// if this is not Windows, replace any "\\" in the path with "/" // if this is not Windows, replace any "\\" in the path with "/"
size_t pos = rule.profilepath.find("\\"); size_t pos = rule.profilepath.find("\\");
while (pos != Glib::ustring::npos) { while (pos != Glib::ustring::npos) {

View File

@ -24,7 +24,7 @@
#include <glibmm/miscutils.h> #include <glibmm/miscutils.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#ifdef WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <netinet/in.h> #include <netinet/in.h>

View File

@ -78,7 +78,7 @@ FramesMetaData* FramesMetaData::fromFile(const Glib::ustring& fname)
static struct tm timeFromTS(const time_t ts) static struct tm timeFromTS(const time_t ts)
{ {
#if !defined(WIN32) #if !defined(_WIN32)
struct tm tm; struct tm tm;
return *gmtime_r(&ts, &tm); return *gmtime_r(&ts, &tm);
#else #else

View File

@ -31,7 +31,7 @@
#include <tiff.h> #include <tiff.h>
#include <tiffio.h> #include <tiffio.h>
#ifdef WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <netinet/in.h> #include <netinet/in.h>
@ -64,7 +64,7 @@ namespace
FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname) FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname)
{ {
#ifdef WIN32 #ifdef _WIN32
// Use native function to disallow sharing, i.e. lock the file for exclusive access. // Use native function to disallow sharing, i.e. lock the file for exclusive access.
// This is important to e.g. prevent Windows Explorer from crashing RT due to concurrently scanning an image file. // This is important to e.g. prevent Windows Explorer from crashing RT due to concurrently scanning an image file.
@ -382,7 +382,7 @@ void my_error_exit (j_common_ptr cinfo)
(*cinfo->err->output_message) (cinfo); (*cinfo->err->output_message) (cinfo);
/* Return control to the setjmp point */ /* Return control to the setjmp point */
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__) #if defined( _WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
__builtin_longjmp(myerr->setjmp_buffer, 1); __builtin_longjmp(myerr->setjmp_buffer, 1);
#else #else
longjmp(myerr->setjmp_buffer, 1); longjmp(myerr->setjmp_buffer, 1);
@ -406,7 +406,7 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize)
jerr.pub.error_exit = my_error_exit; jerr.pub.error_exit = my_error_exit;
/* Establish the setjmp return context for my_error_exit to use. */ /* Establish the setjmp return context for my_error_exit to use. */
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__) #if defined( _WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
if (__builtin_setjmp(jerr.setjmp_buffer)) { if (__builtin_setjmp(jerr.setjmp_buffer)) {
#else #else
@ -492,7 +492,7 @@ int ImageIO::loadJPEG (const Glib::ustring &fname)
my_jpeg_stdio_src (&cinfo, file); my_jpeg_stdio_src (&cinfo, file);
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__) #if defined( _WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
if ( __builtin_setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->error_jmp_buf) == 0 ) { if ( __builtin_setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->error_jmp_buf) == 0 ) {
#else #else
if ( setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->error_jmp_buf) == 0 ) { if ( setjmp((reinterpret_cast<rt_jpeg_error_mgr*>(cinfo.src))->error_jmp_buf) == 0 ) {
@ -568,7 +568,7 @@ int ImageIO::loadJPEG (const Glib::ustring &fname)
int ImageIO::getTIFFSampleFormat (const Glib::ustring &fname, IIOSampleFormat &sFormat, IIOSampleArrangement &sArrangement) int ImageIO::getTIFFSampleFormat (const Glib::ustring &fname, IIOSampleFormat &sFormat, IIOSampleArrangement &sArrangement)
{ {
#ifdef WIN32 #ifdef _WIN32
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (fname.c_str(), -1, NULL, NULL, NULL); wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (fname.c_str(), -1, NULL, NULL, NULL);
TIFF* in = TIFFOpenW (wfilename, "r"); TIFF* in = TIFFOpenW (wfilename, "r");
g_free (wfilename); g_free (wfilename);
@ -681,7 +681,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname)
lock.release(); lock.release();
} }
#ifdef WIN32 #ifdef _WIN32
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (fname.c_str(), -1, NULL, NULL, NULL); wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (fname.c_str(), -1, NULL, NULL, NULL);
TIFF* in = TIFFOpenW (wfilename, "r"); TIFF* in = TIFFOpenW (wfilename, "r");
g_free (wfilename); g_free (wfilename);
@ -988,7 +988,7 @@ int ImageIO::saveJPEG (const Glib::ustring &fname, int quality, int subSamp) con
jerr.pub.error_exit = my_error_exit; jerr.pub.error_exit = my_error_exit;
/* Establish the setjmp return context for my_error_exit to use. */ /* Establish the setjmp return context for my_error_exit to use. */
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__) #if defined( _WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
if (__builtin_setjmp(jerr.setjmp_buffer)) { if (__builtin_setjmp(jerr.setjmp_buffer)) {
#else #else
@ -1063,7 +1063,7 @@ int ImageIO::saveJPEG (const Glib::ustring &fname, int quality, int subSamp) con
unsigned char *row = new unsigned char [rowlen]; unsigned char *row = new unsigned char [rowlen];
/* To avoid memory leaks we establish a new setjmp return context for my_error_exit to use. */ /* To avoid memory leaks we establish a new setjmp return context for my_error_exit to use. */
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__) #if defined( _WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
if (__builtin_setjmp(jerr.setjmp_buffer)) { if (__builtin_setjmp(jerr.setjmp_buffer)) {
#else #else
@ -1147,7 +1147,7 @@ int ImageIO::saveTIFF (
mode += '8'; mode += '8';
} }
#ifdef WIN32 #ifdef _WIN32
FILE *file = g_fopen_withBinaryAndLock (fname); FILE *file = g_fopen_withBinaryAndLock (fname);
int fileno = _fileno(file); int fileno = _fileno(file);
int osfileno = _get_osfhandle(fileno); int osfileno = _get_osfhandle(fileno);
@ -1245,7 +1245,7 @@ int ImageIO::saveTIFF (
} }
TIFFClose (out); TIFFClose (out);
#ifdef WIN32 #ifdef _WIN32
fclose (file); fclose (file);
#endif #endif

View File

@ -240,7 +240,7 @@ my_error_exit (j_common_ptr cinfo)
j_decompress_ptr dinfo = (j_decompress_ptr)cinfo; j_decompress_ptr dinfo = (j_decompress_ptr)cinfo;
// longjmp (((rt_jpeg_error_mgr*)(dinfo->src))->error_jmp_buf, 1); // longjmp (((rt_jpeg_error_mgr*)(dinfo->src))->error_jmp_buf, 1);
#if defined( WIN32 ) && defined( __x86_64__ ) && !defined(__clang__) #if defined( _WIN32 ) && defined( __x86_64__ ) && !defined(__clang__)
__builtin_longjmp ((reinterpret_cast<rt_jpeg_error_mgr*>(dinfo->src)) ->error_jmp_buf, 1); __builtin_longjmp ((reinterpret_cast<rt_jpeg_error_mgr*>(dinfo->src)) ->error_jmp_buf, 1);
#else #else
longjmp ((reinterpret_cast<rt_jpeg_error_mgr*>(dinfo->src)) ->error_jmp_buf, 1); longjmp ((reinterpret_cast<rt_jpeg_error_mgr*>(dinfo->src)) ->error_jmp_buf, 1);
@ -248,7 +248,7 @@ my_error_exit (j_common_ptr cinfo)
} }
#ifdef WIN32 #ifdef _WIN32
#define JVERSION "6b 27-Mar-1998" #define JVERSION "6b 27-Mar-1998"
#define JCOPYRIGHT_SHORT "(C) 1998, Thomas G. Lane" #define JCOPYRIGHT_SHORT "(C) 1998, Thomas G. Lane"
#define JMESSAGE(code,string) string , #define JMESSAGE(code,string) string ,

View File

@ -25,7 +25,7 @@
#include <glibmm/fileutils.h> #include <glibmm/fileutils.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#ifdef WIN32 #ifdef _WIN32
#include <shlobj.h> #include <shlobj.h>
#endif #endif
@ -906,7 +906,7 @@ Glib::ustring rtengine::LCPStore::getDefaultCommonDirectory() const
{ {
Glib::ustring dir; Glib::ustring dir;
#ifdef WIN32 #ifdef _WIN32
WCHAR pathW[MAX_PATH] = {0}; WCHAR pathW[MAX_PATH] = {0};
if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_COMMON_APPDATA, false)) { if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_COMMON_APPDATA, false)) {

View File

@ -22,7 +22,7 @@
// get mmap() sorted out // get mmap() sorted out
#ifdef MYFILE_MMAP #ifdef MYFILE_MMAP
#ifdef WIN32 #ifdef _WIN32
#include <fcntl.h> #include <fcntl.h>
#include <windows.h> #include <windows.h>
@ -59,13 +59,13 @@ int munmap(void *start, size_t length)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#else // WIN32 #else // _WIN32
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#endif // WIN32 #endif // _WIN32
#endif // MYFILE_MMAP #endif // MYFILE_MMAP
#ifdef MYFILE_MMAP #ifdef MYFILE_MMAP
@ -74,7 +74,7 @@ rtengine::IMFILE* rtengine::fopen (const char* fname)
{ {
int fd; int fd;
#ifdef WIN32 #ifdef _WIN32
fd = -1; fd = -1;
// First convert UTF8 to UTF16, then use Windows function to open the file and convert back to file descriptor. // First convert UTF8 to UTF16, then use Windows function to open the file and convert back to file descriptor.

View File

@ -18,7 +18,7 @@
*/ */
#pragma once #pragma once
#ifdef WIN32 #ifdef _WIN32
#include <profileapi.h> #include <profileapi.h>
#elif defined __APPLE__ #elif defined __APPLE__
#include <sys/time.h> #include <sys/time.h>
@ -30,7 +30,7 @@ class MyTime
{ {
public: public:
#ifndef WIN32 #ifndef _WIN32
timespec t; timespec t;
#else #else
LONGLONG t; LONGLONG t;
@ -47,7 +47,7 @@ public:
void set () void set ()
{ {
#ifdef WIN32 #ifdef _WIN32
LARGE_INTEGER ulf; LARGE_INTEGER ulf;
QueryPerformanceCounter(&ulf); QueryPerformanceCounter(&ulf);
t = ulf.QuadPart; t = ulf.QuadPart;
@ -63,7 +63,7 @@ public:
int etime (const MyTime &a) const int etime (const MyTime &a) const
{ {
#ifndef WIN32 #ifndef _WIN32
return (t.tv_sec - a.t.tv_sec) * 1000000 + (t.tv_nsec - a.t.tv_nsec) / 1000; return (t.tv_sec - a.t.tv_sec) * 1000000 + (t.tv_nsec - a.t.tv_nsec) / 1000;
#else #else
return (t - a.t) * 1000 / (baseFrequency / 1000); return (t - a.t) * 1000 / (baseFrequency / 1000);

View File

@ -67,7 +67,7 @@ Glib::ustring expandRelativePath(const Glib::ustring &procparams_fname, const Gl
Glib::ustring expandRelativePath2(const Glib::ustring &procparams_fname, const Glib::ustring &procparams_fname2, const Glib::ustring &prefix, Glib::ustring embedded_fname) Glib::ustring expandRelativePath2(const Glib::ustring &procparams_fname, const Glib::ustring &procparams_fname2, const Glib::ustring &prefix, Glib::ustring embedded_fname)
{ {
#if defined (WIN32) #if defined (_WIN32)
// if this is Windows, replace any "/" in the filename with "\\" // if this is Windows, replace any "/" in the filename with "\\"
size_t pos = embedded_fname.find("/"); size_t pos = embedded_fname.find("/");
while (pos != string::npos) { while (pos != string::npos) {
@ -75,7 +75,7 @@ Glib::ustring expandRelativePath2(const Glib::ustring &procparams_fname, const G
pos = embedded_fname.find("/", pos); pos = embedded_fname.find("/", pos);
} }
#endif #endif
#if !defined (WIN32) #if !defined (_WIN32)
// if this is not Windows, replace any "\\" in the filename with "/" // if this is not Windows, replace any "\\" in the filename with "/"
size_t pos = embedded_fname.find("\\"); size_t pos = embedded_fname.find("\\");
while (pos != string::npos) { while (pos != string::npos) {
@ -10244,7 +10244,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
if (keyFile.has_group("Film Simulation")) { if (keyFile.has_group("Film Simulation")) {
assignFromKeyfile(keyFile, "Film Simulation", "Enabled", pedited, filmSimulation.enabled, pedited->filmSimulation.enabled); assignFromKeyfile(keyFile, "Film Simulation", "Enabled", pedited, filmSimulation.enabled, pedited->filmSimulation.enabled);
assignFromKeyfile(keyFile, "Film Simulation", "ClutFilename", pedited, filmSimulation.clutFilename, pedited->filmSimulation.clutFilename); assignFromKeyfile(keyFile, "Film Simulation", "ClutFilename", pedited, filmSimulation.clutFilename, pedited->filmSimulation.clutFilename);
#if defined (WIN32) #if defined (_WIN32)
// if this is Windows, replace any "/" in the filename with "\\" // if this is Windows, replace any "/" in the filename with "\\"
size_t pos = filmSimulation.clutFilename.find("/"); size_t pos = filmSimulation.clutFilename.find("/");
while (pos != string::npos) { while (pos != string::npos) {
@ -10252,7 +10252,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
pos = filmSimulation.clutFilename.find("/", pos); pos = filmSimulation.clutFilename.find("/", pos);
} }
#endif #endif
#if !defined (WIN32) #if !defined (_WIN32)
// if this is not Windows, replace any "\\" in the filename with "/" // if this is not Windows, replace any "\\" in the filename with "/"
size_t pos = filmSimulation.clutFilename.find("\\"); size_t pos = filmSimulation.clutFilename.find("\\");
while (pos != string::npos) { while (pos != string::npos) {

View File

@ -5,7 +5,7 @@
*/ */
#include <strings.h> #include <strings.h>
#ifdef WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <netinet/in.h> #include <netinet/in.h>

View File

@ -18,7 +18,7 @@
*/ */
#pragma once #pragma once
#ifdef WIN32 #ifdef _WIN32
#include <aclapi.h> #include <aclapi.h>
#include <windows.h> #include <windows.h>

View File

@ -253,7 +253,7 @@ bool BatchQueue::saveBatchQueue ()
const auto& saveFormat = entry->saveFormat; const auto& saveFormat = entry->saveFormat;
// Warning: for code's simplicity in loadBatchQueue, each field must end by the '|' character, safer than ';' or ',' since it can't be used in paths // Warning: for code's simplicity in loadBatchQueue, each field must end by the '|' character, safer than ';' or ',' since it can't be used in paths
#ifdef WIN32 #ifdef _WIN32
// on windows it crashes if we don't use c_str() and filename etc. contain special (e.g. chinese) characters, see issue 3387 // on windows it crashes if we don't use c_str() and filename etc. contain special (e.g. chinese) characters, see issue 3387
file << entry->filename.c_str() << '|' << entry->savedParamsFile.c_str() << '|' << entry->outFileName.c_str() << '|' << saveFormat.format << '|' file << entry->filename.c_str() << '|' << entry->savedParamsFile.c_str() << '|' << entry->outFileName.c_str() << '|' << saveFormat.format << '|'
#else #else

View File

@ -50,7 +50,7 @@ BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine:
thumbnail = thm; thumbnail = thm;
#if 1 //ndef WIN32 #if 1 //ndef _WIN32
// The BatchQueueEntryIdleHelper tracks if an entry has been deleted while it was sitting waiting for "idle" // The BatchQueueEntryIdleHelper tracks if an entry has been deleted while it was sitting waiting for "idle"
bqih = new BatchQueueEntryIdleHelper; bqih = new BatchQueueEntryIdleHelper;
bqih->bqentry = this; bqih->bqentry = this;

View File

@ -24,7 +24,7 @@
#include <giomm.h> #include <giomm.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#ifdef WIN32 #ifdef _WIN32
#include <fileapi.h> #include <fileapi.h>
#endif #endif
@ -310,7 +310,7 @@ void CacheManager::deleteFiles (const Glib::ustring& fname, const std::string& m
std::string CacheManager::getMD5 (const Glib::ustring& fname) std::string CacheManager::getMD5 (const Glib::ustring& fname)
{ {
#ifdef WIN32 #ifdef _WIN32
std::unique_ptr<wchar_t, GFreeFunc> wfname(reinterpret_cast<wchar_t*>(g_utf8_to_utf16 (fname.c_str (), -1, NULL, NULL, NULL)), g_free); std::unique_ptr<wchar_t, GFreeFunc> wfname(reinterpret_cast<wchar_t*>(g_utf8_to_utf16 (fname.c_str (), -1, NULL, NULL, NULL)), g_free);

View File

@ -17,7 +17,7 @@
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include <iomanip> #include <iomanip>
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
@ -1496,7 +1496,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
// While the Right-side ALT is pressed, auto-enable highlight and shadow clipping indicators // While the Right-side ALT is pressed, auto-enable highlight and shadow clipping indicators
// TODO: Add linux/MacOS specific functions for alternative // TODO: Add linux/MacOS specific functions for alternative
#ifdef WIN32 #ifdef _WIN32
if (GetKeyState(VK_RMENU) < 0) { if (GetKeyState(VK_RMENU) < 0) {
showcs = true; showcs = true;

View File

@ -87,7 +87,7 @@ DirBrowser::DirBrowser () : dirTreeModel(),
dtColumns(), dtColumns(),
tvc(M("DIRBROWSER_FOLDERS")), tvc(M("DIRBROWSER_FOLDERS")),
expandSuccess(false) expandSuccess(false)
#ifdef WIN32 #ifdef _WIN32
, volumes(0) , volumes(0)
#endif #endif
{ {
@ -160,7 +160,7 @@ void DirBrowser::fillDirTree ()
dirTreeModel->signal_sort_column_changed().connect(sigc::mem_fun(*this, &DirBrowser::on_sort_column_changed)); dirTreeModel->signal_sort_column_changed().connect(sigc::mem_fun(*this, &DirBrowser::on_sort_column_changed));
} }
#ifdef WIN32 #ifdef _WIN32
void DirBrowser::addRoot (char letter) void DirBrowser::addRoot (char letter)
{ {
@ -251,7 +251,7 @@ int updateVolumesUI (void* br)
void DirBrowser::fillRoot () void DirBrowser::fillRoot ()
{ {
#ifdef WIN32 #ifdef _WIN32
volumes = GetLogicalDrives (); volumes = GetLogicalDrives ();
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
@ -396,7 +396,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath)
int count = 0; int count = 0;
expandSuccess = true; expandSuccess = true;
#ifndef WIN32 #ifndef _WIN32
Gtk::TreeModel::iterator j = dirTreeModel->get_iter (path); Gtk::TreeModel::iterator j = dirTreeModel->get_iter (path);
path.up (); path.up ();
path.push_back (0); path.push_back (0);
@ -406,7 +406,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath)
while (dir) { while (dir) {
Glib::ustring dirstr = dir; Glib::ustring dirstr = dir;
#ifdef WIN32 #ifdef _WIN32
if (count == 0) { if (count == 0) {
dirstr = dirstr + "\\"; dirstr = dirstr + "\\";
@ -419,7 +419,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath)
while (i && expandSuccess) { while (i && expandSuccess) {
Gtk::TreeModel::Row crow = *i; Gtk::TreeModel::Row crow = *i;
Glib::ustring str = crow[dtColumns.filename]; Glib::ustring str = crow[dtColumns.filename];
#ifdef WIN32 #ifdef _WIN32
if (str.casefold() == dirstr.casefold()) { if (str.casefold() == dirstr.casefold()) {
#else #else

View File

@ -72,7 +72,7 @@ private:
bool expandSuccess; bool expandSuccess;
#ifdef WIN32 #ifdef _WIN32
unsigned int volumes; unsigned int volumes;
public: public:
void updateVolumes (); void updateVolumes ();

View File

@ -43,7 +43,7 @@
#include "thumbnail.h" #include "thumbnail.h"
#include "toolpanelcoord.h" #include "toolpanelcoord.h"
#ifdef WIN32 #ifdef _WIN32
#include "windows.h" #include "windows.h"
#include "../rtengine/winutils.h" #include "../rtengine/winutils.h"
@ -70,7 +70,7 @@ void setprogressStrUI(double val, const Glib::ustring str, MyProgressBar* pProgr
#if !defined(__APPLE__) // monitor profile not supported on apple #if !defined(__APPLE__) // monitor profile not supported on apple
bool find_default_monitor_profile (GdkWindow *rootwin, Glib::ustring &defprof, Glib::ustring &defprofname) bool find_default_monitor_profile (GdkWindow *rootwin, Glib::ustring &defprof, Glib::ustring &defprofname)
{ {
#ifdef WIN32 #ifdef _WIN32
HDC hDC = GetDC (nullptr); HDC hDC = GetDC (nullptr);
if (hDC != nullptr) { if (hDC != nullptr) {
@ -151,7 +151,7 @@ bool hasUserOnlyPermission(const Glib::ustring &dirname)
const guint32 mode = file_info->get_attribute_uint32("unix::mode"); const guint32 mode = file_info->get_attribute_uint32("unix::mode");
return (mode & 0777) == 0700 && owner == Glib::get_user_name(); return (mode & 0777) == 0700 && owner == Glib::get_user_name();
#elif defined(WIN32) #elif defined(_WIN32)
const Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(dirname); const Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(dirname);
const Glib::RefPtr<Gio::FileInfo> file_info = file->query_info("owner::user"); const Glib::RefPtr<Gio::FileInfo> file_info = file->query_info("owner::user");
if (!file_info) { if (!file_info) {
@ -254,7 +254,7 @@ void setUserOnlyPermission(const Glib::RefPtr<Gio::File> file, bool execute)
file->set_attribute_uint32("unix::mode", mode, Gio::FILE_QUERY_INFO_NONE); file->set_attribute_uint32("unix::mode", mode, Gio::FILE_QUERY_INFO_NONE);
} catch (Gio::Error &) { } catch (Gio::Error &) {
} }
#elif defined(WIN32) #elif defined(_WIN32)
// Get the current user's SID. // Get the current user's SID.
HANDLE process_token_raw; HANDLE process_token_raw;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &process_token_raw)) { if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &process_token_raw)) {
@ -324,7 +324,7 @@ void setUserOnlyPermission(const Glib::RefPtr<Gio::File> file, bool execute)
*/ */
Glib::ustring getTmpDirectory() Glib::ustring getTmpDirectory()
{ {
#if defined(__linux__) || defined(__APPLE__) || defined(WIN32) #if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
static Glib::ustring recent_dir = ""; static Glib::ustring recent_dir = "";
const Glib::ustring tmp_dir_root = Glib::get_tmp_dir(); const Glib::ustring tmp_dir_root = Glib::get_tmp_dir();
const Glib::ustring subdir_base = const Glib::ustring subdir_base =
@ -1545,7 +1545,7 @@ void EditorPanel::refreshProcessingState (bool inProcessingP)
val = 0.0; val = 0.0;
str = "PROGRESSBAR_READY"; str = "PROGRESSBAR_READY";
#ifdef WIN32 #ifdef _WIN32
// Maybe accessing "parent", which is a Gtk object, can justify to get the Gtk lock... // Maybe accessing "parent", which is a Gtk object, can justify to get the Gtk lock...
if (!firstProcessingDone && static_cast<RTWindow*> (parent)->getIsFullscreen()) { if (!firstProcessingDone && static_cast<RTWindow*> (parent)->getIsFullscreen()) {

View File

@ -265,7 +265,7 @@ void ExternalEditorPreferences::onFileChooserDialogResponse(
false; false;
#endif #endif
row[model_columns.command] = row[model_columns.command] =
#ifdef WIN32 #ifdef _WIN32
'"' + dialog->get_filename() + '"'; '"' + dialog->get_filename() + '"';
#else #else
Glib::shell_quote(dialog->get_filename()); Glib::shell_quote(dialog->get_filename());
@ -314,7 +314,7 @@ void ExternalEditorPreferences::openFileChooserDialog()
const auto exe_filter = Gtk::FileFilter::create(); const auto exe_filter = Gtk::FileFilter::create();
exe_filter->set_name(M("FILECHOOSER_FILTER_EXECUTABLE")); exe_filter->set_name(M("FILECHOOSER_FILTER_EXECUTABLE"));
exe_filter->add_custom(Gtk::FILE_FILTER_MIME_TYPE, [](const Gtk::FileFilter::Info &info) { exe_filter->add_custom(Gtk::FILE_FILTER_MIME_TYPE, [](const Gtk::FileFilter::Info &info) {
#ifdef WIN32 #ifdef _WIN32
return info.mime_type == "application/x-msdownload"; return info.mime_type == "application/x-msdownload";
#else #else
return Gio::content_type_can_be_executable(info.mime_type); return Gio::content_type_can_be_executable(info.mime_type);

View File

@ -21,7 +21,7 @@
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#ifdef WIN32 #ifdef _WIN32
#include <shlobj.h> #include <shlobj.h>
#include <shellapi.h> #include <shellapi.h>
#endif #endif
@ -79,7 +79,7 @@ void ExtProgStore::init ()
actions.clear (); actions.clear ();
#ifdef WIN32 #ifdef _WIN32
// Please do not add obscure little tools here, only widely used programs. // Please do not add obscure little tools here, only widely used programs.
// They should also have a proper setup program and therefore a standard path. // They should also have a proper setup program and therefore a standard path.
@ -104,7 +104,7 @@ void ExtProgStore::init ()
#endif #endif
} }
#ifdef WIN32 #ifdef _WIN32
bool ExtProgStore::searchProgram (const Glib::ustring& name, bool ExtProgStore::searchProgram (const Glib::ustring& name,
const Glib::ustring& exePath, const Glib::ustring& exePath,
const Glib::ustring& exePath86, const Glib::ustring& exePath86,
@ -240,7 +240,7 @@ bool ExtProgStore::spawnCommandSync (const Glib::ustring& cmd)
bool ExtProgStore::openInGimp (const Glib::ustring& fileName) bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
{ {
#if defined WIN32 #if defined _WIN32
auto executable = Glib::build_filename (options.gimpDir, "bin", "gimp-win-remote"); auto executable = Glib::build_filename (options.gimpDir, "bin", "gimp-win-remote");
auto success = ShellExecute( NULL, "open", executable.c_str(), fileName.c_str(), NULL, SW_SHOWNORMAL ); auto success = ShellExecute( NULL, "open", executable.c_str(), fileName.c_str(), NULL, SW_SHOWNORMAL );
@ -260,7 +260,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
#endif #endif
#ifdef WIN32 #ifdef _WIN32
if (reinterpret_cast<uintptr_t>(success) > 32) { if (reinterpret_cast<uintptr_t>(success) > 32) {
return true; return true;
} }
@ -271,7 +271,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
#endif #endif
#ifdef WIN32 #ifdef _WIN32
for (auto ver = 12; ver >= 0; --ver) { for (auto ver = 12; ver >= 0; --ver) {
@ -300,7 +300,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
bool ExtProgStore::openInPhotoshop (const Glib::ustring& fileName) bool ExtProgStore::openInPhotoshop (const Glib::ustring& fileName)
{ {
#if defined WIN32 #if defined _WIN32
const auto executable = Glib::build_filename(options.psDir, "Photoshop.exe"); const auto executable = Glib::build_filename(options.psDir, "Photoshop.exe");
const auto cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" \"") + fileName + Glib::ustring("\""); const auto cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" \"") + fileName + Glib::ustring("\"");
@ -324,7 +324,7 @@ bool ExtProgStore::openInCustomEditor (const Glib::ustring& fileName, const Glib
command = &(options.customEditorProg); command = &(options.customEditorProg);
} }
#if defined WIN32 #if defined _WIN32
const auto cmdLine = Glib::ustring("\"") + *command + Glib::ustring("\""); const auto cmdLine = Glib::ustring("\"") + *command + Glib::ustring("\"");
auto success = ShellExecute( NULL, "open", cmdLine.c_str(), ('"' + fileName + '"').c_str(), NULL, SW_SHOWNORMAL ); auto success = ShellExecute( NULL, "open", cmdLine.c_str(), ('"' + fileName + '"').c_str(), NULL, SW_SHOWNORMAL );
@ -381,7 +381,7 @@ bool ExtProgStore::openInExternalEditor(const Glib::ustring &fileName, const Edi
std::cout << "Unable to launch external editor with Gio. Trying custom launcher." << std::endl; std::cout << "Unable to launch external editor with Gio. Trying custom launcher." << std::endl;
} }
Glib::ustring command = editorInfo.commandline; Glib::ustring command = editorInfo.commandline;
#if defined WIN32 #if defined _WIN32
if (command.length() > 2 && command[0] == '"' && command[command.length() - 1] == '"') { if (command.length() > 2 && command[0] == '"' && command[command.length() - 1] == '"') {
command = command.substr(1, command.length() - 2); command = command.substr(1, command.length() - 2);
} }

View File

@ -55,7 +55,7 @@ class ExtProgStore
MyMutex mtx; // covers actions MyMutex mtx; // covers actions
std::vector<ExtProgAction> actions; std::vector<ExtProgAction> actions;
#ifdef WIN32 #ifdef _WIN32
bool searchProgram (const Glib::ustring& name, bool searchProgram (const Glib::ustring& name,
const Glib::ustring& exePath, const Glib::ustring& exePath,
const Glib::ustring& exePath86, const Glib::ustring& exePath86,

View File

@ -272,7 +272,7 @@ FileBrowser::FileBrowser () :
/*********************** /***********************
* external programs * external programs
* *********************/ * *********************/
#if defined(WIN32) #if defined(_WIN32)
Gtk::manage(miOpenDefaultViewer = new Gtk::MenuItem (M("FILEBROWSER_OPENDEFAULTVIEWER"))); Gtk::manage(miOpenDefaultViewer = new Gtk::MenuItem (M("FILEBROWSER_OPENDEFAULTVIEWER")));
#endif #endif
@ -296,7 +296,7 @@ FileBrowser::FileBrowser () :
p++; p++;
Gtk::Menu* submenuExtProg = Gtk::manage (new Gtk::Menu()); Gtk::Menu* submenuExtProg = Gtk::manage (new Gtk::Menu());
#ifdef WIN32 #ifdef _WIN32
if (miOpenDefaultViewer) { if (miOpenDefaultViewer) {
submenuExtProg->attach (*miOpenDefaultViewer, 0, 1, p, p + 1); submenuExtProg->attach (*miOpenDefaultViewer, 0, 1, p, p + 1);
p++; p++;
@ -310,7 +310,7 @@ FileBrowser::FileBrowser () :
submenuExtProg->show_all (); submenuExtProg->show_all ();
menuExtProg->set_submenu (*submenuExtProg); menuExtProg->set_submenu (*submenuExtProg);
} else { } else {
#ifdef WIN32 #ifdef _WIN32
if (miOpenDefaultViewer) { if (miOpenDefaultViewer) {
pmenu->attach (*miOpenDefaultViewer, 0, 1, p, p + 1); pmenu->attach (*miOpenDefaultViewer, 0, 1, p, p + 1);
p++; p++;
@ -482,7 +482,7 @@ FileBrowser::FileBrowser () :
amiExtProg[i]->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), amiExtProg[i])); amiExtProg[i]->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), amiExtProg[i]));
} }
#ifdef WIN32 #ifdef _WIN32
if (miOpenDefaultViewer) { if (miOpenDefaultViewer) {
miOpenDefaultViewer->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), miOpenDefaultViewer)); miOpenDefaultViewer->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), miOpenDefaultViewer));
} }
@ -1046,7 +1046,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
tbl->clearFromCacheRequested (mselected, true); tbl->clearFromCacheRequested (mselected, true);
//queue_draw (); //queue_draw ();
#ifdef WIN32 #ifdef _WIN32
} else if (miOpenDefaultViewer && m == miOpenDefaultViewer) { } else if (miOpenDefaultViewer && m == miOpenDefaultViewer) {
openDefaultViewer(1); openDefaultViewer(1);
#endif #endif
@ -1157,7 +1157,7 @@ void FileBrowser::partPasteProfile ()
} }
} }
#ifdef WIN32 #ifdef _WIN32
void FileBrowser::openDefaultViewer (int destination) void FileBrowser::openDefaultViewer (int destination)
{ {
bool success = true; bool success = true;
@ -1254,7 +1254,7 @@ bool FileBrowser::keyPressed (GdkEventKey* event)
} }
openRequested(mselected); openRequested(mselected);
#ifdef WIN32 #ifdef _WIN32
} else if (event->keyval == GDK_KEY_F5) { } else if (event->keyval == GDK_KEY_F5) {
int dest = 1; int dest = 1;

View File

@ -203,7 +203,7 @@ public:
void partPasteProfile (); void partPasteProfile ();
void openNextPreviousEditorImage(const Glib::ustring& fname, eRTNav eNextPrevious); void openNextPreviousEditorImage(const Glib::ustring& fname, eRTNav eNextPrevious);
#ifdef WIN32 #ifdef _WIN32
void openDefaultViewer (int destination); void openDefaultViewer (int destination);
#endif #endif

View File

@ -26,7 +26,7 @@
#include "placesbrowser.h" #include "placesbrowser.h"
#include "thumbnail.h" #include "thumbnail.h"
#ifdef WIN32 #ifdef _WIN32
#include "windows.h" #include "windows.h"
#endif #endif
@ -302,7 +302,7 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
if (options.tabbedUI) { if (options.tabbedUI) {
EditorPanel* epanel; EditorPanel* epanel;
{ {
#ifdef WIN32 #ifdef _WIN32
int winGdiHandles = GetGuiResources( GetCurrentProcess(), GR_GDIOBJECTS); int winGdiHandles = GetGuiResources( GetCurrentProcess(), GR_GDIOBJECTS);
if(winGdiHandles > 0 && winGdiHandles <= 6500) //(old settings 8500) 0 means we don't have the rights to access the function, 8500 because the limit is 10000 and we need about 1500 free handles if(winGdiHandles > 0 && winGdiHandles <= 6500) //(old settings 8500) 0 means we don't have the rights to access the function, 8500 because the limit is 10000 and we need about 1500 free handles
//J.Desmis october 2021 I change 8500 to 6500..Why ? because without while increasing size GUI system crash in multieditor //J.Desmis october 2021 I change 8500 to 6500..Why ? because without while increasing size GUI system crash in multieditor
@ -312,7 +312,7 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
epanel = Gtk::manage (new EditorPanel ()); epanel = Gtk::manage (new EditorPanel ());
parent->addEditorPanel (epanel, pl->thm->getFileName()); parent->addEditorPanel (epanel, pl->thm->getFileName());
} }
#ifdef WIN32 #ifdef _WIN32
else { else {
Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_CANNOTLOAD") + " \"" + escapeHtmlChars(thm->getFileName()) + "\" .\n" + M("MAIN_MSG_TOOMANYOPENEDITORS") + "</b>"; Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_CANNOTLOAD") + " \"" + escapeHtmlChars(thm->getFileName()) + "\" .\n" + M("MAIN_MSG_TOOMANYOPENEDITORS") + "</b>";
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
@ -339,7 +339,7 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run (); msgd.run ();
} }
#ifdef WIN32 #ifdef _WIN32
MAXGDIHANDLESREACHED: MAXGDIHANDLESREACHED:
#endif #endif
delete pl->pc; delete pl->pc;

View File

@ -467,7 +467,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, TOOL_NAME, M("TP_ICM_LABEL")), iu
ipDialog->add_filter(filter_icc); ipDialog->add_filter(filter_icc);
ipDialog->add_filter(filter_iccdng); ipDialog->add_filter(filter_iccdng);
ipDialog->add_filter(filter_any); ipDialog->add_filter(filter_any);
#ifdef WIN32 #ifdef _WIN32
ipDialog->set_show_hidden(true); // ProgramData is hidden on Windows ipDialog->set_show_hidden(true); // ProgramData is hidden on Windows
#endif #endif

View File

@ -129,7 +129,7 @@ LensProfilePanel::LensProfilePanel() :
const Glib::ustring defDir = LCPStore::getInstance()->getDefaultCommonDirectory(); const Glib::ustring defDir = LCPStore::getInstance()->getDefaultCommonDirectory();
if (!defDir.empty()) { if (!defDir.empty()) {
#ifdef WIN32 #ifdef _WIN32
corrLcpFileChooser->set_show_hidden(true); // ProgramData is hidden on Windows corrLcpFileChooser->set_show_hidden(true); // ProgramData is hidden on Windows
#endif #endif
corrLcpFileChooser->set_current_folder(defDir); corrLcpFileChooser->set_current_folder(defDir);

View File

@ -41,7 +41,7 @@
#include "extprog.h" #include "extprog.h"
#include "pathutils.h" #include "pathutils.h"
#ifndef WIN32 #ifndef _WIN32
#include <glibmm/fileutils.h> #include <glibmm/fileutils.h>
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
@ -96,7 +96,7 @@ int main (int argc, char **argv)
char exname[512] = {0}; char exname[512] = {0};
Glib::ustring exePath; Glib::ustring exePath;
// get the path where the rawtherapee executable is stored // get the path where the rawtherapee executable is stored
#ifdef WIN32 #ifdef _WIN32
WCHAR exnameU[512] = {0}; WCHAR exnameU[512] = {0};
GetModuleFileNameW (NULL, exnameU, 511); GetModuleFileNameW (NULL, exnameU, 511);
WideCharToMultiByte (CP_UTF8, 0, exnameU, -1, exname, 511, 0, 0 ); WideCharToMultiByte (CP_UTF8, 0, exnameU, -1, exname, 511, 0, 0 );
@ -182,7 +182,7 @@ int main (int argc, char **argv)
TIFFSetWarningHandler (nullptr); // avoid annoying message boxes TIFFSetWarningHandler (nullptr); // avoid annoying message boxes
#ifndef WIN32 #ifndef _WIN32
// Move the old path to the new one if the new does not exist // 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)) { 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)) {

View File

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

View File

@ -23,7 +23,7 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <giomm.h> #include <giomm.h>
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
@ -35,7 +35,7 @@ std::string getMD5 (const Glib::ustring& fname)
if (file && file->query_exists ()) { if (file && file->query_exists ()) {
#ifdef WIN32 #ifdef _WIN32
std::unique_ptr<wchar_t, GFreeFunc> wfname (reinterpret_cast<wchar_t*> (g_utf8_to_utf16 (fname.c_str (), -1, NULL, NULL, NULL)), g_free); std::unique_ptr<wchar_t, GFreeFunc> wfname (reinterpret_cast<wchar_t*> (g_utf8_to_utf16 (fname.c_str (), -1, NULL, NULL, NULL)), g_free);

View File

@ -22,7 +22,7 @@
#include <glib.h> #include <glib.h>
#include <iostream> #include <iostream>
#include <utility> #include <utility>
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <winnls.h> #include <winnls.h>
#endif #endif
@ -315,7 +315,7 @@ const TranslationMetadata *MultiLangMgr::getMetadata(const Glib::ustring &fname)
bool MultiLangMgr::isOSLanguageDetectSupported () bool MultiLangMgr::isOSLanguageDetectSupported ()
{ {
#if defined (WIN32) || defined (__linux__) || defined (__APPLE__) #if defined (_WIN32) || defined (__linux__) || defined (__APPLE__)
return true; return true;
#else #else
return false; return false;
@ -326,7 +326,7 @@ Glib::ustring MultiLangMgr::getOSUserLanguage ()
{ {
Glib::ustring langName ("default"); Glib::ustring langName ("default");
#if defined (WIN32) #if defined (_WIN32)
const LCID localeID = GetUserDefaultLCID (); const LCID localeID = GetUserDefaultLCID ();
TCHAR localeName[18]; TCHAR localeName[18];

View File

@ -157,7 +157,7 @@ Navigator::Navigator() :
/* /*
Glib::ustring fontname; Glib::ustring fontname;
#ifdef WIN32 #ifdef _WIN32
fontname = "Droid Sans Mono Slashed"; // font file is provided in the source tree in rtdata/fonts to be installed by the windows installer fontname = "Droid Sans Mono Slashed"; // font file is provided in the source tree in rtdata/fonts to be installed by the windows installer
#endif #endif

View File

@ -42,7 +42,7 @@
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
// for GCC32 // for GCC32
#ifndef _WIN32_IE #ifndef _WIN32_IE
@ -368,7 +368,7 @@ void Options::setDefaults()
fbShowDateTime = true; fbShowDateTime = true;
fbShowBasicExif = true; fbShowBasicExif = true;
fbShowExpComp = false; fbShowExpComp = false;
#ifdef WIN32 #ifdef _WIN32
// use windows setting for visibility of hidden files/folders // use windows setting for visibility of hidden files/folders
SHELLFLAGSTATE sft = { 0 }; SHELLFLAGSTATE sft = { 0 };
SHGetSettings(&sft, SSF_SHOWALLOBJECTS); SHGetSettings(&sft, SSF_SHOWALLOBJECTS);
@ -577,7 +577,7 @@ void Options::setDefaults()
rtSettings.cameraProfilesPath = ""; rtSettings.cameraProfilesPath = "";
rtSettings.lensProfilesPath = ""; rtSettings.lensProfilesPath = "";
#ifdef WIN32 #ifdef _WIN32
const gchar* sysRoot = g_getenv("SystemRoot"); // Returns e.g. "c:\Windows" const gchar* sysRoot = g_getenv("SystemRoot"); // Returns e.g. "c:\Windows"
if (sysRoot != NULL) { if (sysRoot != NULL) {
@ -933,7 +933,7 @@ void Options::readFromFile(Glib::ustring fname)
// GIMP == 1, Photoshop == 2, Custom == 3. // GIMP == 1, Photoshop == 2, Custom == 3.
editorToSendTo = keyFile.get_integer("External Editor", "EditorKind"); editorToSendTo = keyFile.get_integer("External Editor", "EditorKind");
#ifdef WIN32 #ifdef _WIN32
auto getIconSerialized = [](const Glib::ustring &executable) { auto getIconSerialized = [](const Glib::ustring &executable) {
// Backslashes and quotes must be escaped in the text representation of GVariant strings. // Backslashes and quotes must be escaped in the text representation of GVariant strings.
// See https://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/glib/gvariant-text.html#gvariant-text-strings // See https://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/glib/gvariant-text.html#gvariant-text-strings
@ -1228,7 +1228,7 @@ void Options::readFromFile(Glib::ustring fname)
fbShowExpComp = keyFile.get_boolean("File Browser", "BrowserShowsExpComp"); fbShowExpComp = keyFile.get_boolean("File Browser", "BrowserShowsExpComp");
} }
#ifndef WIN32 #ifndef _WIN32
if (keyFile.has_key("File Browser", "BrowserShowsHidden")) { if (keyFile.has_key("File Browser", "BrowserShowsHidden")) {
fbShowHidden = keyFile.get_boolean("File Browser", "BrowserShowsHidden"); fbShowHidden = keyFile.get_boolean("File Browser", "BrowserShowsHidden");
} }
@ -2399,7 +2399,7 @@ void Options::saveToFile(Glib::ustring fname)
keyFile.set_boolean("File Browser", "BrowserShowsDate", fbShowDateTime); keyFile.set_boolean("File Browser", "BrowserShowsDate", fbShowDateTime);
keyFile.set_boolean("File Browser", "BrowserShowsExif", fbShowBasicExif); keyFile.set_boolean("File Browser", "BrowserShowsExif", fbShowBasicExif);
keyFile.set_boolean("File Browser", "BrowserShowsExpComp", fbShowExpComp); keyFile.set_boolean("File Browser", "BrowserShowsExpComp", fbShowExpComp);
#ifndef WIN32 #ifndef _WIN32
keyFile.set_boolean("File Browser", "BrowserShowsHidden", fbShowHidden); keyFile.set_boolean("File Browser", "BrowserShowsHidden", fbShowHidden);
#endif #endif
keyFile.set_integer("File Browser", "ThumbnailSize", thumbSize); keyFile.set_integer("File Browser", "ThumbnailSize", thumbSize);
@ -2788,7 +2788,7 @@ void Options::load(bool lightweight)
} }
} else { } else {
#ifdef WIN32 #ifdef _WIN32
WCHAR pathW[MAX_PATH] = {0}; WCHAR pathW[MAX_PATH] = {0};
if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_LOCAL_APPDATA, false)) { if (SHGetSpecialFolderPathW(NULL, pathW, CSIDL_LOCAL_APPDATA, false)) {
@ -2838,7 +2838,7 @@ void Options::load(bool lightweight)
// No environment variable provided, so falling back to the multi user mode, if enabled // No environment variable provided, so falling back to the multi user mode, if enabled
else if (options.multiUser) { else if (options.multiUser) {
#ifdef WIN32 #ifdef _WIN32
cacheBaseDir = Glib::build_filename(rtdir, "cache"); cacheBaseDir = Glib::build_filename(rtdir, "cache");
#else #else
#ifdef __APPLE__ #ifdef __APPLE__

View File

@ -40,7 +40,7 @@
#define THEMEREGEXSTR "^(.+)-GTK3-(\\d{1,2})?_(\\d{1,2})?\\.css$" #define THEMEREGEXSTR "^(.+)-GTK3-(\\d{1,2})?_(\\d{1,2})?\\.css$"
// Default bundled profile name to use for Raw images // Default bundled profile name to use for Raw images
#ifdef WIN32 #ifdef _WIN32
#define DEFPROFILE_RAW "${G}\\Auto-Matched Curve - ISO Low" #define DEFPROFILE_RAW "${G}\\Auto-Matched Curve - ISO Low"
#else #else
#define DEFPROFILE_RAW "${G}/Auto-Matched Curve - ISO Low" #define DEFPROFILE_RAW "${G}/Auto-Matched Curve - ISO Low"

View File

@ -55,7 +55,7 @@ Glib::ustring getExtension (const Glib::ustring& filename)
// so we're using Glib::filename_to_utf8 for Linux/Apple and Glib::locale_to_utf8 for Windows. // so we're using Glib::filename_to_utf8 for Linux/Apple and Glib::locale_to_utf8 for Windows.
Glib::ustring fname_to_utf8(const std::string &fname) Glib::ustring fname_to_utf8(const std::string &fname)
{ {
#ifdef WIN32 #ifdef _WIN32
try { try {
return Glib::locale_to_utf8(fname); return Glib::locale_to_utf8(fname);

View File

@ -18,7 +18,7 @@
*/ */
#include "placesbrowser.h" #include "placesbrowser.h"
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
#include <Shlwapi.h> #include <Shlwapi.h>
@ -231,7 +231,7 @@ void PlacesBrowser::refreshPlacesList ()
// (Drives in Windows) // (Drives in Windows)
std::vector<Glib::RefPtr<Gio::Mount> > mounts = vm->get_mounts (); std::vector<Glib::RefPtr<Gio::Mount> > mounts = vm->get_mounts ();
#ifdef WIN32 #ifdef _WIN32
// on Windows, it's usual to sort by drive letter, not by name // on Windows, it's usual to sort by drive letter, not by name
std::sort (mounts.begin(), mounts.end(), compareMountByRoot); std::sort (mounts.begin(), mounts.end(), compareMountByRoot);
#endif #endif
@ -353,7 +353,7 @@ void PlacesBrowser::delPressed ()
Glib::ustring PlacesBrowser::userHomeDir () Glib::ustring PlacesBrowser::userHomeDir ()
{ {
#ifdef WIN32 #ifdef _WIN32
// get_home_dir crashes on some Windows configurations, // get_home_dir crashes on some Windows configurations,
// so we rather use the safe native functions here. // so we rather use the safe native functions here.
@ -378,7 +378,7 @@ Glib::ustring PlacesBrowser::userHomeDir ()
Glib::ustring PlacesBrowser::userPicturesDir () Glib::ustring PlacesBrowser::userPicturesDir ()
{ {
#ifdef WIN32 #ifdef _WIN32
// get_user_special_dir crashes on some Windows configurations, // get_user_special_dir crashes on some Windows configurations,
// so we rather use the safe native functions here. // so we rather use the safe native functions here.

View File

@ -119,7 +119,7 @@ Preferences::Preferences(RTWindow *rtwindow)
nb->append_page(*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING")); nb->append_page(*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING"));
nb->append_page(*getPerformancePanel(), M("PREFERENCES_TAB_PERFORMANCE")); nb->append_page(*getPerformancePanel(), M("PREFERENCES_TAB_PERFORMANCE"));
// Sounds only on Windows and Linux // Sounds only on Windows and Linux
#if defined(WIN32) || defined(__linux__) #if defined(_WIN32) || defined(__linux__)
nb->append_page(*getSoundsPanel(), M("PREFERENCES_TAB_SOUND")); nb->append_page(*getSoundsPanel(), M("PREFERENCES_TAB_SOUND"));
#endif #endif
nb->set_current_page(0); nb->set_current_page(0);
@ -1985,7 +1985,7 @@ void Preferences::storePreferences()
moptions.rtSettings.thumbnail_inspector_mode = static_cast<rtengine::Settings::ThumbnailInspectorMode>(thumbnailInspectorMode->get_active_row_number()); moptions.rtSettings.thumbnail_inspector_mode = static_cast<rtengine::Settings::ThumbnailInspectorMode>(thumbnailInspectorMode->get_active_row_number());
// Sounds only on Windows and Linux // Sounds only on Windows and Linux
#if defined(WIN32) || defined(__linux__) #if defined(_WIN32) || defined(__linux__)
moptions.sndEnable = ckbSndEnable->get_active(); moptions.sndEnable = ckbSndEnable->get_active();
moptions.sndBatchQueueDone = txtSndBatchQueueDone->get_text(); moptions.sndBatchQueueDone = txtSndBatchQueueDone->get_text();
moptions.sndLngEditProcDone = txtSndLngEditProcDone->get_text(); moptions.sndLngEditProcDone = txtSndLngEditProcDone->get_text();
@ -2244,7 +2244,7 @@ void Preferences::fillPreferences()
chOverwriteOutputFile->set_active(moptions.overwriteOutputFile); chOverwriteOutputFile->set_active(moptions.overwriteOutputFile);
// Sounds only on Windows and Linux // Sounds only on Windows and Linux
#if defined(WIN32) || defined(__linux__) #if defined(_WIN32) || defined(__linux__)
ckbSndEnable->set_active(moptions.sndEnable); ckbSndEnable->set_active(moptions.sndEnable);
txtSndBatchQueueDone->set_text(moptions.sndBatchQueueDone); txtSndBatchQueueDone->set_text(moptions.sndBatchQueueDone);
txtSndLngEditProcDone->set_text(moptions.sndLngEditProcDone); txtSndLngEditProcDone->set_text(moptions.sndLngEditProcDone);

View File

@ -18,7 +18,7 @@
*/ */
#include "rtappchooserdialog.h" #include "rtappchooserdialog.h"
#if !(defined WIN32 || defined __APPLE__) #if !(defined _WIN32 || defined __APPLE__)
#define GTKMM_APPCHOOSERDIALOG #define GTKMM_APPCHOOSERDIALOG
#endif #endif

View File

@ -243,7 +243,7 @@ RTWindow::RTWindow ()
MyExpander::init(); MyExpander::init();
FileBrowserEntry::init(); FileBrowserEntry::init();
#ifndef WIN32 #ifndef _WIN32
const std::vector<Glib::RefPtr<Gdk::Pixbuf>> appIcons = { const std::vector<Glib::RefPtr<Gdk::Pixbuf>> appIcons = {
RTImage::createPixbufFromFile("rawtherapee-logo-16.png"), RTImage::createPixbufFromFile("rawtherapee-logo-16.png"),
RTImage::createPixbufFromFile("rawtherapee-logo-24.png"), RTImage::createPixbufFromFile("rawtherapee-logo-24.png"),

View File

@ -21,7 +21,7 @@
#include "soundman.h" #include "soundman.h"
#include "options.h" #include "options.h"
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#endif #endif
@ -33,7 +33,7 @@
void SoundManager::init() void SoundManager::init()
{ {
#ifdef WIN32 #ifdef _WIN32
// TODO: On Windows Vista/7 RT should register with the OS sound system, so it can enjoy application specific // TODO: On Windows Vista/7 RT should register with the OS sound system, so it can enjoy application specific
// volume, safed, process independent etc. from the start. // volume, safed, process independent etc. from the start.
// Function call is IAudioClient::Initialize // Function call is IAudioClient::Initialize
@ -53,7 +53,7 @@ void SoundManager::playSoundAsync(const Glib::ustring &sound)
return; return;
} }
#ifdef WIN32 #ifdef _WIN32
DWORD sndParam = SND_ASYNC | SND_NODEFAULT; DWORD sndParam = SND_ASYNC | SND_NODEFAULT;
if (sound.find('.') != Glib::ustring::npos) { if (sound.find('.') != Glib::ustring::npos) {

View File

@ -21,7 +21,7 @@
#include <csignal> #include <csignal>
#include <iostream> #include <iostream>
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
@ -34,7 +34,7 @@ void MyMutex::checkLock ()
if (locked) { if (locked) {
std::cerr << "MyMutex already locked!" << std::endl; std::cerr << "MyMutex already locked!" << std::endl;
#ifdef WIN32 #ifdef _WIN32
DebugBreak (); DebugBreak ();
#else #else
raise (SIGTRAP); raise (SIGTRAP);
@ -49,7 +49,7 @@ void MyMutex::checkUnlock ()
if (!locked) { if (!locked) {
std::cerr << "MyMutex already unlocked!" << std::endl; std::cerr << "MyMutex already unlocked!" << std::endl;
#ifdef WIN32 #ifdef _WIN32
DebugBreak (); DebugBreak ();
#else #else
raise (SIGTRAP); raise (SIGTRAP);

View File

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifdef WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
@ -1142,7 +1142,7 @@ void Thumbnail::removeThumbnailListener (ThumbnailListener* tnl)
bool Thumbnail::openDefaultViewer(int destination) bool Thumbnail::openDefaultViewer(int destination)
{ {
#ifdef WIN32 #ifdef _WIN32
Glib::ustring openFName; Glib::ustring openFName;
if (destination == 1) { if (destination == 1) {