summaryrefslogtreecommitdiff
path: root/deflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2017-01-16 09:49:35 -0800
committerMark Adler <madler@alumni.caltech.edu>2017-02-15 22:38:55 -0800
commitf9694097dd69354b03cb8af959094c7f260db0a1 (patch)
tree3077a3e9e3eb1de0bb1fb65b439f1701c9ea91d6 /deflate.c
parent5ff989033e8b839b80ce716a1452acf7664e2ff4 (diff)
downloadzlib-f9694097dd69354b03cb8af959094c7f260db0a1.tar.gz
Permit a deflateParams() parameter change as soon as possible.
This commit allows a parameter change even if the input data has not all been compressed and copied to the application output buffer, so long as all of the input data has been compressed to the internal pending output buffer. This also allows an immediate deflateParams change so long as there have been no deflate calls since initialization or reset.
Diffstat (limited to 'deflate.c')
-rw-r--r--deflate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/deflate.c b/deflate.c
index b63311a..20bda4f 100644
--- a/deflate.c
+++ b/deflate.c
@@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm)
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
#endif
adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
+ s->last_flush = -2;
_tr_init(s);
@@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
func = configuration_table[s->level].func;
if ((strategy != s->strategy || func != configuration_table[level].func) &&
- s->high_water) {
+ s->last_flush != -2) {
/* Flush the last buffer: */
int err = deflate(strm, Z_BLOCK);
if (err == Z_STREAM_ERROR)
return err;
- if (strm->avail_out == 0)
+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
return Z_BUF_ERROR;
}
if (s->level != level) {