Skip to content

Commit eec3dee

Browse files
authored
Use _WIN32 instead of WIN32 to fix Windows builds (#498)
1 parent 021b799 commit eec3dee

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/BC/Util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <utility>
2424
#include <vector>
2525

26-
#ifndef WIN32
26+
#ifndef _WIN32
2727
# include <sys/stat.h>
2828
# include <unistd.h>
2929
#endif
@@ -67,15 +67,15 @@ DEFINE_string(
6767
"Colon-separated list of search paths to use when searching for semantics files.");
6868

6969
namespace {
70-
#ifdef WIN32
70+
#ifdef _WIN32
7171
extern "C" std::uint32_t GetProcessId(std::uint32_t handle);
7272
#endif
7373

7474
// We are avoiding the `getpid` name here to make sure we don't
7575
// conflict with the (deprecated) getpid function from the Windows
7676
// ucrt headers
7777
std::uint32_t nativeGetProcessID(void) {
78-
#ifdef WIN32
78+
#ifdef _WIN32
7979
return GetProcessId(0);
8080
#else
8181
return getpid();

lib/OS/FileSystem.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <fstream>
2424
#include <vector>
2525

26-
#ifndef WIN32
26+
#ifndef _WIN32
2727
# include <dirent.h>
2828
# include <fcntl.h>
2929
# include <sys/stat.h>
@@ -47,7 +47,7 @@
4747

4848
// Do not include windows.h, or its macros will end up shadowing our functions
4949
// (i.e.: MoveFile)
50-
#ifdef WIN32
50+
#ifdef _WIN32
5151
namespace {
5252
const std::uint32_t INVALID_FILE_ATTRIBUTES = static_cast<std::uint32_t>(-1);
5353
const std::uint32_t ERROR_NO_MORE_FILES = 18U;
@@ -119,7 +119,7 @@ int link(const char *path1, const char *path2) {
119119
#endif
120120

121121
namespace remill {
122-
#ifdef WIN32
122+
#ifdef _WIN32
123123
bool IsDirectory(const std::string &path_name) {
124124
auto attributes = GetFileAttributesA(path_name.data());
125125
if (attributes == INVALID_FILE_ATTRIBUTES) {
@@ -272,15 +272,15 @@ bool RenameFile(const std::string &from_path, const std::string &to_path) {
272272
}
273273
}
274274

275-
#ifndef WIN32
275+
#ifndef _WIN32
276276
namespace {
277277
enum : size_t { kCopyDataSize = 4096ULL };
278278

279279
static uint8_t gCopyData[kCopyDataSize];
280280
} // namespace
281281
#endif
282282

283-
#ifdef WIN32
283+
#ifdef _WIN32
284284
void CopyFile(const std::string &from_path, const std::string &to_path) {
285285
if (CopyFileA(from_path.data(), to_path.data(), false) == 0) {
286286
LOG(FATAL) << "Unable to copy all data read from " << from_path << " to "
@@ -373,7 +373,7 @@ std::string CanonicalPath(const std::string &path) {
373373

374374
// Returns the path separator character for this OS.
375375
const char *PathSeparator(void) {
376-
#ifdef WIN32
376+
#ifdef _WIN32
377377
return "\\";
378378
#else
379379
return "/";

0 commit comments

Comments
 (0)