From 41b6ed3c5bc7f0c85f1bfe3abc940d9b74581e7d Mon Sep 17 00:00:00 2001 From: Takayuki MATSUOKA Date: Sat, 14 Feb 2015 12:48:11 +0900 Subject: Replace fseek with _fseeki64 to avoid MSVC's 2GiB barrier Since MSVC fseek()'s SEEK_CUR mode has 2GiB barrier, our fseek() calling in program/lz4io.c/selectDecoder() will fail for large (>2GiB) .lz4 file. This commit just replace fseek with _fseeki64 by macro. Second argument is automatically casted to __int64 (signed 64bit integer). Other things are completely same. --- programs/lz4io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/programs/lz4io.c b/programs/lz4io.c index fa1f0f9..023824e 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -71,6 +71,9 @@ # ifdef __MINGW32__ int _fileno(FILE *stream); /* MINGW somehow forgets to include this windows declaration into */ # endif +# if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Avoid MSVC fseek()'s 2GiB barrier */ +# define fseek _fseeki64 +# endif # define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY) # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) #else -- cgit v0.12