]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Don't need to emit an empty fixed block when changing parameters.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 3 Dec 2016 16:29:57 +0000 (08:29 -0800)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 6 Feb 2017 12:07:40 +0000 (13:07 +0100)
gzsetparams() was using Z_PARTIAL_FLUSH when it could use Z_BLOCK
instead. This commit uses Z_BLOCK, which avoids emitting an
unnecessary ten bits into the stream.

gzwrite.c

index 2aaf4d52cb9fcb8992a2af9511f2e3af7317a367..43b2c0a3a7aade14a9d3f5ea822d7fb3a5ce6919 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -409,7 +409,7 @@ int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
     /* change compression parameters for subsequent input */
     if (state->size) {
         /* flush previous input with previous parameters before changing */
-        if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
+        if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1)
             return state->err;
         deflateParams(strm, level, strategy);
     }