summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-12-08 10:16:31 -0800
committerMark Adler <madler@alumni.caltech.edu>2011-12-10 22:33:17 -0800
commitfb00fda903bbd128952a8ecac4b4f6b459245012 (patch)
tree9c996712687e17616020d1e1a827313e40a2c463
parentafe7cf78d51b819dcdc5b0f4cb85a25a52a9fcd0 (diff)
downloadzlib-fb00fda903bbd128952a8ecac4b4f6b459245012.tar.gz
Fix gzwrite.c to accommodate reduced memory zlib compilation.
gzwrite.c had hard-coded parameters to deflateInit2() which could contradict compile-time options for the use of less memory and fewer code bits. This patch suggested by Karsten Saunte fixes that.
-rw-r--r--gzguts.h7
-rw-r--r--gzwrite.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/gzguts.h b/gzguts.h
index 9daada1..eefdca0 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -117,6 +117,13 @@
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
#endif
+/* default memLevel */
+#if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+#else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+#endif
+
/* default i/o buffer size -- double this for output when reading */
#define GZBUFSIZE 8192
diff --git a/gzwrite.c b/gzwrite.c
index 6c991fe..2dcb3fc 100644
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -40,7 +40,7 @@ local int gz_init(state)
strm->zfree = Z_NULL;
strm->opaque = Z_NULL;
ret = deflateInit2(strm, state->level, Z_DEFLATED,
- 15 + 16, 8, state->strategy);
+ MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
if (ret != Z_OK) {
free(state->out);
free(state->in);