Apply r6972 from my other copy of deflate.c: don't lose the BFINAL bit
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 3 May 2012 17:57:31 +0000 (17:57 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 3 May 2012 17:57:31 +0000 (17:57 +0000)
on an uncompressed block.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@9482 cda61777-01e9-0310-a592-d414129be87e

deflate.c

index 5bb3cce..d614c37 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -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:
            /*