summaryrefslogtreecommitdiff
path: root/inftrees.c
diff options
context:
space:
mode:
Diffstat (limited to 'inftrees.c')
-rw-r--r--inftrees.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/inftrees.c b/inftrees.c
index 4ae6502..fb8d843 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -9,7 +9,7 @@
9#define MAXBITS 15 9#define MAXBITS 15
10 10
11const char inflate_copyright[] = 11const char inflate_copyright[] =
12 " inflate 1.2.3.2 Copyright 1995-2006 Mark Adler "; 12 " inflate 1.2.3.3 Copyright 1995-2006 Mark Adler ";
13/* 13/*
14 If you use the zlib library in a product, an acknowledgment is welcome 14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot 15 in the documentation of your product. If for some reason you cannot
@@ -50,7 +50,7 @@ unsigned short FAR *work;
50 unsigned fill; /* index for replicating entries */ 50 unsigned fill; /* index for replicating entries */
51 unsigned low; /* low bits for current root entry */ 51 unsigned low; /* low bits for current root entry */
52 unsigned mask; /* mask for low root bits */ 52 unsigned mask; /* mask for low root bits */
53 code this; /* table entry for duplication */ 53 code here; /* table entry for duplication */
54 code FAR *next; /* next available space in table */ 54 code FAR *next; /* next available space in table */
55 const unsigned short FAR *base; /* base value table to use */ 55 const unsigned short FAR *base; /* base value table to use */
56 const unsigned short FAR *extra; /* extra bits table to use */ 56 const unsigned short FAR *extra; /* extra bits table to use */
@@ -62,7 +62,7 @@ unsigned short FAR *work;
62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; 62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 204}; 65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 203};
66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -115,11 +115,11 @@ unsigned short FAR *work;
115 if (count[max] != 0) break; 115 if (count[max] != 0) break;
116 if (root > max) root = max; 116 if (root > max) root = max;
117 if (max == 0) { /* no symbols to code at all */ 117 if (max == 0) { /* no symbols to code at all */
118 this.op = (unsigned char)64; /* invalid code marker */ 118 here.op = (unsigned char)64; /* invalid code marker */
119 this.bits = (unsigned char)1; 119 here.bits = (unsigned char)1;
120 this.val = (unsigned short)0; 120 here.val = (unsigned short)0;
121 *(*table)++ = this; /* make a table to force an error */ 121 *(*table)++ = here; /* make a table to force an error */
122 *(*table)++ = this; 122 *(*table)++ = here;
123 *bits = 1; 123 *bits = 1;
124 return 0; /* no symbols, but wait for decoding to report error */ 124 return 0; /* no symbols, but wait for decoding to report error */
125 } 125 }
@@ -215,18 +215,18 @@ unsigned short FAR *work;
215 /* process all codes and make table entries */ 215 /* process all codes and make table entries */
216 for (;;) { 216 for (;;) {
217 /* create table entry */ 217 /* create table entry */
218 this.bits = (unsigned char)(len - drop); 218 here.bits = (unsigned char)(len - drop);
219 if ((int)(work[sym]) < end) { 219 if ((int)(work[sym]) < end) {
220 this.op = (unsigned char)0; 220 here.op = (unsigned char)0;
221 this.val = work[sym]; 221 here.val = work[sym];
222 } 222 }
223 else if ((int)(work[sym]) > end) { 223 else if ((int)(work[sym]) > end) {
224 this.op = (unsigned char)(extra[work[sym]]); 224 here.op = (unsigned char)(extra[work[sym]]);
225 this.val = base[work[sym]]; 225 here.val = base[work[sym]];
226 } 226 }
227 else { 227 else {
228 this.op = (unsigned char)(32 + 64); /* end of block */ 228 here.op = (unsigned char)(32 + 64); /* end of block */
229 this.val = 0; 229 here.val = 0;
230 } 230 }
231 231
232 /* replicate for those indices with low len bits equal to huff */ 232 /* replicate for those indices with low len bits equal to huff */
@@ -235,7 +235,7 @@ unsigned short FAR *work;
235 min = fill; /* save offset to next table */ 235 min = fill; /* save offset to next table */
236 do { 236 do {
237 fill -= incr; 237 fill -= incr;
238 next[(huff >> drop) + fill] = this; 238 next[(huff >> drop) + fill] = here;
239 } while (fill != 0); 239 } while (fill != 0);
240 240
241 /* backwards increment the len-bit code huff */ 241 /* backwards increment the len-bit code huff */
@@ -295,20 +295,20 @@ unsigned short FAR *work;
295 through high index bits. When the current sub-table is filled, the loop 295 through high index bits. When the current sub-table is filled, the loop
296 drops back to the root table to fill in any remaining entries there. 296 drops back to the root table to fill in any remaining entries there.
297 */ 297 */
298 this.op = (unsigned char)64; /* invalid code marker */ 298 here.op = (unsigned char)64; /* invalid code marker */
299 this.bits = (unsigned char)(len - drop); 299 here.bits = (unsigned char)(len - drop);
300 this.val = (unsigned short)0; 300 here.val = (unsigned short)0;
301 while (huff != 0) { 301 while (huff != 0) {
302 /* when done with sub-table, drop back to root table */ 302 /* when done with sub-table, drop back to root table */
303 if (drop != 0 && (huff & mask) != low) { 303 if (drop != 0 && (huff & mask) != low) {
304 drop = 0; 304 drop = 0;
305 len = root; 305 len = root;
306 next = *table; 306 next = *table;
307 this.bits = (unsigned char)len; 307 here.bits = (unsigned char)len;
308 } 308 }
309 309
310 /* put invalid code marker in table */ 310 /* put invalid code marker in table */
311 next[huff >> drop] = this; 311 next[huff >> drop] = here;
312 312
313 /* backwards increment the len-bit code huff */ 313 /* backwards increment the len-bit code huff */
314 incr = 1U << (len - 1); 314 incr = 1U << (len - 1);