aboutsummaryrefslogtreecommitdiff
path: root/zlib/inftrees.c
diff options
context:
space:
mode:
Diffstat (limited to 'zlib/inftrees.c')
-rw-r--r--zlib/inftrees.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/zlib/inftrees.c b/zlib/inftrees.c
index 8a9c13ff03d..ca439de86ed 100644
--- a/zlib/inftrees.c
+++ b/zlib/inftrees.c
@@ -29,13 +29,8 @@ const char inflate_copyright[] =
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
-int inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
+int inflate_table(codetype type, unsigned short FAR *lens, unsigned codes,
+ code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)
{
unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */
@@ -50,7 +45,7 @@ unsigned short FAR *work;
unsigned fill; /* index for replicating entries */
unsigned low; /* low bits for current root entry */
unsigned mask; /* mask for low root bits */
- code this; /* table entry for duplication */
+ code it; /* table entry for duplication */
code FAR *next; /* next available space in table */
const unsigned short FAR *base; /* base value table to use */
const unsigned short FAR *extra; /* extra bits table to use */
@@ -115,11 +110,11 @@ unsigned short FAR *work;
if (count[max] != 0) break;
if (root > max) root = max;
if (max == 0) { /* no symbols to code at all */
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)1;
- this.val = (unsigned short)0;
- *(*table)++ = this; /* make a table to force an error */
- *(*table)++ = this;
+ it.op = (unsigned char)64; /* invalid code marker */
+ it.bits = (unsigned char)1;
+ it.val = (unsigned short)0;
+ *(*table)++ = it; /* make a table to force an error */
+ *(*table)++ = it;
*bits = 1;
return 0; /* no symbols, but wait for decoding to report error */
}
@@ -215,18 +210,18 @@ unsigned short FAR *work;
/* process all codes and make table entries */
for (;;) {
/* create table entry */
- this.bits = (unsigned char)(len - drop);
+ it.bits = (unsigned char)(len - drop);
if ((int)(work[sym]) < end) {
- this.op = (unsigned char)0;
- this.val = work[sym];
+ it.op = (unsigned char)0;
+ it.val = work[sym];
}
else if ((int)(work[sym]) > end) {
- this.op = (unsigned char)(extra[work[sym]]);
- this.val = base[work[sym]];
+ it.op = (unsigned char)(extra[work[sym]]);
+ it.val = base[work[sym]];
}
else {
- this.op = (unsigned char)(32 + 64); /* end of block */
- this.val = 0;
+ it.op = (unsigned char)(32 + 64); /* end of block */
+ it.val = 0;
}
/* replicate for those indices with low len bits equal to huff */
@@ -235,7 +230,7 @@ unsigned short FAR *work;
min = fill; /* save offset to next table */
do {
fill -= incr;
- next[(huff >> drop) + fill] = this;
+ next[(huff >> drop) + fill] = it;
} while (fill != 0);
/* backwards increment the len-bit code huff */
@@ -295,20 +290,20 @@ unsigned short FAR *work;
through high index bits. When the current sub-table is filled, the loop
drops back to the root table to fill in any remaining entries there.
*/
- this.op = (unsigned char)64; /* invalid code marker */
- this.bits = (unsigned char)(len - drop);
- this.val = (unsigned short)0;
+ it.op = (unsigned char)64; /* invalid code marker */
+ it.bits = (unsigned char)(len - drop);
+ it.val = (unsigned short)0;
while (huff != 0) {
/* when done with sub-table, drop back to root table */
if (drop != 0 && (huff & mask) != low) {
drop = 0;
len = root;
next = *table;
- this.bits = (unsigned char)len;
+ it.bits = (unsigned char)len;
}
/* put invalid code marker in table */
- next[huff >> drop] = this;
+ next[huff >> drop] = it;
/* backwards increment the len-bit code huff */
incr = 1U << (len - 1);