diff options
author | Przemyslaw Skibinski <inikep@gmail.com> | 2017-02-15 16:17:57 (GMT) |
---|---|---|
committer | Przemyslaw Skibinski <inikep@gmail.com> | 2017-02-15 16:17:57 (GMT) |
commit | 68a358769e01606444b54e43cb62ee28abb047e5 (patch) | |
tree | 5922148a301c92d00e6875c80b8cb240c7024f3f /programs/lz4io.c | |
parent | 40ad1e85d49bd067a0b06b0e923ec47cc9930173 (diff) | |
download | lz4-68a358769e01606444b54e43cb62ee28abb047e5.zip lz4-68a358769e01606444b54e43cb62ee28abb047e5.tar.gz lz4-68a358769e01606444b54e43cb62ee28abb047e5.tar.bz2 |
Avoid fseek()'s 2GiB barrier with MinGW
Diffstat (limited to 'programs/lz4io.c')
-rw-r--r-- | programs/lz4io.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/programs/lz4io.c b/programs/lz4io.c index 640c76d..5264b14 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -59,17 +59,6 @@ #include "lz4frame.h" -/* ************************************** -* Compiler Options -****************************************/ -#if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Avoid MSVC fseek()'s 2GiB barrier */ -# define fseek _fseeki64 -#endif -#if !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */ -# define fseek fseeko -#endif - - /***************************** * Constants *****************************/ @@ -633,7 +622,7 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer /* avoid int overflow */ if (storedSkips > 1 GB) { - int const seekResult = fseek(file, 1 GB, SEEK_CUR); + int const seekResult = UTIL_fseek(file, 1 GB, SEEK_CUR); if (seekResult != 0) EXM_THROW(71, "1 GB skip error (sparse file support)"); storedSkips -= 1 GB; } @@ -650,7 +639,7 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer if (nb0T != seg0SizeT) { /* not all 0s */ errno = 0; - { int const seekResult = fseek(file, storedSkips, SEEK_CUR); + { int const seekResult = UTIL_fseek(file, storedSkips, SEEK_CUR); if (seekResult) EXM_THROW(72, "Sparse skip error(%d): %s ; try --no-sparse", (int)errno, strerror(errno)); } storedSkips = 0; @@ -670,7 +659,7 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer for (; (restPtr < restEnd) && (*restPtr == 0); restPtr++) ; storedSkips += (unsigned) (restPtr - restStart); if (restPtr != restEnd) { - int const seekResult = fseek(file, storedSkips, SEEK_CUR); + int const seekResult = UTIL_fseek(file, storedSkips, SEEK_CUR); if (seekResult) EXM_THROW(74, "Sparse skip error ; try --no-sparse"); storedSkips = 0; { size_t const sizeCheck = fwrite(restPtr, 1, restEnd - restPtr, file); @@ -684,7 +673,7 @@ static unsigned LZ4IO_fwriteSparse(FILE* file, const void* buffer, size_t buffer static void LZ4IO_fwriteSparseEnd(FILE* file, unsigned storedSkips) { if (storedSkips>0) { /* implies g_sparseFileSupport>0 */ - int const seekResult = fseek(file, storedSkips-1, SEEK_CUR); + int const seekResult = UTIL_fseek(file, storedSkips-1, SEEK_CUR); if (seekResult != 0) EXM_THROW(69, "Final skip error (sparse file)\n"); { const char lastZeroByte[1] = { 0 }; size_t const sizeCheck = fwrite(lastZeroByte, 1, 1, file); @@ -873,7 +862,7 @@ static int fseek_u32(FILE *fp, unsigned offset, int where) while (offset > 0) { unsigned s = offset; if (s > stepMax) s = stepMax; - errorNb = fseek(fp, (long) s, SEEK_CUR); + errorNb = UTIL_fseek(fp, (long) s, SEEK_CUR); if (errorNb != 0) break; offset -= s; } |