12 " inflate9 1.2.8 Copyright 1995-2013 Mark Adler ";
34 unsigned short FAR *lens;
38 unsigned short FAR *work;
55 const unsigned short FAR *base;
56 const unsigned short FAR *extra;
60 static const unsigned short lbase[31] = {
61 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
62 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
63 131, 163, 195, 227, 3, 0, 0};
64 static const unsigned short lext[31] = {
65 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
67 133, 133, 133, 133, 144, 72, 78};
68 static const unsigned short dbase[32] = {
69 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
71 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
72 static const unsigned short dext[32] = {
73 128, 128, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
74 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138,
75 139, 139, 140, 140, 141, 141, 142, 142};
109 for (len = 0; len <=
MAXBITS; len++)
111 for (sym = 0; sym <
codes; sym++)
116 for (max =
MAXBITS; max >= 1; max--)
117 if (count[max] != 0)
break;
118 if (root > max) root =
max;
119 if (max == 0)
return -1;
120 for (min = 1; min <=
MAXBITS; min++)
121 if (count[min] != 0)
break;
122 if (root < min) root =
min;
126 for (len = 1; len <=
MAXBITS; len++) {
129 if (left < 0)
return -1;
131 if (left > 0 && (
type ==
CODES || max != 1))
136 for (len = 1; len <
MAXBITS; len++)
137 offs[len + 1] = offs[len] + count[len];
140 for (sym = 0; sym <
codes; sym++)
141 if (lens[sym] != 0) work[offs[lens[sym]]++] = (
unsigned short)sym;
200 low = (unsigned)(-1);
212 this.
bits = (
unsigned char)(len - drop);
213 if ((
int)(work[sym]) < end) {
214 this.op = (
unsigned char)0;
215 this.
val = work[sym];
217 else if ((
int)(work[sym]) > end) {
218 this.op = (
unsigned char)(extra[work[sym]]);
219 this.
val = base[work[sym]];
222 this.op = (
unsigned char)(32 + 64);
227 incr = 1U << (len - drop);
231 next[(huff >> drop) + fill] =
this;
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);
292 this.op = (
unsigned char)64;
293 this.
bits = (
unsigned char)(len - drop);
294 this.
val = (
unsigned short)0;
297 if (drop != 0 && (huff & mask) != low) {
302 this.
bits = (
unsigned char)len;
306 next[huff >> drop] =
this;
309 incr = 1U << (len - 1);
int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
float min(float a, float b)
GLuint GLuint GLsizei count
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
local int codes(struct state *s, const struct huffman *lencode, const struct huffman *distcode)
GLenum GLsizei GLenum GLenum const GLvoid * table
const char inflate9_copyright[]