|
|
3d479f |
From f1b8edadc3c733990f8a8de4d643f968e571ae85 Mon Sep 17 00:00:00 2001
|
|
|
3d479f |
From: Adam Tkac <atkac@redhat.com>
|
|
|
3d479f |
Date: Fri, 17 Aug 2012 15:13:48 +0200
|
|
|
3d479f |
Subject: [PATCH] Rank Z_BLOCK flush below Z_PARTIAL_FLUSH only when last
|
|
|
3d479f |
flush was Z_BLOCK.
|
|
|
3d479f |
|
|
|
3d479f |
This fixes regression introduced by f1ebdd6a9c495a5db9a22aa80dd7d54ae7db42e9
|
|
|
3d479f |
(Permit stronger flushes after Z_BLOCK flushes.). Now this code is valid
|
|
|
3d479f |
again:
|
|
|
3d479f |
|
|
|
3d479f |
deflate(stream, Z_SYNC_FLUSH);
|
|
|
3d479f |
deflateParams(stream, newLevel, Z_DEFAULT_STRATEGY);
|
|
|
3d479f |
|
|
|
3d479f |
Signed-off-by: Adam Tkac <atkac@redhat.com>
|
|
|
3d479f |
---
|
|
|
3d479f |
deflate.c | 13 ++++++++++---
|
|
|
3d479f |
1 file changed, 10 insertions(+), 3 deletions(-)
|
|
|
3d479f |
|
|
|
3d479f |
diff --git a/deflate.c b/deflate.c
|
|
|
3d479f |
index 9e4c2cb..3422f72 100644
|
|
|
3d479f |
--- a/deflate.c
|
|
|
3d479f |
+++ b/deflate.c
|
|
|
3d479f |
@@ -882,9 +882,16 @@ int ZEXPORT deflate (strm, flush)
|
|
|
3d479f |
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
|
|
3d479f |
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
|
|
3d479f |
*/
|
|
|
3d479f |
- } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
|
|
|
3d479f |
- flush != Z_FINISH) {
|
|
|
3d479f |
- ERR_RETURN(strm, Z_BUF_ERROR);
|
|
|
3d479f |
+ } else if (strm->avail_in == 0 && flush != Z_FINISH) {
|
|
|
3d479f |
+ char err;
|
|
|
3d479f |
+
|
|
|
3d479f |
+ /* Degrade Z_BLOCK only when last flush was Z_BLOCK */
|
|
|
3d479f |
+ err = (old_flush == Z_BLOCK) ?
|
|
|
3d479f |
+ RANK(flush) <= RANK(old_flush) : flush <= old_flush;
|
|
|
3d479f |
+
|
|
|
3d479f |
+ if (err) {
|
|
|
3d479f |
+ ERR_RETURN(strm, Z_BUF_ERROR);
|
|
|
3d479f |
+ }
|
|
|
3d479f |
}
|
|
|
3d479f |
|
|
|
3d479f |
/* User must not provide more input after the first FINISH: */
|
|
|
3d479f |
--
|
|
|
3d479f |
1.7.11.4
|
|
|
3d479f |
|