summaryrefslogtreecommitdiff
path: root/lib/libz/infblock.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libz/infblock.c')
-rw-r--r--lib/libz/infblock.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libz/infblock.c b/lib/libz/infblock.c
index f4920faa5ea06..17943ab7939b9 100644
--- a/lib/libz/infblock.c
+++ b/lib/libz/infblock.c
@@ -11,10 +11,6 @@
struct inflate_codes_state {int dummy;}; /* for buggy compilers */
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
/* Table for deflate from PKZIP's appnote.txt. */
local const uInt border[] = { /* Order of the bit length code lengths */
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
@@ -268,8 +264,8 @@ int r;
t = s->sub.trees.bb;
NEEDBITS(t)
h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
- t = h->bits;
- c = h->base;
+ t = h->word.what.Bits;
+ c = h->more.Base;
if (c < 16)
{
DUMPBITS(t)
@@ -345,6 +341,13 @@ int r;
s->mode = TYPE;
break;
}
+ if (k > 7) /* return unused byte, if any */
+ {
+ Assert(k < 16, "inflate_codes grabbed too many bytes")
+ k -= 8;
+ n++;
+ p--; /* can always return one */
+ }
s->mode = DRY;
case DRY:
FLUSH