File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -451,17 +451,24 @@ int zlib_deflate(
451
451
Assert (strm -> avail_out > 0 , "bug2" );
452
452
453
453
if (flush != Z_FINISH ) return Z_OK ;
454
- if (s -> noheader ) return Z_STREAM_END ;
455
454
456
- /* Write the zlib trailer (adler32) */
457
- putShortMSB (s , (uInt )(strm -> adler >> 16 ));
458
- putShortMSB (s , (uInt )(strm -> adler & 0xffff ));
455
+ if (!s -> noheader ) {
456
+ /* Write zlib trailer (adler32) */
457
+ putShortMSB (s , (uInt )(strm -> adler >> 16 ));
458
+ putShortMSB (s , (uInt )(strm -> adler & 0xffff ));
459
+ }
459
460
flush_pending (strm );
460
461
/* If avail_out is zero, the application will call deflate again
461
462
* to flush the rest.
462
463
*/
463
- s -> noheader = -1 ; /* write the trailer only once! */
464
- return s -> pending != 0 ? Z_OK : Z_STREAM_END ;
464
+ if (!s -> noheader ) {
465
+ s -> noheader = -1 ; /* write the trailer only once! */
466
+ }
467
+ if (s -> pending == 0 ) {
468
+ Assert (s -> bi_valid == 0 , "bi_buf not flushed" );
469
+ return Z_STREAM_END ;
470
+ }
471
+ return Z_OK ;
465
472
}
466
473
467
474
/* ========================================================================= */
You can’t perform that action at this time.
0 commit comments