Skip to content

Commit

Permalink
fix #8678, reading large files on windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tkelman authored and ivarne committed Oct 22, 2014
1 parent b1fc473 commit 5dda348
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/support/ios.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5dda348

Please sign in to comment.