*: check defined(_WIN32) instead of defined(WIN32)

Only _WIN32 is defined by the compiler, and WIN32 is not standardized
and may be missing.

Closes #169
This commit is contained in:
Max Kellermann
2017-12-12 10:22:20 +01:00
parent d9552d8a6d
commit dfaf08743c
91 changed files with 226 additions and 225 deletions

View File

@@ -26,7 +26,7 @@
#include "Path.hxx"
#ifdef WIN32
#ifdef _WIN32
#include <fileapi.h>
#endif
@@ -43,7 +43,7 @@ class AllocatedPath;
static inline FILE *
FOpen(Path file, PathTraitsFS::const_pointer_type mode)
{
#ifdef WIN32
#ifdef _WIN32
return _tfopen(file.c_str(), mode);
#else
return fopen(file.c_str(), mode);
@@ -56,7 +56,7 @@ FOpen(Path file, PathTraitsFS::const_pointer_type mode)
static inline int
OpenFile(Path file, int flags, int mode)
{
#ifdef WIN32
#ifdef _WIN32
return _topen(file.c_str(), flags, mode);
#else
return open_cloexec(file.c_str(), flags, mode);
@@ -71,7 +71,7 @@ OpenFile(Path file, int flags, int mode)
void
RenameFile(Path oldpath, Path newpath);
#ifndef WIN32
#ifndef _WIN32
/**
* Wrapper for stat() that uses #Path names.
@@ -107,7 +107,7 @@ RemoveFile(Path path);
AllocatedPath
ReadLink(Path path);
#ifndef WIN32
#ifndef _WIN32
static inline bool
MakeFifo(Path path, mode_t mode)
@@ -132,7 +132,7 @@ CheckAccess(Path path, int mode)
static inline bool
FileExists(Path path, bool follow_symlinks = true)
{
#ifdef WIN32
#ifdef _WIN32
(void)follow_symlinks;
const auto a = GetFileAttributes(path.c_str());
@@ -150,7 +150,7 @@ FileExists(Path path, bool follow_symlinks = true)
static inline bool
DirectoryExists(Path path, bool follow_symlinks = true)
{
#ifdef WIN32
#ifdef _WIN32
(void)follow_symlinks;
const auto a = GetFileAttributes(path.c_str());
@@ -167,7 +167,7 @@ DirectoryExists(Path path, bool follow_symlinks = true)
static inline bool
PathExists(Path path)
{
#ifdef WIN32
#ifdef _WIN32
return GetFileAttributes(path.c_str()) != INVALID_FILE_ATTRIBUTES;
#else
return CheckAccess(path, F_OK);