Skip to content

Commit 032e60a

Browse files
graehlkpu
authored andcommitted
windows compile (MSVC2010) - std::min, WINBOOL typedef
Conflicts: util/file.cc
1 parent 99bab0a commit 032e60a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

util/file.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ uint64_t SizeOrThrow(int fd) {
111111

112112
void ResizeOrThrow(int fd, uint64_t to) {
113113
#if defined __MINGW32__
114-
// Does this handle 64-bit?
114+
// Does this handle 64-bit?
115115
int ret = ftruncate
116116
#elif defined(_WIN32) || defined(_WIN64)
117117
errno_t ret = _chsize_s
@@ -128,8 +128,10 @@ namespace {
128128
std::size_t GuardLarge(std::size_t size) {
129129
// The following operating systems have broken read/write/pread/pwrite that
130130
// only supports up to 2^31.
131+
// OS X man pages claim to support 64-bit, but Kareem M. Darwish had problems
132+
// building with larger files, so APPLE is also here.
131133
#if defined(_WIN32) || defined(_WIN64) || defined(__APPLE__) || defined(OS_ANDROID) || defined(__MINGW32__)
132-
return std::min(static_cast<std::size_t>(static_cast<unsigned>(-1)), size);
134+
return size < INT_MAX ? size : INT_MAX;
133135
#else
134136
return size;
135137
#endif

0 commit comments

Comments
 (0)