diff options
Diffstat (limited to 'inftrees.c')
-rw-r--r-- | inftrees.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* inftrees.c -- generate Huffman trees for efficient decoding | 1 | /* inftrees.c -- generate Huffman trees for efficient decoding |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2004 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -9,7 +9,7 @@ | |||
9 | #define MAXBITS 15 | 9 | #define MAXBITS 15 |
10 | 10 | ||
11 | const char inflate_copyright[] = | 11 | const char inflate_copyright[] = |
12 | " inflate 1.2.1 Copyright 1995-2003 Mark Adler "; | 12 | " inflate 1.2.1.1 Copyright 1995-2004 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 |
@@ -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, 76, 66}; | 65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 202, 196}; |
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, |
@@ -114,7 +114,15 @@ unsigned short FAR *work; | |||
114 | for (max = MAXBITS; max >= 1; max--) | 114 | for (max = MAXBITS; max >= 1; max--) |
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) return -1; /* no codes! */ | 117 | if (max == 0) { /* no symbols to code at all */ |
118 | this.op = (unsigned char)64; /* invalid code marker */ | ||
119 | this.bits = (unsigned char)1; | ||
120 | this.val = (unsigned short)0; | ||
121 | *(*table)++ = this; /* make a table to force an error */ | ||
122 | *(*table)++ = this; | ||
123 | *bits = 1; | ||
124 | return 0; /* no symbols, but wait for decoding to report error */ | ||
125 | } | ||
118 | for (min = 1; min <= MAXBITS; min++) | 126 | for (min = 1; min <= MAXBITS; min++) |
119 | if (count[min] != 0) break; | 127 | if (count[min] != 0) break; |
120 | if (root < min) root = min; | 128 | if (root < min) root = min; |