diff options
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm) | |||
494 | s->wrap == 2 ? crc32(0L, Z_NULL, 0) : | 494 | s->wrap == 2 ? crc32(0L, Z_NULL, 0) : |
495 | #endif | 495 | #endif |
496 | adler32(0L, Z_NULL, 0); | 496 | adler32(0L, Z_NULL, 0); |
497 | s->last_flush = Z_NO_FLUSH; | 497 | s->last_flush = -2; |
498 | 498 | ||
499 | _tr_init(s); | 499 | _tr_init(s); |
500 | 500 | ||
@@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy) | |||
587 | func = configuration_table[s->level].func; | 587 | func = configuration_table[s->level].func; |
588 | 588 | ||
589 | if ((strategy != s->strategy || func != configuration_table[level].func) && | 589 | if ((strategy != s->strategy || func != configuration_table[level].func) && |
590 | s->high_water) { | 590 | s->last_flush != -2) { |
591 | /* Flush the last buffer: */ | 591 | /* Flush the last buffer: */ |
592 | int err = deflate(strm, Z_BLOCK); | 592 | int err = deflate(strm, Z_BLOCK); |
593 | if (err == Z_STREAM_ERROR) | 593 | if (err == Z_STREAM_ERROR) |
594 | return err; | 594 | return err; |
595 | if (strm->avail_out == 0) | 595 | if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) |
596 | return Z_BUF_ERROR; | 596 | return Z_BUF_ERROR; |
597 | } | 597 | } |
598 | if (s->level != level) { | 598 | if (s->level != level) { |