From 584dd13b110c92da304d5d608dcdbfc0c8c9dfd0 Mon Sep 17 00:00:00 2001 From: Hans Kristian Rosbach Date: Mon, 17 Sep 2018 12:22:43 +0200 Subject: [PATCH] Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure. Also add this combination to travis testing. Remove --native testing from travis, since they somehow make this fail very often, probably due to caching or running the executables on a different platform than the compiler thinks it is running on. --- .travis.yml | 2 +- gzguts.h | 2 +- gzread.c | 9 +++++---- gzwrite.c | 12 ++++++------ zlib-ng.h | 8 ++++---- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84531641d..3b6933bd9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ matrix: env: BUILDDIR=. TOOL="./configure --warn" - os: linux compiler: gcc - env: BUILDDIR=. TOOL="./configure --warn --zlib-compat --native" + env: BUILDDIR=. TOOL="cmake . -DZLIB_COMPAT=OFF -DWITH_GZFILEOP=ON -DWITH_NEW_STRATEGIES=YES -DWITH_OPTIM=ON" - os: linux compiler: gcc env: BUILDDIR=../build TOOL="../zlib-ng/configure --warn --zlib-compat" diff --git a/gzguts.h b/gzguts.h index 2e7e7813c..6e84adb7d 100644 --- a/gzguts.h +++ b/gzguts.h @@ -138,7 +138,7 @@ typedef struct { int err; /* error code */ char *msg; /* error message */ /* zlib inflate or deflate stream */ - z_stream strm; /* stream structure in-place (not a pointer) */ + PREFIX3(stream) strm; /* stream structure in-place (not a pointer) */ } gz_state; typedef gz_state *gz_statep; diff --git a/gzread.c b/gzread.c index dc4f50f82..4b72875f1 100644 --- a/gzread.c +++ b/gzread.c @@ -47,7 +47,7 @@ static int gz_load(gz_state *state, unsigned char *buf, unsigned len, unsigned * available data from the input file. */ static int gz_avail(gz_state *state) { unsigned got; - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); if (state->err != Z_OK && state->err != Z_BUF_ERROR) return -1; @@ -78,7 +78,7 @@ static int gz_avail(gz_state *state) { a user buffer. If decompressing, the inflate state will be initialized. gz_look() will return 0 on success or -1 on failure. */ static int gz_look(gz_state *state) { - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); /* allocate read buffers and inflate memory */ if (state->size == 0) { @@ -162,7 +162,7 @@ static int gz_look(gz_state *state) { static int gz_decomp(gz_state *state) { int ret = Z_OK; unsigned had; - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); /* fill output buffer up to end of deflate stream */ had = strm->avail_out; @@ -210,7 +210,7 @@ static int gz_decomp(gz_state *state) { otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the end of the input file has been reached and all data has been processed. */ static int gz_fetch(gz_state *state) { - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); do { switch (state->how) { @@ -406,6 +406,7 @@ size_t ZEXPORT PREFIX(gzfread)(void *buf, size_t size, size_t nitems, gzFile fil /* -- see zlib.h -- */ #undef gzgetc +#undef zng_gzgetc int ZEXPORT PREFIX(gzgetc)(gzFile file) { int ret; unsigned char buf[1]; diff --git a/gzwrite.c b/gzwrite.c index 0476d9a07..8395b65eb 100644 --- a/gzwrite.c +++ b/gzwrite.c @@ -18,7 +18,7 @@ static size_t gz_write(gz_state *, void const *, size_t); success. */ static int gz_init(gz_state *state) { int ret; - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); /* allocate input buffer (double size for gzprintf) */ state->in = (unsigned char *)malloc(state->want << 1); @@ -73,7 +73,7 @@ static int gz_comp(gz_state *state, int flush) { int ret; ssize_t got; unsigned have; - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); /* allocate memory if this is the first time through */ if (state->size == 0 && gz_init(state) == -1) @@ -132,7 +132,7 @@ static int gz_comp(gz_state *state, int flush) { static int gz_zero(gz_state *state, z_off64_t len) { int first; unsigned n; - z_stream *strm = &(state->strm); + PREFIX3(stream) *strm = &(state->strm); /* consume whatever's left in the input buffer */ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) @@ -278,7 +278,7 @@ int ZEXPORT PREFIX(gzputc)(gzFile file, int c) { unsigned have; unsigned char buf[1]; gz_state *state; - z_stream *strm; + PREFIX3(stream) *strm; /* get internal structure */ if (file == NULL) @@ -345,7 +345,7 @@ int ZEXPORTVA PREFIX(gzvprintf)(gzFile file, const char *format, va_list va) { unsigned left; char *next; gz_state *state; - z_stream *strm; + PREFIX3(stream) *strm; /* get internal structure */ if (file == NULL) @@ -438,7 +438,7 @@ int ZEXPORT PREFIX(gzflush)(gzFile file, int flush) { /* -- see zlib.h -- */ int ZEXPORT PREFIX(gzsetparams)(gzFile file, int level, int strategy) { gz_state *state; - z_stream *strm; + PREFIX3(stream) *strm; /* get internal structure */ if (file == NULL) diff --git a/zlib-ng.h b/zlib-ng.h index a2e59deeb..6010bba98 100644 --- a/zlib-ng.h +++ b/zlib-ng.h @@ -1754,10 +1754,10 @@ ZEXTERN int ZEXPORT zng_gzgetc_(gzFile file); /* backward compatibility */ #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 +# define zng_gzopen zng_gzopen64 +# define zng_gzseek zng_gzseek64 +# define zng_gztell zng_gztell64 +# define zng_gzoffset zng_gzoffset64 # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT zng_gzopen64(const char *, const char *); ZEXTERN z_off_t ZEXPORT zng_gzseek64(gzFile, z_off_t, int); -- 2.47.3