summaryrefslogtreecommitdiff
path: root/deflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2017-01-15 08:22:16 -0800
committerMark Adler <madler@alumni.caltech.edu>2017-01-15 09:29:40 -0800
commitcbbd20302c6e3fb626bee5bd8b4932524049515c (patch)
tree91a632d17b1f7596af41e10537872ed02ee87d33 /deflate.c
parent7d9c9d410a7f8c732fdb0cac2b268659d624a6b6 (diff)
downloadzlib-cbbd20302c6e3fb626bee5bd8b4932524049515c.tar.gz
Permit immediate deflateParams changes before any deflate input.
This permits deflateParams to change the strategy and level right after deflateInit, without having to wait until a header has been written. The parameters can be changed immediately up until the first deflate call that consumes any input data.
Diffstat (limited to 'deflate.c')
-rw-r--r--deflate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/deflate.c b/deflate.c
index 8a1a91e..f146001 100644
--- a/deflate.c
+++ b/deflate.c
@@ -586,7 +586,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
}
func = configuration_table[s->level].func;
- if ((strategy != s->strategy || func != configuration_table[level].func)) {
+ if ((strategy != s->strategy || func != configuration_table[level].func) &&
+ s->high_water) {
/* Flush the last buffer: */
int err = deflate(strm, Z_BLOCK);
if (err == Z_STREAM_ERROR)