summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2004-08-13 05:38:44 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2004-08-13 05:38:44 +0000
commitd5a0b816a058d9ffb3a6285778e9fec1217fff74 (patch)
tree82d3a95a16949dca7b66a2dd36f2b53c7067457e /gnu/usr.bin
parent390d6839be6db80195ccea881723bb86c7d49711 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/gzip/inflate.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gnu/usr.bin/gzip/inflate.c b/gnu/usr.bin/gzip/inflate.c
index c9b250b3bd61..82b15704254a 100644
--- a/gnu/usr.bin/gzip/inflate.c
+++ b/gnu/usr.bin/gzip/inflate.c
@@ -360,6 +360,7 @@ int *m; /* maximum lookup bits, returns actual */
if ((j = *p++) != 0)
v[x[j]++] = i;
} while (++i < n);
+ n = x[g]; /* set n to length of v */
/* Generate the Huffman codes and for each, make the table entries */
@@ -390,12 +391,13 @@ int *m; /* maximum lookup bits, returns actual */
{ /* too few codes for k-w bit table */
f -= a + 1; /* deduct codes from patterns left */
xp = c + k;
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
+ if (j < z)
+ while (++j < z) /* try smaller tables up to z bits */
+ {
+ if ((f <<= 1) <= *++xp)
+ break; /* enough codes to use up j bits */
+ f -= *xp; /* else deduct codes from patterns */
+ }
}
z = 1 << j; /* table entries for j-bit table */