zlib/bsc1174551-fxi-imcomplete-raw-streams.patch
Tomáš Chvátal 7fc14866c9 Accepting request 824656 from home:zhonglidong:branches:devel:libraries:c_c++
- Permit a deflateParams() parameter change as soon as possible(bsc#1174736)
    * bsc1174736-DFLTCC_LEVEL_MASK-set-to-0x1ff.patch
  Fix DFLTCC not flushing EOBS when creating raw streams(bsc#1174551)
    * bsc1174551-fxi-imcomplete-raw-streams.patch

OBS-URL: https://build.opensuse.org/request/show/824656
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/zlib?expand=0&rev=65
2020-08-06 10:07:22 +00:00

35 lines
965 B
Diff

diff --git a/deflate.c b/deflate.c
index 3c302bc..1ab1635 100644
--- a/deflate.c
+++ b/deflate.c
@@ -1110,7 +1110,6 @@ int ZEXPORT deflate (strm, flush)
}
if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
/* Write the trailer */
#ifdef GZIP
@@ -1126,7 +1125,7 @@ int ZEXPORT deflate (strm, flush)
}
else
#endif
- {
+ if (s->wrap == 1) {
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
@@ -1135,7 +1134,11 @@ int ZEXPORT deflate (strm, flush)
* to flush the rest.
*/
if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
+ if (s->pending == 0) {
+ Assert(s->bi_valid == 0, "bi_buf not flushed");
+ return Z_STREAM_END;
+ }
+ return Z_OK;
}
/* ========================================================================= */