]> git.lizzy.rs Git - zlib.git/commitdiff
Fix deflateEnd() to not report an error at start of raw deflate.
authorMark Adler <zlib@madler.net>
Fri, 13 Oct 2017 04:07:22 +0000 (21:07 -0700)
committerMark Adler <zlib@madler.net>
Fri, 13 Oct 2017 04:07:22 +0000 (21:07 -0700)
deflate.c

index 568eaddbe915eeae9a6998bb4e443a10c054b543..425babc00c339437ce3521fe8266d15ac69d3c8b 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -491,7 +491,7 @@ int ZEXPORT deflateResetKeep (strm)
 #ifdef GZIP
         s->wrap == 2 ? GZIP_STATE :
 #endif
-        s->wrap ? INIT_STATE : BUSY_STATE;
+        INIT_STATE;
     strm->adler =
 #ifdef GZIP
         s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
@@ -814,6 +814,8 @@ int ZEXPORT deflate (strm, flush)
     }
 
     /* Write the header */
+    if (s->status == INIT_STATE && s->wrap == 0)
+        s->status = BUSY_STATE;
     if (s->status == INIT_STATE) {
         /* zlib header */
         uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;