From cbbd20302c6e3fb626bee5bd8b4932524049515c Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Sun, 15 Jan 2017 08:22:16 -0800
Subject: 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.
---
 deflate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'deflate.c')

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)
-- 
cgit v1.2.3-55-g6feb