diff options
author | Takayuki MATSUOKA <takayuki.matsuoka@gmail.com> | 2015-02-14 03:48:11 (GMT) |
---|---|---|
committer | Takayuki MATSUOKA <takayuki.matsuoka@gmail.com> | 2015-02-14 03:48:11 (GMT) |
commit | 41b6ed3c5bc7f0c85f1bfe3abc940d9b74581e7d (patch) | |
tree | 1c51700b8513b009bbba7682739c25e40717dbc2 /programs | |
parent | 9fd92def420879e7d5c7c9fb9a9abd2fbd54bb7a (diff) | |
download | lz4-41b6ed3c5bc7f0c85f1bfe3abc940d9b74581e7d.zip lz4-41b6ed3c5bc7f0c85f1bfe3abc940d9b74581e7d.tar.gz lz4-41b6ed3c5bc7f0c85f1bfe3abc940d9b74581e7d.tar.bz2 |
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.
Diffstat (limited to 'programs')
-rw-r--r-- | programs/lz4io.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 <stdio.h> */ # 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 |