diff options
Diffstat (limited to 'cpukit/zlib/gzlib.c')
-rw-r--r-- | cpukit/zlib/gzlib.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/cpukit/zlib/gzlib.c b/cpukit/zlib/gzlib.c index 603e60ed54..5d55549960 100644 --- a/cpukit/zlib/gzlib.c +++ b/cpukit/zlib/gzlib.c @@ -5,7 +5,7 @@ #include "gzguts.h" -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +#ifdef _LARGEFILE64_SOURCE # define LSEEK lseek64 #else # define LSEEK lseek @@ -15,7 +15,7 @@ local void gz_reset OF((gz_statep)); local gzFile gz_open OF((const char *, int, const char *)); -#if defined UNDER_CE +#if defined UNDER_CE && defined NO_ERRNO_H /* Map the Windows error number in ERROR to a locale-dependent error message string and return a pointer to it. Typically, the values for ERROR come @@ -26,7 +26,7 @@ local gzFile gz_open OF((const char *, int, const char *)); The gz_strwinerror function does not change the current setting of GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) +char ZEXPORT *gz_strwinerror (error) DWORD error; { static char buf[1024]; @@ -65,7 +65,7 @@ char ZLIB_INTERNAL *gz_strwinerror (error) return buf; } -#endif /* UNDER_CE */ +#endif /* UNDER_CE && NO_ERRNO_H */ /* Reset gzip file state */ local void gz_reset(state) @@ -172,7 +172,6 @@ local gzFile gz_open(path, fd, mode) O_APPEND))), 0666); if (state->fd == -1) { - free(state->path); free(state); return NULL; } @@ -200,6 +199,7 @@ gzFile ZEXPORT gzopen(path, mode) return gz_open(path, -1, mode); } +#if (defined(_LARGEFILE64_SOURCE)||(_FILE_OFFSET_BITS == 64)) /* -- see zlib.h -- */ gzFile ZEXPORT gzopen64(path, mode) const char *path; @@ -207,6 +207,7 @@ gzFile ZEXPORT gzopen64(path, mode) { return gz_open(path, -1, mode); } +#endif /* (defined(_LARGEFILE64_SOURCE)||(_FILE_OFFSET_BITS == 64)) */ /* -- see zlib.h -- */ gzFile ZEXPORT gzdopen(fd, mode) @@ -218,7 +219,7 @@ gzFile ZEXPORT gzdopen(fd, mode) if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) return NULL; - sprintf(path, "<fd:%d>", fd); /* for debugging */ + sprintf(path, "<fd:%d>", fd); gz = gz_open(path, fd, mode); free(path); return gz; @@ -306,7 +307,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->pos + offset >= state->raw) { - ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); + ret = LSEEK(state->fd, offset, SEEK_CUR); if (ret == -1) return -1; state->have = 0; @@ -387,6 +388,7 @@ z_off_t ZEXPORT gztell(file) } /* -- see zlib.h -- */ + z_off64_t ZEXPORT gzoffset64(file) gzFile file; { @@ -433,8 +435,7 @@ int ZEXPORT gzeof(file) return 0; /* return end-of-file state */ - return state->mode == GZ_READ ? - (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; + return state->mode == GZ_READ ? (state->eof && state->have == 0) : 0; } /* -- see zlib.h -- */ @@ -482,7 +483,7 @@ void ZEXPORT gzclearerr(file) memory). Simply save the error message as a static string. If there is an allocation failure constructing the error message, then convert the error to out of memory. */ -void ZLIB_INTERNAL gz_error(state, err, msg) +void ZEXPORT gz_error(state, err, msg) gz_statep state; int err; const char *msg; @@ -522,7 +523,7 @@ void ZLIB_INTERNAL gz_error(state, err, msg) available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned ZLIB_INTERNAL gz_intmax() +unsigned ZEXPORT gz_intmax() { unsigned p, q; |