259 unsigned char FAR *put;
264 unsigned char FAR *from;
269 static const unsigned short order[19] =
270 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
291 switch (state->
mode) {
304 Tracev((stderr,
"inflate: stored block%s\n",
305 state->
last ?
" (last)" :
""));
310 Tracev((stderr,
"inflate: fixed codes block%s\n",
311 state->
last ?
" (last)" :
""));
315 Tracev((stderr,
"inflate: dynamic codes block%s\n",
316 state->
last ?
" (last)" :
""));
320 strm->
msg = (
char *)
"invalid block type";
330 if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
331 strm->
msg = (
char *)
"invalid stored block lengths";
335 state->
length = (unsigned)hold & 0xffff;
336 Tracev((stderr,
"inflate: stored length %u\n",
341 while (state->
length != 0) {
345 if (copy > have) copy =
have;
346 if (copy > left) copy = left;
354 Tracev((stderr,
"inflate: stored end\n"));
367 #ifndef PKZIP_BUG_WORKAROUND 368 if (state->
nlen > 286 || state->
ndist > 30) {
369 strm->
msg = (
char *)
"too many length or distance symbols";
374 Tracev((stderr,
"inflate: table sizes ok\n"));
380 state->
lens[order[state->
have++]] = (
unsigned short)
BITS(3);
383 while (state->
have < 19)
384 state->
lens[order[state->
have++]] = 0;
391 strm->
msg = (
char *)
"invalid code lengths set";
395 Tracev((stderr,
"inflate: code lengths ok\n"));
402 if ((
unsigned)(here.
bits) <= bits)
break;
410 if (here.
val == 16) {
413 if (state->
have == 0) {
414 strm->
msg = (
char *)
"invalid bit length repeat";
418 len = (unsigned)(state->
lens[state->
have - 1]);
422 else if (here.
val == 17) {
437 strm->
msg = (
char *)
"invalid bit length repeat";
442 state->
lens[state->
have++] = (
unsigned short)len;
450 if (state->
lens[256] == 0) {
451 strm->
msg = (
char *)
"invalid code -- missing end-of-block";
465 strm->
msg = (
char *)
"invalid literal/lengths set";
474 strm->
msg = (
char *)
"invalid distances set";
478 Tracev((stderr,
"inflate: codes ok\n"));
483 if (have >= 6 && left >= 258) {
495 if ((
unsigned)(here.
bits) <= bits)
break;
498 if (here.
op && (here.
op & 0xf0) == 0) {
503 if ((
unsigned)(last.
bits + here.
bits) <= bits)
break;
514 "inflate: literal '%c'\n" :
515 "inflate: literal 0x%02x\n", here.
val));
517 *put++ = (
unsigned char)(state->
length);
525 Tracevv((stderr,
"inflate: end of block\n"));
532 strm->
msg = (
char *)
"invalid literal/length code";
538 state->
extra = (unsigned)(here.
op) & 15;
539 if (state->
extra != 0) {
549 if ((
unsigned)(here.
bits) <= bits)
break;
552 if ((here.
op & 0xf0) == 0) {
557 if ((
unsigned)(last.
bits + here.
bits) <= bits)
break;
564 strm->
msg = (
char *)
"invalid distance code";
571 state->
extra = (
unsigned)(here.
op) & 15;
572 if (state->
extra != 0) {
579 strm->
msg = (
char *)
"invalid distance too far back";
594 from = put - state->
offset;
603 }
while (state->
length != 0);
609 if (left < state->
wsize) {
610 if (out(out_desc, state->
window, state->
wsize - left))
unsigned nlen
Definition: inflate.h:112
unsigned short val
Definition: inftrees.h:27
Bytef * next_in
Definition: zlib.h:86
void zmemcpy(Bytef *dest, const Bytef *source, uInt len)
Definition: zutil.c:152
unsigned ndist
Definition: inflate.h:113
#define DROPBITS(n)
Definition: infback.c:194
unsigned wsize
Definition: inflate.h:93
unsigned have
Definition: inflate.h:114
uInt avail_in
Definition: zlib.h:87
unsigned distbits
Definition: inflate.h:109
unsigned extra
Definition: inflate.h:104
Definition: inftrees.h:57
code const FAR * distcode
Definition: inflate.h:107
int last
Definition: inflate.h:83
#define Tracev(x)
Definition: zutil.h:232
char * msg
Definition: zlib.h:94
unsigned char op
Definition: inftrees.h:25
#define Z_STREAM_ERROR
Definition: zlib.h:177
#define LOAD()
Definition: infback.c:128
unsigned lenbits
Definition: inflate.h:108
unsigned short lens[320]
Definition: inflate.h:116
#define z_const
Definition: zconf.h:224
#define INITBITS()
Definition: infback.c:150
#define PULLBYTE()
Definition: infback.c:172
#define NEEDBITS(n)
Definition: infback.c:183
unsigned ncode
Definition: inflate.h:111
int inflate_table(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
Definition: inftrees.c:32
code FAR * next
Definition: inflate.h:115
code codes[ENOUGH]
Definition: inflate.h:118
unsigned long hold
Definition: inflate.h:98
Definition: inftrees.h:55
#define Z_DATA_ERROR
Definition: zlib.h:178
#define ROOM()
Definition: infback.c:210
#define Z_STREAM_END
Definition: zlib.h:174
#define FAR
Definition: jmorecfg.h:215
unsigned short work[288]
Definition: inflate.h:117
unsigned char bits
Definition: inftrees.h:26
#define RESTORE()
Definition: infback.c:139
#define BITS(n)
Definition: infback.c:190
Definition: inftrees.h:24
unsigned bits
Definition: inflate.h:99
#define Z_BUF_ERROR
Definition: zlib.h:180
unsigned char FAR * window
Definition: inflate.h:96
inflate_mode mode
Definition: inflate.h:82
Definition: inftrees.h:56
static void fixedtables(struct inflate_state FAR *state)
Definition: infback.c:82
#define PULL()
Definition: infback.c:158
void inflate_fast(z_streamp strm, unsigned start)
Definition: inffast.c:67
struct internal_state * state
Definition: zlib.h:95
#define Z_NULL
Definition: zlib.h:208
unsigned whave
Definition: inflate.h:94
unsigned offset
Definition: inflate.h:102
#define BYTEBITS()
Definition: infback.c:201
code const FAR * lencode
Definition: inflate.h:106
#define Tracevv(x)
Definition: zutil.h:233
unsigned length
Definition: inflate.h:101