*: 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

@@ -25,14 +25,14 @@
#include "fs/AllocatedPath.hxx"
#include "Compiler.h"
#ifndef WIN32
#ifndef _WIN32
#include "system/FileDescriptor.hxx"
#endif
#include <assert.h>
#include <stdint.h>
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#endif
@@ -41,7 +41,7 @@ class Path;
class FileOutputStream final : public OutputStream {
const AllocatedPath path;
#ifdef WIN32
#ifdef _WIN32
HANDLE handle = INVALID_HANDLE_VALUE;
#else
FileDescriptor fd = FileDescriptor::Undefined();
@@ -116,7 +116,7 @@ private:
bool Close() {
assert(IsDefined());
#ifdef WIN32
#ifdef _WIN32
CloseHandle(handle);
handle = INVALID_HANDLE_VALUE;
return true;
@@ -125,7 +125,7 @@ private:
#endif
}
#ifdef WIN32
#ifdef _WIN32
bool SeekEOF() {
return SetFilePointer(handle, 0, nullptr,
FILE_END) != 0xffffffff;
@@ -133,7 +133,7 @@ private:
#endif
bool IsDefined() const {
#ifdef WIN32
#ifdef _WIN32
return handle != INVALID_HANDLE_VALUE;
#else
return fd.IsDefined();