From 1be8137ea8971693e360bdfb7ed1d520c6d10a09 Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Tue, 11 Sep 2018 10:29:18 +0900 Subject: [PATCH] [C++] Use Win32 API in MinGW build --- cpp/src/arrow/memory_pool.cc | 4 ++-- cpp/src/arrow/util/io-util.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc index 2f71c5d6f16..6d93db1b130 100644 --- a/cpp/src/arrow/memory_pool.cc +++ b/cpp/src/arrow/memory_pool.cc @@ -45,8 +45,8 @@ namespace { // (as of May 2016 64 bytes) Status AllocateAligned(int64_t size, uint8_t** out) { // TODO(emkornfield) find something compatible with windows -#ifdef _MSC_VER - // Special code path for MSVC +#ifdef _WIN32 + // Special code path for Windows *out = reinterpret_cast(_aligned_malloc(static_cast(size), kAlignment)); if (!*out) { diff --git a/cpp/src/arrow/util/io-util.cc b/cpp/src/arrow/util/io-util.cc index 8e578e4f539..3ece551ab5a 100644 --- a/cpp/src/arrow/util/io-util.cc +++ b/cpp/src/arrow/util/io-util.cc @@ -222,7 +222,7 @@ Status FileTell(int fd, int64_t* pos) { Status CreatePipe(int fd[2]) { int ret; -#if defined(_MSC_VER) +#if defined(_WIN32) ret = _pipe(fd, 4096, _O_BINARY); #else ret = pipe(fd); @@ -379,7 +379,7 @@ Status FileGetSize(int fd, int64_t* size) { // static inline int64_t pread_compat(int fd, void* buf, int64_t nbytes, int64_t pos) { -#if defined(_MSC_VER) +#if defined(_WIN32) HANDLE handle = reinterpret_cast(_get_osfhandle(fd)); DWORD dwBytesRead = 0; OVERLAPPED overlapped = {0}; @@ -496,7 +496,7 @@ Status FileWrite(int fd, const uint8_t* buffer, const int64_t nbytes) { Status FileTruncate(int fd, const int64_t size) { int ret, errno_actual; -#ifdef _MSC_VER +#ifdef _WIN32 errno_actual = _chsize_s(fd, static_cast(size)); ret = errno_actual == 0 ? 0 : -1; #else