From eec3dee7b42fabbd0c84d429f3d5f028b03dae56 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Mon, 22 Mar 2021 14:58:51 +0100 Subject: [PATCH] Use _WIN32 instead of WIN32 to fix Windows builds (#498) --- lib/BC/Util.cpp | 6 +++--- lib/OS/FileSystem.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/BC/Util.cpp b/lib/BC/Util.cpp index 0cf821178..f5930b9d7 100644 --- a/lib/BC/Util.cpp +++ b/lib/BC/Util.cpp @@ -23,7 +23,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 # include # include #endif @@ -67,7 +67,7 @@ DEFINE_string( "Colon-separated list of search paths to use when searching for semantics files."); namespace { -#ifdef WIN32 +#ifdef _WIN32 extern "C" std::uint32_t GetProcessId(std::uint32_t handle); #endif @@ -75,7 +75,7 @@ extern "C" std::uint32_t GetProcessId(std::uint32_t handle); // conflict with the (deprecated) getpid function from the Windows // ucrt headers std::uint32_t nativeGetProcessID(void) { -#ifdef WIN32 +#ifdef _WIN32 return GetProcessId(0); #else return getpid(); diff --git a/lib/OS/FileSystem.cpp b/lib/OS/FileSystem.cpp index ebe7479de..504cbcd72 100644 --- a/lib/OS/FileSystem.cpp +++ b/lib/OS/FileSystem.cpp @@ -23,7 +23,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 # include # include # include @@ -47,7 +47,7 @@ // Do not include windows.h, or its macros will end up shadowing our functions // (i.e.: MoveFile) -#ifdef WIN32 +#ifdef _WIN32 namespace { const std::uint32_t INVALID_FILE_ATTRIBUTES = static_cast(-1); const std::uint32_t ERROR_NO_MORE_FILES = 18U; @@ -119,7 +119,7 @@ int link(const char *path1, const char *path2) { #endif namespace remill { -#ifdef WIN32 +#ifdef _WIN32 bool IsDirectory(const std::string &path_name) { auto attributes = GetFileAttributesA(path_name.data()); if (attributes == INVALID_FILE_ATTRIBUTES) { @@ -272,7 +272,7 @@ bool RenameFile(const std::string &from_path, const std::string &to_path) { } } -#ifndef WIN32 +#ifndef _WIN32 namespace { enum : size_t { kCopyDataSize = 4096ULL }; @@ -280,7 +280,7 @@ static uint8_t gCopyData[kCopyDataSize]; } // namespace #endif -#ifdef WIN32 +#ifdef _WIN32 void CopyFile(const std::string &from_path, const std::string &to_path) { if (CopyFileA(from_path.data(), to_path.data(), false) == 0) { LOG(FATAL) << "Unable to copy all data read from " << from_path << " to " @@ -373,7 +373,7 @@ std::string CanonicalPath(const std::string &path) { // Returns the path separator character for this OS. const char *PathSeparator(void) { -#ifdef WIN32 +#ifdef _WIN32 return "\\"; #else return "/";