Skip to content

Commit 5dda348

Browse files
tkelmanivarne
authored andcommitted
fix #8678, reading large files on windows
read() on windows takes a uint, so apply a similar io limit per call as done on mac (directly reusing the same code would give a compiler warning, since long is 32 bits on windows) (cherry picked from commit 46e1598) ref #8689
1 parent b1fc473 commit 5dda348

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/support/ios.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ static int _enonfatal(int err)
7373

7474
#define SLEEP_TIME 5//ms
7575

76-
#ifdef __APPLE__
76+
#if defined(__APPLE__)
7777
#define MAXSIZE ((1l << 31) - 1) // OSX cannot handle blocks larger than this
7878
#define LIMIT_IO_SIZE(n) ((n) < MAXSIZE ? (n) : MAXSIZE)
79+
#elif defined(_OS_WINDOWS_)
80+
#define MAXSIZE (0x7fffffff) // Windows read() takes a uint
81+
#define LIMIT_IO_SIZE(n) ((n) < (size_t)MAXSIZE ? (unsigned int)(n) : MAXSIZE)
7982
#else
8083
#define LIMIT_IO_SIZE(n) (n)
8184
#endif

0 commit comments

Comments
 (0)