From 5dda348f405757ee25ab8a0cc030c0f2711812c3 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Tue, 14 Oct 2014 23:45:13 -0700 Subject: [PATCH] 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 46e15987e0fb0c3d8f20b791252ab6846df90ceb) ref #8689 --- src/support/ios.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/support/ios.c b/src/support/ios.c index 1cedf3f9fcbec..5622a22ecf54c 100644 --- a/src/support/ios.c +++ b/src/support/ios.c @@ -73,9 +73,12 @@ static int _enonfatal(int err) #define SLEEP_TIME 5//ms -#ifdef __APPLE__ +#if defined(__APPLE__) #define MAXSIZE ((1l << 31) - 1) // OSX cannot handle blocks larger than this #define LIMIT_IO_SIZE(n) ((n) < MAXSIZE ? (n) : MAXSIZE) +#elif defined(_OS_WINDOWS_) +#define MAXSIZE (0x7fffffff) // Windows read() takes a uint +#define LIMIT_IO_SIZE(n) ((n) < (size_t)MAXSIZE ? (unsigned int)(n) : MAXSIZE) #else #define LIMIT_IO_SIZE(n) (n) #endif