]> git.lizzy.rs Git - zlib.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)
committerMark Adler <madler@alumni.caltech.edu>
Sun, 4 Dec 2016 15:48:47 +0000 (07:48 -0800)
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 2905cceb279eba8da484bdf91452b49a1cbb6ba9..61a4de7c580b8ad5d28d2f29b9316ffdd072019a 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -554,7 +554,7 @@ int ZEXPORT gzsetparams(file, level, 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);
     }