12 " inflate 1.3.1 Copyright 1995-2024 Mark Adler ";
34 unsigned FAR *bits,
unsigned short FAR *work) {
50 const unsigned short FAR *base;
51 const unsigned short FAR *extra;
53 unsigned short count[
MAXBITS+1];
55 static const unsigned short lbase[31] = {
56 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
57 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
58 static const unsigned short lext[31] = {
59 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
60 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
61 static const unsigned short dbase[32] = {
62 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
63 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
64 8193, 12289, 16385, 24577, 0, 0};
65 static const unsigned short dext[32] = {
66 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
67 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
68 28, 28, 29, 29, 64, 64};
102 for (len = 0; len <=
MAXBITS; len++)
104 for (sym = 0; sym < codes; sym++)
109 for (max =
MAXBITS; max >= 1; max--)
110 if (count[max] != 0)
break;
111 if (root > max) root =
max;
113 here.
op = (
unsigned char)64;
114 here.
bits = (
unsigned char)1;
115 here.
val = (
unsigned short)0;
121 for (min = 1; min <
max; min++)
122 if (count[min] != 0)
break;
123 if (root < min) root =
min;
127 for (len = 1; len <=
MAXBITS; len++) {
130 if (left < 0)
return -1;
132 if (left > 0 && (type ==
CODES || max != 1))
137 for (len = 1; len <
MAXBITS; len++)
138 offs[len + 1] = offs[len] + count[len];
141 for (sym = 0; sym < codes; sym++)
142 if (lens[sym] != 0) work[offs[lens[sym]]++] = (
unsigned short)sym;
199 low = (unsigned)(-1);
211 here.
bits = (
unsigned char)(len - drop);
212 if (work[sym] + 1U < match) {
213 here.
op = (
unsigned char)0;
214 here.
val = work[sym];
216 else if (work[sym] >= match) {
217 here.
op = (
unsigned char)(extra[work[sym] - match]);
218 here.
val = base[work[sym] - match];
221 here.
op = (
unsigned char)(32 + 64);
226 incr = 1U << (len - drop);
231 next[(huff >> drop) + fill] = here;
235 incr = 1U << (len - 1);
247 if (--(count[len]) == 0) {
248 if (len == max)
break;
249 len = lens[work[sym]];
253 if (len > root && (huff & mask) != low) {
263 left = (
int)(1 << curr);
264 while (curr + drop < max) {
265 left -= count[curr + drop];
266 if (left <= 0)
break;
279 (*table)[low].op = (
unsigned char)curr;
280 (*table)[low].bits = (
unsigned char)root;
281 (*table)[low].val = (
unsigned short)(next - *table);
289 here.
op = (
unsigned char)64;
290 here.
bits = (
unsigned char)(len - drop);
291 here.
val = (
unsigned short)0;
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
constexpr const _Tp & max(const _Tp &a, const _Tp &b)
int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
const char inflate_copyright[]
constexpr const _Tp & min(const _Tp &a, const _Tp &b)