21 unsigned char FAR *window;
33 if (strm->zalloc == (alloc_func)0) {
37 if (strm->zfree == (free_func)0) strm->zfree =
zcfree;
41 Tracev((stderr,
"inflate: allocated\n"));
42 strm->state = (
voidpf)state;
63 while (sym < 144) state.
lens[sym++] = 8;
64 while (sym < 256) state.
lens[sym++] = 9;
65 while (sym < 280) state.
lens[sym++] = 7;
66 while (sym < 288) state.
lens[sym++] = 8;
74 while (sym < 32) state.
lens[sym++] = 5;
80 puts(
" /* inffix9.h -- table for decoding deflate64 fixed codes");
81 puts(
" * Generated automatically by makefixed9().");
84 puts(
" /* WARNING: this file should *not* be used by applications.");
85 puts(
" It is part of the implementation of this library and is");
86 puts(
" subject to change. Applications should only use zlib.h.");
90 printf(
" static const code lenfix[%u] = {", size);
93 if ((low % 6) == 0) printf(
"\n ");
94 printf(
"{%u,%u,%d}", lenfix[low].op, lenfix[low].bits,
96 if (++low == size)
break;
101 printf(
"\n static const code distfix[%u] = {", size);
104 if ((low % 5) == 0) printf(
"\n ");
105 printf(
"{%u,%u,%d}", distfix[low].op, distfix[low].bits,
107 if (++low == size)
break;
128 have = in(in_desc, &next); \ 143 hold += (unsigned long)(*next++) << bits; \ 150 #define NEEDBITS(n) \ 152 while (bits < (unsigned)(n)) \ 158 ((unsigned)hold & ((1U << (n)) - 1)) 161 #define DROPBITS(n) \ 164 bits -= (unsigned)(n); \ 183 if (out(out_desc, put, (unsigned)left)) { \ 226 unsigned char FAR *put;
232 unsigned char FAR *
window;
239 unsigned char FAR *from;
248 static const unsigned short order[19] =
249 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
263 next = strm->next_in;
264 have = next !=
Z_NULL ? strm->avail_in : 0;
287 Tracev((stderr,
"inflate: stored block%s\n",
288 lastblock ?
" (last)" :
""));
296 Tracev((stderr,
"inflate: fixed codes block%s\n",
297 lastblock ?
" (last)" :
""));
301 Tracev((stderr,
"inflate: dynamic codes block%s\n",
302 lastblock ?
" (last)" :
""));
306 strm->msg = (
char *)
"invalid block type";
316 if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
317 strm->msg = (
char *)
"invalid stored block lengths";
321 length = (unsigned)hold & 0xffff;
322 Tracev((stderr,
"inflate: stored length %lu\n",
327 while (length != 0) {
331 if (copy > have) copy =
have;
332 if (copy > left) copy =
left;
340 Tracev((stderr,
"inflate: stored end\n"));
353 if (state->
nlen > 286) {
354 strm->msg = (
char *)
"too many length symbols";
358 Tracev((stderr,
"inflate: table sizes ok\n"));
364 state->
lens[order[state->
have++]] = (
unsigned short)
BITS(3);
367 while (state->
have < 19)
368 state->
lens[order[state->
have++]] = 0;
370 lencode = (
code const FAR *)(state->
next);
373 &(lenbits), state->
work);
375 strm->msg = (
char *)
"invalid code lengths set";
379 Tracev((stderr,
"inflate: code lengths ok\n"));
385 here = lencode[
BITS(lenbits)];
386 if ((
unsigned)(here.
bits) <= bits)
break;
395 if (here.
val == 16) {
398 if (state->
have == 0) {
399 strm->msg = (
char *)
"invalid bit length repeat";
403 len = (unsigned)(state->
lens[state->
have - 1]);
407 else if (here.
val == 17) {
422 strm->msg = (
char *)
"invalid bit length repeat";
427 state->
lens[state->
have++] = (
unsigned short)len;
432 if (mode ==
BAD)
break;
435 if (state->
lens[256] == 0) {
436 strm->msg = (
char *)
"invalid code -- missing end-of-block";
445 lencode = (
code const FAR *)(state->
next);
448 &(state->
next), &(lenbits), state->
work);
450 strm->msg = (
char *)
"invalid literal/lengths set";
454 distcode = (
code const FAR *)(state->
next);
457 state->
ndist, &(state->
next), &(distbits),
460 strm->msg = (
char *)
"invalid distances set";
464 Tracev((stderr,
"inflate: codes ok\n"));
470 here = lencode[
BITS(lenbits)];
471 if ((
unsigned)(here.
bits) <= bits)
break;
474 if (here.
op && (here.
op & 0xf0) == 0) {
477 here = lencode[last.
val +
479 if ((
unsigned)(last.
bits + here.
bits) <= bits)
break;
485 length = (unsigned)here.
val;
490 "inflate: literal '%c'\n" :
491 "inflate: literal 0x%02x\n", here.
val));
493 *put++ = (
unsigned char)(length);
501 Tracevv((stderr,
"inflate: end of block\n"));
508 strm->msg = (
char *)
"invalid literal/length code";
514 extra = (unsigned)(here.
op) & 31;
517 length +=
BITS(extra);
520 Tracevv((stderr,
"inflate: length %lu\n", length));
524 here = distcode[
BITS(distbits)];
525 if ((
unsigned)(here.
bits) <= bits)
break;
528 if ((here.
op & 0xf0) == 0) {
531 here = distcode[last.
val +
533 if ((
unsigned)(last.
bits + here.
bits) <= bits)
break;
540 strm->msg = (
char *)
"invalid distance code";
544 offset = (unsigned)here.
val;
547 extra = (
unsigned)(here.
op) & 15;
550 offset +=
BITS(extra);
553 if (offset >
WSIZE - (wrap ? 0: left)) {
554 strm->msg = (
char *)
"invalid distance too far back";
558 Tracevv((stderr,
"inflate: distance %lu\n", offset));
572 if (copy > length) copy =
length;
578 }
while (length != 0);
585 if (
out(out_desc, window, (
unsigned)(
WSIZE - left)))
601 strm->next_in =
next;
602 strm->avail_in =
have;
609 if (strm ==
Z_NULL || strm->state ==
Z_NULL || strm->zfree == (free_func)0)
611 ZFREE(strm, strm->state);
613 Tracev((stderr,
"inflate: end\n"));
GLenum GLuint GLenum GLsizei length
int ZEXPORT inflateBack9End(z_stream FAR *strm)
for(n=1;n< outline->n_points;n++)
#define ZALLOC(strm, items, size)
GLuint GLdouble GLdouble GLint GLint order
code const FAR * distcode
int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)
local int out(void *out_desc, unsigned char *buf, unsigned len)
void zmemcpy(Bytef *dest, const Bytef *source, uInt len)
#define ZFREE(strm, addr)
int const char int stream_size
unsigned char FAR * window
if(!abbox) return FT_THROW(Invalid_Argument)
void zcfree(voidpf opaque, voidpf ptr)
voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window, const char *version, int stream_size)
local int fixed(struct state *s)