diff options
| author | Simon Tatham <anakin@pobox.com> | 2012-05-03 17:57:31 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2012-05-03 17:57:31 +0000 |
| commit | 5473e446fa34a6fe9229f29fc748ac9d08fb87bc (patch) | |
| tree | d0fb32b79721df5ed59893bdc1f83752b5e0800f | |
| parent | 689093cc870e60ab82a176c33613fa0aeaa0bf69 (diff) | |
| download | halibut-5473e446fa34a6fe9229f29fc748ac9d08fb87bc.zip halibut-5473e446fa34a6fe9229f29fc748ac9d08fb87bc.tar.gz halibut-5473e446fa34a6fe9229f29fc748ac9d08fb87bc.tar.bz2 halibut-5473e446fa34a6fe9229f29fc748ac9d08fb87bc.tar.xz | |
Apply r6972 from my other copy of deflate.c: don't lose the BFINAL bit
on an uncompressed block.
[originally from svn r9482]
[r6972 == 37af901cfe63ed062306e3835751e9b8e089e252 in misc repository]
| -rw-r--r-- | deflate.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -2447,9 +2447,12 @@ int deflate_decompress_data(deflate_decompress_ctx *dctx, error = DEFLATE_ERR_UNCOMP_HDR; goto finished; } - if (dctx->uncomplen == 0) - dctx->state = OUTSIDEBLK; /* block is empty */ - else + if (dctx->uncomplen == 0) {/* block is empty */ + if (dctx->lastblock) + dctx->state = END; + else + dctx->state = OUTSIDEBLK; + } else dctx->state = UNCOMP_DATA; break; case UNCOMP_DATA: @@ -2462,8 +2465,12 @@ int deflate_decompress_data(deflate_decompress_ctx *dctx, #endif emit_char(dctx, dctx->bits & 0xFF); EATBITS(8); - if (--dctx->uncomplen == 0) - dctx->state = OUTSIDEBLK; /* end of uncompressed block */ + if (--dctx->uncomplen == 0) { /* end of uncompressed block */ + if (dctx->lastblock) + dctx->state = END; + else + dctx->state = OUTSIDEBLK; + } break; case END: /* |