]> git.tdb.fi Git - libs/core.git/commitdiff
Use #ifdef _WIN32 rather than WIN32
authorMikko Rasa <tdb@tdb.fi>
Tue, 14 Jun 2016 05:04:42 +0000 (08:04 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 14 Jun 2016 05:06:57 +0000 (08:06 +0300)
It is the proper compiler-defined macro to use.  WIN32 is defined by SDK
headers and may not appear in all cases.

source/debug/backtrace.cpp
source/fs/dir.cpp
source/fs/path.cpp
source/fs/path.h
source/fs/stat_private.h
source/io/file.cpp
source/io/poll.cpp

index 1fda155e9665d497f629cb575ea93a33b12a7d3b..f9057dce833d95b9231917bd763a489f7a856fb1 100644 (file)
@@ -1,6 +1,6 @@
 // Must include something to test for glibc
 #include <cstdlib>
 // Must include something to test for glibc
 #include <cstdlib>
-#if !defined(WIN32) && defined(__GLIBC__)
+#if !defined(_WIN32) && defined(__GLIBC__)
 #include <dlfcn.h>
 #include <execinfo.h>
 #endif
 #include <dlfcn.h>
 #include <execinfo.h>
 #endif
@@ -14,7 +14,7 @@ namespace Debug {
 
 Backtrace Backtrace::create()
 {
 
 Backtrace Backtrace::create()
 {
-#if !defined(WIN32) && defined(__GLIBC__)
+#if !defined(_WIN32) && defined(__GLIBC__)
        void *addresses[50];
        int count = ::backtrace(addresses, 50);
 
        void *addresses[50];
        int count = ::backtrace(addresses, 50);
 
index 9c6a97a8318ceaccb77c2d708f7ae65a45f3d951..717c11c132d7e4fe6e99995827e4918d443062fb 100644 (file)
@@ -20,7 +20,7 @@ namespace
 
 enum
 {
 
 enum
 {
-#ifdef WIN32
+#ifdef _WIN32
        ITEMSEP = ';'
 #else
        ITEMSEP = ':'
        ITEMSEP = ';'
 #else
        ITEMSEP = ':'
@@ -73,7 +73,7 @@ void mkpath(const Path &path, int mode)
        for(Path::Iterator i=path.begin(); i!=path.end(); ++i)
        {
                p /= *i;
        for(Path::Iterator i=path.begin(); i!=path.end(); ++i)
        {
                p /= *i;
-#ifdef WIN32
+#ifdef _WIN32
                if(p.size()==1 && p.is_absolute())
                        continue;
 #endif
                if(p.size()==1 && p.is_absolute())
                        continue;
 #endif
index 0fe95d65df943a9f0b4b1b4bf006035a4e7dccee..d68595bb55ee83588ce9ae7a535c9424cbbaabef 100644 (file)
@@ -7,7 +7,7 @@ using namespace std;
 
 namespace {
 
 
 namespace {
 
-#ifdef WIN32
+#ifdef _WIN32
 inline bool is_windows_drive(const std::string &p)
 { return (p.size()==2 && ((p[0]>='A' && p[0]<='Z') || (p[0]>='a' && p[0]<='z')) && p[1]==':'); }
 #endif
 inline bool is_windows_drive(const std::string &p)
 { return (p.size()==2 && ((p[0]>='A' && p[0]<='Z') || (p[0]>='a' && p[0]<='z')) && p[1]==':'); }
 #endif
@@ -58,7 +58,7 @@ unsigned Path::size() const
 
 bool Path::is_absolute() const
 {
 
 bool Path::is_absolute() const
 {
-#ifdef WIN32
+#ifdef _WIN32
        if(is_windows_drive((*this)[0]))
                return true;
 #endif
        if(is_windows_drive((*this)[0]))
                return true;
 #endif
@@ -103,7 +103,7 @@ void Path::add_component(const string &comp)
        if(comp.size()==1 && (comp[0]=='/' || comp[0]=='\\'))
        {
                // Replace the path with the root directory
        if(comp.size()==1 && (comp[0]=='/' || comp[0]=='\\'))
        {
                // Replace the path with the root directory
-#ifdef WIN32
+#ifdef _WIN32
                string::size_type slash = (separators.empty() ? string::npos : separators.front());
                if(is_windows_drive(path.substr(0, slash)))
                {
                string::size_type slash = (separators.empty() ? string::npos : separators.front());
                if(is_windows_drive(path.substr(0, slash)))
                {
@@ -118,7 +118,7 @@ void Path::add_component(const string &comp)
                        separators.push_back(0);
                }
        }
                        separators.push_back(0);
                }
        }
-#ifdef WIN32
+#ifdef _WIN32
        else if(is_windows_drive(comp))
        {
                path = comp;
        else if(is_windows_drive(comp))
        {
                path = comp;
@@ -132,7 +132,7 @@ void Path::add_component(const string &comp)
                // .. in root directory is a no-op
                else if(path.size()==1 && path[0]==DIRSEP)
                        ;
                // .. in root directory is a no-op
                else if(path.size()==1 && path[0]==DIRSEP)
                        ;
-#ifdef WIN32
+#ifdef _WIN32
                else if(is_windows_drive(path))
                        ;
 #endif
                else if(is_windows_drive(path))
                        ;
 #endif
@@ -192,7 +192,7 @@ string Path::operator[](int n) const
 
 bool Path::operator==(const Path &other) const
 {
 
 bool Path::operator==(const Path &other) const
 {
-#ifdef WIN32
+#ifdef _WIN32
        return strcasecmp(path, other.path)==0;
 #else
        return path==other.path;
        return strcasecmp(path, other.path)==0;
 #else
        return path==other.path;
@@ -201,7 +201,7 @@ bool Path::operator==(const Path &other) const
 
 bool Path::operator<(const Path &other) const
 {
 
 bool Path::operator<(const Path &other) const
 {
-#ifdef WIN32
+#ifdef _WIN32
        return strcasecmp(path, other.path)<0;
 #else
        return path<other.path;
        return strcasecmp(path, other.path)<0;
 #else
        return path<other.path;
@@ -210,7 +210,7 @@ bool Path::operator<(const Path &other) const
 
 bool Path::operator>(const Path &other) const
 {
 
 bool Path::operator>(const Path &other) const
 {
-#ifdef WIN32
+#ifdef _WIN32
        return strcasecmp(path, other.path)>0;
 #else
        return path>other.path;
        return strcasecmp(path, other.path)>0;
 #else
        return path>other.path;
index 3cbfb16cf6e4052c57d223cd1fafd96b377b1c98..82600dc35c28d5787f69b56f0af3b8b12af50f22 100644 (file)
@@ -10,7 +10,7 @@ namespace FS {
 
 enum
 {
 
 enum
 {
-#ifdef WIN32
+#ifdef _WIN32
        DIRSEP = '\\'
 #else
        DIRSEP = '/'
        DIRSEP = '\\'
 #else
        DIRSEP = '/'
index c80d15119b1e2ffb1e6a0a5ebb27486ec8963031..7b20638d36ed5b5a1e75d2f14ce9fb102dfc44c0 100644 (file)
@@ -15,7 +15,7 @@ struct Stat::Private
        Private(const Private &);
        ~Private();
 
        Private(const Private &);
        ~Private();
 
-#ifndef WIN32
+#ifndef _WIN32
        /* This is here because it needs access to private members of Stat, but we
        can't expose the system stat struct in the public header */
        static Stat from_struct_stat(const struct stat &);
        /* This is here because it needs access to private members of Stat, but we
        can't expose the system stat struct in the public header */
        static Stat from_struct_stat(const struct stat &);
index 666b1edc784b9fc9d0bc76cf29d77b82ff80b826..1b4a73884d7b5891a43c461d79901bd7e9d1a147 100644 (file)
@@ -39,7 +39,7 @@ unsigned File::do_write(const char *buf, unsigned size)
        if(size==0)
                return 0;
 
        if(size==0)
                return 0;
 
-#ifdef WIN32
+#ifdef _WIN32
        if(mode&M_APPEND)
                seek(0, S_END);
 #endif
        if(mode&M_APPEND)
                seek(0, S_END);
 #endif
index 0356a00fdbe27ffe957f340fb25d82b5cf1d2c7a..6da777cf4470778f4e6401dbcc39f1a3a539b4e7 100644 (file)
@@ -36,7 +36,7 @@ void Poller::set_object(EventObject &obj, PollEvent ev)
        }
        else if(ev)
        {
        }
        else if(ev)
        {
-#ifdef WIN32
+#ifdef _WIN32
                if(objects.size()>=MAXIMUM_WAIT_OBJECTS)
                        throw logic_error("Maximum number of wait objects reached");
 #endif
                if(objects.size()>=MAXIMUM_WAIT_OBJECTS)
                        throw logic_error("Maximum number of wait objects reached");
 #endif