diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2011-12-08 10:16:31 -0800 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2011-12-10 22:33:17 -0800 |
| commit | fb00fda903bbd128952a8ecac4b4f6b459245012 (patch) | |
| tree | 9c996712687e17616020d1e1a827313e40a2c463 | |
| parent | afe7cf78d51b819dcdc5b0f4cb85a25a52a9fcd0 (diff) | |
| download | zlib-fb00fda903bbd128952a8ecac4b4f6b459245012.tar.gz zlib-fb00fda903bbd128952a8ecac4b4f6b459245012.tar.bz2 zlib-fb00fda903bbd128952a8ecac4b4f6b459245012.zip | |
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.h | 7 | ||||
| -rw-r--r-- | gzwrite.c | 2 |
2 files changed, 8 insertions, 1 deletions
| @@ -117,6 +117,13 @@ | |||
| 117 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | 117 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
| 118 | #endif | 118 | #endif |
| 119 | 119 | ||
| 120 | /* default memLevel */ | ||
| 121 | #if MAX_MEM_LEVEL >= 8 | ||
| 122 | # define DEF_MEM_LEVEL 8 | ||
| 123 | #else | ||
| 124 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL | ||
| 125 | #endif | ||
| 126 | |||
| 120 | /* default i/o buffer size -- double this for output when reading */ | 127 | /* default i/o buffer size -- double this for output when reading */ |
| 121 | #define GZBUFSIZE 8192 | 128 | #define GZBUFSIZE 8192 |
| 122 | 129 | ||
| @@ -40,7 +40,7 @@ local int gz_init(state) | |||
| 40 | strm->zfree = Z_NULL; | 40 | strm->zfree = Z_NULL; |
| 41 | strm->opaque = Z_NULL; | 41 | strm->opaque = Z_NULL; |
| 42 | ret = deflateInit2(strm, state->level, Z_DEFLATED, | 42 | ret = deflateInit2(strm, state->level, Z_DEFLATED, |
| 43 | 15 + 16, 8, state->strategy); | 43 | MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy); |
| 44 | if (ret != Z_OK) { | 44 | if (ret != Z_OK) { |
| 45 | free(state->out); | 45 | free(state->out); |
| 46 | free(state->in); | 46 | free(state->in); |
