12 # pragma message("Assembler code may have bugs -- use at your own risk")
55 z_const
unsigned char FAR *
in;
56 z_const
unsigned char FAR *
last;
57 unsigned char FAR *out;
58 unsigned char FAR *beg;
59 unsigned char FAR *end;
69 code const FAR *lcode;
70 code const FAR *dcode;
78 unsigned char FAR *from;
83 last = in + (strm->avail_in - 5);
85 beg = out - (start - strm->avail_out);
86 end = out + (strm->avail_out - 257);
98 lmask = (1U << state->
lenbits) - 1;
105 hold += (
unsigned long)(*in++) <<
bits;
107 hold += (
unsigned long)(*in++) <<
bits;
110 here = lcode[hold & lmask];
112 op = (unsigned)(here.
bits);
115 op = (unsigned)(here.
op);
118 "inflate: literal '%c'\n" :
119 "inflate: literal 0x%02x\n", here.
val));
120 *out++ = (
unsigned char)(here.
val);
123 len = (unsigned)(here.
val);
127 hold += (
unsigned long)(*in++) <<
bits;
130 len += (unsigned)hold & ((1U << op) - 1);
134 Tracevv((stderr,
"inflate: length %u\n", len));
136 hold += (
unsigned long)(*in++) <<
bits;
138 hold += (
unsigned long)(*in++) <<
bits;
141 here = dcode[hold & dmask];
143 op = (unsigned)(here.
bits);
146 op = (unsigned)(here.
op);
148 dist = (unsigned)(here.
val);
151 hold += (
unsigned long)(*in++) <<
bits;
154 hold += (
unsigned long)(*in++) <<
bits;
158 dist += (unsigned)hold & ((1U << op) - 1);
159 #ifdef INFLATE_STRICT
161 strm->msg = (
char *)
"invalid distance too far back";
168 Tracevv((stderr,
"inflate: distance %u\n", dist));
169 op = (unsigned)(out - beg);
175 (
char *)
"invalid distance too far back";
179 #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
180 if (len <= op - whave) {
189 }
while (--op > whave);
210 else if (wnext < op) {
211 from += wsize + wnext - op;
266 else if ((op & 64) == 0) {
267 here = dcode[here.
val + (hold & ((1U << op) - 1))];
271 strm->msg = (
char *)
"invalid distance code";
276 else if ((op & 64) == 0) {
277 here = lcode[here.
val + (hold & ((1U << op) - 1))];
281 Tracevv((stderr,
"inflate: end of block\n"));
286 strm->msg = (
char *)
"invalid literal/length code";
290 }
while (in < last && out < end);
296 hold &= (1U <<
bits) - 1;
300 strm->next_out = out;
301 strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in -
last));
302 strm->avail_out = (unsigned)(out < end ?
303 257 + (end - out) : 257 - (out - end));