summaryrefslogtreecommitdiff
path: root/gzlib.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2017-02-04 23:58:37 -0800
committerMark Adler <madler@alumni.caltech.edu>2017-02-15 22:39:26 -0800
commita3622937453f517285f851817a7505f54f4f19aa (patch)
treeba1286c2e4be51ed5dc3aac1f51c83fa781fc898 /gzlib.c
parent38e8ce32afbaa82f67d992b9f3056f281fe69259 (diff)
downloadzlib-a3622937453f517285f851817a7505f54f4f19aa.tar.gz
Avoid a conversion error in gzseek when off_t type too small.
This is a problem in the odd case that the second argument of LSEEK is a larger type than off_t. Apparently MinGW defines off_t to be 32 bits, but _lseeki64 has a 64-bit second argument. Also undo a previous commit to permit MinGW to use _lseeki64.
Diffstat (limited to 'gzlib.c')
-rw-r--r--gzlib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gzlib.c b/gzlib.c
index 4105e6a..4838bf0 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -5,7 +5,7 @@
#include "gzguts.h"
-#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__BORLANDC__)
# define LSEEK _lseeki64
#else
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
@@ -397,7 +397,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
/* if within raw area while reading, just go there */
if (state->mode == GZ_READ && state->how == COPY &&
state->x.pos + offset >= 0) {
- ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
+ ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
if (ret == -1)
return -1;
state->x.have = 0;