summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-16 20:50:53 +0100
committerMax Kellermann <max@musicpd.org>2017-12-16 20:56:06 +0100
commit6246d36fe6503e6bed3bca6aa5ca783c6188d76f (patch)
tree51521bbb43bc2bbbc34a14c393a0f65880aabbbc /src/fs
parentfbc4bb29dcc471a08e47f10ffaa24ad8da6d40a2 (diff)
parentf1ef9f9d31c71857db021029326715028a217906 (diff)
Merge branch 'v0.20.x'
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/AllocatedPath.cxx4
-rw-r--r--src/fs/Charset.cxx10
-rw-r--r--src/fs/Charset.hxx2
-rw-r--r--src/fs/CheckFile.cxx2
-rw-r--r--src/fs/DirectoryReader.cxx2
-rw-r--r--src/fs/DirectoryReader.hxx2
-rw-r--r--src/fs/FileInfo.hxx20
-rw-r--r--src/fs/FileSystem.cxx8
-rw-r--r--src/fs/FileSystem.hxx14
-rw-r--r--src/fs/Glob.hxx8
-rw-r--r--src/fs/Limits.hxx2
-rw-r--r--src/fs/StandardDirectory.cxx14
-rw-r--r--src/fs/StandardDirectory.hxx2
-rw-r--r--src/fs/Traits.cxx2
-rw-r--r--src/fs/Traits.hxx20
-rw-r--r--src/fs/io/FileOutputStream.cxx4
-rw-r--r--src/fs/io/FileOutputStream.hxx12
-rw-r--r--src/fs/io/FileReader.cxx2
-rw-r--r--src/fs/io/FileReader.hxx16
19 files changed, 73 insertions, 73 deletions
diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx
index fd5e54bf4..0bf2ba4ad 100644
--- a/src/fs/AllocatedPath.cxx
+++ b/src/fs/AllocatedPath.cxx
@@ -31,7 +31,7 @@ AllocatedPath::~AllocatedPath() {}
AllocatedPath
AllocatedPath::FromUTF8(const char *path_utf8) noexcept
{
-#if defined(HAVE_FS_CHARSET) || defined(WIN32)
+#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
try {
return AllocatedPath(::PathFromUTF8(path_utf8));
} catch (const std::runtime_error &) {
@@ -45,7 +45,7 @@ AllocatedPath::FromUTF8(const char *path_utf8) noexcept
AllocatedPath
AllocatedPath::FromUTF8Throw(const char *path_utf8)
{
-#if defined(HAVE_FS_CHARSET) || defined(WIN32)
+#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
return AllocatedPath(::PathFromUTF8(path_utf8));
#else
return FromFS(path_utf8);
diff --git a/src/fs/Charset.cxx b/src/fs/Charset.cxx
index 1b84063fa..a2db26546 100644
--- a/src/fs/Charset.cxx
+++ b/src/fs/Charset.cxx
@@ -24,7 +24,7 @@
#include "lib/icu/Converter.hxx"
#include "util/AllocatedString.hxx"
-#ifdef WIN32
+#ifdef _WIN32
#include "lib/icu/Win32.hxx"
#include <windows.h>
#endif
@@ -70,7 +70,7 @@ GetFSCharset() noexcept
{
#ifdef HAVE_FS_CHARSET
return fs_charset.empty() ? "UTF-8" : fs_charset.c_str();
-#elif defined(WIN32)
+#elif defined(_WIN32)
return "ACP";
#else
return "UTF-8";
@@ -100,7 +100,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
assert(path_fs != nullptr);
#endif
-#ifdef WIN32
+#ifdef _WIN32
const auto buffer = WideCharToMultiByte(CP_UTF8, path_fs);
return FixSeparators(PathTraitsUTF8::string(buffer.c_str()));
#else
@@ -116,7 +116,7 @@ PathToUTF8(PathTraitsFS::const_pointer_type path_fs)
#endif
}
-#if defined(HAVE_FS_CHARSET) || defined(WIN32)
+#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
PathTraitsFS::string
PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
@@ -126,7 +126,7 @@ PathFromUTF8(PathTraitsUTF8::const_pointer_type path_utf8)
assert(path_utf8 != nullptr);
#endif
-#ifdef WIN32
+#ifdef _WIN32
const auto buffer = MultiByteToWideChar(CP_UTF8, path_utf8);
return PathTraitsFS::string(buffer.c_str());
#else
diff --git a/src/fs/Charset.hxx b/src/fs/Charset.hxx
index 7f7097b95..de6cc22d0 100644
--- a/src/fs/Charset.hxx
+++ b/src/fs/Charset.hxx
@@ -24,7 +24,7 @@
#include "Compiler.h"
#include "Traits.hxx"
-#if (defined(HAVE_ICU) || defined(HAVE_ICONV)) && !defined(WIN32)
+#if (defined(HAVE_ICU) || defined(HAVE_ICONV)) && !defined(_WIN32)
#define HAVE_FS_CHARSET
#endif
diff --git a/src/fs/CheckFile.cxx b/src/fs/CheckFile.cxx
index da875f1fc..fa4ac0ead 100644
--- a/src/fs/CheckFile.cxx
+++ b/src/fs/CheckFile.cxx
@@ -41,7 +41,7 @@ try {
return;
}
-#ifndef WIN32
+#ifndef _WIN32
try {
const auto x = AllocatedPath::Build(path_fs,
PathTraitsFS::CURRENT_DIRECTORY);
diff --git a/src/fs/DirectoryReader.cxx b/src/fs/DirectoryReader.cxx
index 15e50daf4..acec65051 100644
--- a/src/fs/DirectoryReader.cxx
+++ b/src/fs/DirectoryReader.cxx
@@ -21,7 +21,7 @@
#include "DirectoryReader.hxx"
#include "system/Error.hxx"
-#ifdef WIN32
+#ifdef _WIN32
DirectoryReader::DirectoryReader(Path dir)
:handle(FindFirstFile(MakeWildcardPath(dir.c_str()), &data))
diff --git a/src/fs/DirectoryReader.hxx b/src/fs/DirectoryReader.hxx
index 8795f6d13..9c57fc441 100644
--- a/src/fs/DirectoryReader.hxx
+++ b/src/fs/DirectoryReader.hxx
@@ -23,7 +23,7 @@
#include "check.h"
#include "Path.hxx"
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
diff --git a/src/fs/FileInfo.hxx b/src/fs/FileInfo.hxx
index dd8f6be1a..249ce0368 100644
--- a/src/fs/FileInfo.hxx
+++ b/src/fs/FileInfo.hxx
@@ -24,7 +24,7 @@
#include "Path.hxx"
#include "system/Error.hxx"
-#ifdef WIN32
+#ifdef _WIN32
#include <fileapi.h>
#else
#include <sys/stat.h>
@@ -34,7 +34,7 @@
#include <stdint.h>
-#ifdef WIN32
+#ifdef _WIN32
static inline constexpr uint64_t
ConstructUint64(DWORD lo, DWORD hi)
@@ -63,7 +63,7 @@ class FileInfo {
bool follow_symlinks);
friend class FileReader;
-#ifdef WIN32
+#ifdef _WIN32
WIN32_FILE_ATTRIBUTE_DATA data;
#else
struct stat st;
@@ -74,7 +74,7 @@ public:
FileInfo(Path path, bool follow_symlinks=true) {
if (!GetFileInfo(path, *this, follow_symlinks)) {
-#ifdef WIN32
+#ifdef _WIN32
throw FormatLastError("Failed to access %s",
path.ToUTF8().c_str());
#else
@@ -85,7 +85,7 @@ public:
}
bool IsRegular() const {
-#ifdef WIN32
+#ifdef _WIN32
return (data.dwFileAttributes &
(FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)) == 0;
#else
@@ -94,7 +94,7 @@ public:
}
bool IsDirectory() const {
-#ifdef WIN32
+#ifdef _WIN32
return data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
#else
return S_ISDIR(st.st_mode);
@@ -102,7 +102,7 @@ public:
}
uint64_t GetSize() const {
-#ifdef WIN32
+#ifdef _WIN32
return ConstructUint64(data.nFileSizeLow, data.nFileSizeHigh);
#else
return st.st_size;
@@ -110,14 +110,14 @@ public:
}
std::chrono::system_clock::time_point GetModificationTime() const {
-#ifdef WIN32
+#ifdef _WIN32
return FileTimeToChrono(data.ftLastWriteTime);
#else
return std::chrono::system_clock::from_time_t(st.st_mtime);
#endif
}
-#ifndef WIN32
+#ifndef _WIN32
uid_t GetUid() const {
return st.st_uid;
}
@@ -139,7 +139,7 @@ public:
inline bool
GetFileInfo(Path path, FileInfo &info, bool follow_symlinks=true)
{
-#ifdef WIN32
+#ifdef _WIN32
(void)follow_symlinks;
return GetFileAttributesEx(path.c_str(), GetFileExInfoStandard,
&info.data);
diff --git a/src/fs/FileSystem.cxx b/src/fs/FileSystem.cxx
index cf90bf4cb..54543d2c7 100644
--- a/src/fs/FileSystem.cxx
+++ b/src/fs/FileSystem.cxx
@@ -29,7 +29,7 @@
void
RenameFile(Path oldpath, Path newpath)
{
-#ifdef WIN32
+#ifdef _WIN32
if (!MoveFileEx(oldpath.c_str(), newpath.c_str(),
MOVEFILE_REPLACE_EXISTING))
throw MakeLastError("Failed to rename file");
@@ -42,7 +42,7 @@ RenameFile(Path oldpath, Path newpath)
AllocatedPath
ReadLink(Path path)
{
-#ifdef WIN32
+#ifdef _WIN32
(void)path;
errno = EINVAL;
return AllocatedPath::Null();
@@ -63,7 +63,7 @@ ReadLink(Path path)
void
TruncateFile(Path path)
{
-#ifdef WIN32
+#ifdef _WIN32
HANDLE h = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr,
TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL,
nullptr);
@@ -81,7 +81,7 @@ TruncateFile(Path path)
void
RemoveFile(Path path)
{
-#ifdef WIN32
+#ifdef _WIN32
if (!DeleteFile(path.c_str()))
throw FormatLastError("Failed to delete %s", path.c_str());
#else
diff --git a/src/fs/FileSystem.hxx b/src/fs/FileSystem.hxx
index 913c3592b..6d7318a43 100644
--- a/src/fs/FileSystem.hxx
+++ b/src/fs/FileSystem.hxx
@@ -25,7 +25,7 @@
#include "Path.hxx"
#include "system/UniqueFileDescriptor.hxx"
-#ifdef WIN32
+#ifdef _WIN32
#include <fileapi.h>
#endif
@@ -42,7 +42,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);
@@ -68,7 +68,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.
@@ -104,7 +104,7 @@ RemoveFile(Path path);
AllocatedPath
ReadLink(Path path);
-#ifndef WIN32
+#ifndef _WIN32
static inline bool
MakeFifo(Path path, mode_t mode)
@@ -129,7 +129,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());
@@ -147,7 +147,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());
@@ -164,7 +164,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);
diff --git a/src/fs/Glob.hxx b/src/fs/Glob.hxx
index 1f8402089..b15972f0d 100644
--- a/src/fs/Glob.hxx
+++ b/src/fs/Glob.hxx
@@ -26,7 +26,7 @@
#define HAVE_CLASS_GLOB
#include <string>
#include <fnmatch.h>
-#elif defined(WIN32)
+#elif defined(_WIN32)
#define HAVE_CLASS_GLOB
#include <string>
#include <shlwapi.h>
@@ -40,12 +40,12 @@
* (asterisk and question mark).
*/
class Glob {
-#if defined(HAVE_FNMATCH) || defined(WIN32)
+#if defined(HAVE_FNMATCH) || defined(_WIN32)
std::string pattern;
#endif
public:
-#if defined(HAVE_FNMATCH) || defined(WIN32)
+#if defined(HAVE_FNMATCH) || defined(_WIN32)
explicit Glob(const char *_pattern)
:pattern(_pattern) {}
@@ -57,7 +57,7 @@ public:
bool Check(const char *name_fs) const noexcept {
#ifdef HAVE_FNMATCH
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
-#elif defined(WIN32)
+#elif defined(_WIN32)
return PathMatchSpecA(name_fs, pattern.c_str());
#endif
}
diff --git a/src/fs/Limits.hxx b/src/fs/Limits.hxx
index c9ce51ed2..5a646c63f 100644
--- a/src/fs/Limits.hxx
+++ b/src/fs/Limits.hxx
@@ -25,7 +25,7 @@
#include <stddef.h>
#include <limits.h>
-#if defined(WIN32)
+#if defined(_WIN32)
static constexpr size_t MPD_PATH_MAX = 260;
#elif defined(MAXPATHLEN)
static constexpr size_t MPD_PATH_MAX = MAXPATHLEN;
diff --git a/src/fs/StandardDirectory.cxx b/src/fs/StandardDirectory.cxx
index 41b5fee7a..a74fc5fcb 100644
--- a/src/fs/StandardDirectory.cxx
+++ b/src/fs/StandardDirectory.cxx
@@ -20,7 +20,7 @@
#include "config.h"
// Use X Desktop guidelines where applicable
-#if !defined(__APPLE__) && !defined(WIN32) && !defined(ANDROID)
+#if !defined(__APPLE__) && !defined(_WIN32) && !defined(ANDROID)
#define USE_XDG
#endif
@@ -29,7 +29,7 @@
#include <array>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#include <shlobj.h>
#else
@@ -53,7 +53,7 @@
#include "Main.hxx"
#endif
-#if !defined(WIN32) && !defined(ANDROID)
+#if !defined(_WIN32) && !defined(ANDROID)
class PasswdEntry
{
#if defined(HAVE_GETPWNAM_R) || defined(HAVE_GETPWUID_R)
@@ -113,7 +113,7 @@ SafePathFromFS(PathTraitsFS::const_pointer_type dir)
}
#endif
-#ifdef WIN32
+#ifdef _WIN32
static AllocatedPath GetStandardDir(int folder_id)
{
std::array<PathTraitsFS::value_type, MAX_PATH> dir;
@@ -226,7 +226,7 @@ try {
AllocatedPath
GetUserConfigDir() noexcept
{
-#if defined(WIN32)
+#if defined(_WIN32)
return GetStandardDir(CSIDL_LOCAL_APPDATA);
#elif defined(USE_XDG)
// Check for $XDG_CONFIG_HOME
@@ -251,7 +251,7 @@ GetUserConfigDir() noexcept
AllocatedPath
GetUserMusicDir() noexcept
{
-#if defined(WIN32)
+#if defined(_WIN32)
return GetStandardDir(CSIDL_MYMUSIC);
#elif defined(USE_XDG)
return GetUserDir("XDG_MUSIC_DIR");
@@ -287,7 +287,7 @@ GetUserCacheDir() noexcept
#endif
}
-#ifdef WIN32
+#ifdef _WIN32
AllocatedPath
GetSystemConfigDir() noexcept
diff --git a/src/fs/StandardDirectory.hxx b/src/fs/StandardDirectory.hxx
index 13d324c92..2742c6f50 100644
--- a/src/fs/StandardDirectory.hxx
+++ b/src/fs/StandardDirectory.hxx
@@ -42,7 +42,7 @@ gcc_pure
AllocatedPath
GetUserCacheDir() noexcept;
-#ifdef WIN32
+#ifdef _WIN32
/**
* Obtains system configuration directory.
diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx
index 9f2bbac02..64698996c 100644
--- a/src/fs/Traits.cxx
+++ b/src/fs/Traits.cxx
@@ -78,7 +78,7 @@ GetParentPathImpl(typename Traits::const_pointer_type p)
return typename Traits::string(Traits::CURRENT_DIRECTORY);
if (sep == p)
return typename Traits::string(p, p + 1);
-#ifdef WIN32
+#ifdef _WIN32
if (Traits::IsDrive(p) && sep == p + 2)
return typename Traits::string(p, p + 3);
#endif
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index 67f74dc57..e41ae1030 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -25,7 +25,7 @@
#include "util/StringPointer.hxx"
#include "util/StringAPI.hxx"
-#ifdef WIN32
+#ifdef _WIN32
#include "util/CharUtil.hxx"
#include <tchar.h>
#endif
@@ -34,7 +34,7 @@
#include <assert.h>
-#ifdef WIN32
+#ifdef _WIN32
#define PATH_LITERAL(s) _T(s)
#else
#define PATH_LITERAL(s) (s)
@@ -44,7 +44,7 @@
* This class describes the nature of a native filesystem path.
*/
struct PathTraitsFS {
-#ifdef WIN32
+#ifdef _WIN32
typedef std::wstring string;
#else
typedef std::string string;
@@ -55,7 +55,7 @@ struct PathTraitsFS {
typedef Pointer::pointer_type pointer_type;
typedef Pointer::const_pointer_type const_pointer_type;
-#ifdef WIN32
+#ifdef _WIN32
static constexpr value_type SEPARATOR = '\\';
#else
static constexpr value_type SEPARATOR = '/';
@@ -65,7 +65,7 @@ struct PathTraitsFS {
static constexpr bool IsSeparator(value_type ch) noexcept {
return
-#ifdef WIN32
+#ifdef _WIN32
ch == '/' ||
#endif
ch == SEPARATOR;
@@ -78,7 +78,7 @@ struct PathTraitsFS {
assert(p != nullptr);
#endif
-#ifdef WIN32
+#ifdef _WIN32
const_pointer_type pos = p + GetLength(p);
while (p != pos && !IsSeparator(*pos))
--pos;
@@ -88,7 +88,7 @@ struct PathTraitsFS {
#endif
}
-#ifdef WIN32
+#ifdef _WIN32
gcc_pure gcc_nonnull_all
static constexpr bool IsDrive(const_pointer_type p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':';
@@ -102,7 +102,7 @@ struct PathTraitsFS {
assert(p != nullptr);
#endif
-#ifdef WIN32
+#ifdef _WIN32
if (IsDrive(p) && IsSeparator(p[2]))
return true;
#endif
@@ -188,7 +188,7 @@ struct PathTraitsUTF8 {
return strrchr(p, SEPARATOR);
}
-#ifdef WIN32
+#ifdef _WIN32
gcc_pure gcc_nonnull_all
static constexpr bool IsDrive(const_pointer_type p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':';
@@ -202,7 +202,7 @@ struct PathTraitsUTF8 {
assert(p != nullptr);
#endif
-#ifdef WIN32
+#ifdef _WIN32
if (IsDrive(p) && IsSeparator(p[2]))
return true;
#endif
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx
index b72bee643..ddf7208a7 100644
--- a/src/fs/io/FileOutputStream.cxx
+++ b/src/fs/io/FileOutputStream.cxx
@@ -43,7 +43,7 @@ FileOutputStream::FileOutputStream(Path _path, Mode _mode)
}
}
-#ifdef WIN32
+#ifdef _WIN32
inline void
FileOutputStream::OpenCreate(gcc_unused bool visible)
@@ -223,7 +223,7 @@ FileOutputStream::Commit()
#endif
if (!Close()) {
-#ifdef WIN32
+#ifdef _WIN32
throw FormatLastError("Failed to commit %s",
path.ToUTF8().c_str());
#else
diff --git a/src/fs/io/FileOutputStream.hxx b/src/fs/io/FileOutputStream.hxx
index 0d195909c..a87036aec 100644
--- a/src/fs/io/FileOutputStream.hxx
+++ b/src/fs/io/FileOutputStream.hxx
@@ -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();
diff --git a/src/fs/io/FileReader.cxx b/src/fs/io/FileReader.cxx
index 72ee8f405..42adab501 100644
--- a/src/fs/io/FileReader.cxx
+++ b/src/fs/io/FileReader.cxx
@@ -24,7 +24,7 @@
#include <assert.h>
-#ifdef WIN32
+#ifdef _WIN32
FileReader::FileReader(Path _path)
:path(_path),
diff --git a/src/fs/io/FileReader.hxx b/src/fs/io/FileReader.hxx
index 7dc122217..d4d54564a 100644
--- a/src/fs/io/FileReader.hxx
+++ b/src/fs/io/FileReader.hxx
@@ -25,11 +25,11 @@
#include "fs/AllocatedPath.hxx"
#include "Compiler.h"
-#ifndef WIN32
+#ifndef _WIN32
#include "system/FileDescriptor.hxx"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
@@ -39,7 +39,7 @@ class FileInfo;
class FileReader final : public Reader {
AllocatedPath path;
-#ifdef WIN32
+#ifdef _WIN32
HANDLE handle;
#else
FileDescriptor fd;
@@ -48,7 +48,7 @@ class FileReader final : public Reader {
public:
explicit FileReader(Path _path);
-#ifdef WIN32
+#ifdef _WIN32
FileReader(FileReader &&other)
:path(std::move(other.path)),
handle(other.handle) {
@@ -70,7 +70,7 @@ public:
protected:
bool IsDefined() const {
-#ifdef WIN32
+#ifdef _WIN32
return handle != INVALID_HANDLE_VALUE;
#else
return fd.IsDefined();
@@ -78,7 +78,7 @@ protected:
}
public:
-#ifndef WIN32
+#ifndef _WIN32
FileDescriptor GetFD() const {
return fd;
}
@@ -90,7 +90,7 @@ public:
gcc_pure
uint64_t GetSize() const noexcept {
-#ifdef WIN32
+#ifdef _WIN32
LARGE_INTEGER size;
return GetFileSizeEx(handle, &size)
? size.QuadPart
@@ -102,7 +102,7 @@ public:
gcc_pure
uint64_t GetPosition() const noexcept {
-#ifdef WIN32
+#ifdef _WIN32
LARGE_INTEGER zero;
zero.QuadPart = 0;
LARGE_INTEGER position;