26 # define PUP(a) *(a)++ 29 # define PUP(a) *++(a) 72 unsigned char FAR *in;
73 unsigned char FAR *
last;
74 unsigned char FAR *out;
75 unsigned char FAR *beg;
76 unsigned char FAR *end;
86 code const FAR *lcode;
87 code const FAR *dcode;
95 unsigned char FAR *from;
99 in = strm->next_in -
OFF;
100 last = in + (strm->avail_in - 5);
101 out = strm->next_out -
OFF;
102 beg = out - (start - strm->avail_out);
103 end = out + (strm->avail_out - 257);
104 #ifdef INFLATE_STRICT 107 wsize = state->
wsize;
108 whave = state->
whave;
109 write = state->
write;
115 lmask = (1U << state->
lenbits) - 1;
116 dmask = (1U << state->
distbits) - 1;
122 hold += (
unsigned long)(
PUP(in)) << bits;
124 hold += (
unsigned long)(
PUP(in)) << bits;
127 this = lcode[hold & lmask];
129 op = (unsigned)(this.bits);
132 op = (unsigned)(this.op);
135 "inflate: literal '%c'\n" :
136 "inflate: literal 0x%02x\n", this.
val));
137 PUP(out) = (
unsigned char)(this.
val);
140 len = (unsigned)(this.
val);
144 hold += (
unsigned long)(
PUP(in)) << bits;
147 len += (unsigned)hold & ((1U << op) - 1);
151 Tracevv((stderr,
"inflate: length %u\n", len));
153 hold += (
unsigned long)(
PUP(in)) << bits;
155 hold += (
unsigned long)(
PUP(in)) << bits;
158 this = dcode[hold & dmask];
160 op = (unsigned)(this.bits);
163 op = (unsigned)(this.op);
165 dist = (unsigned)(this.
val);
168 hold += (
unsigned long)(
PUP(in)) << bits;
171 hold += (
unsigned long)(
PUP(in)) << bits;
175 dist += (unsigned)hold & ((1U << op) - 1);
176 #ifdef INFLATE_STRICT 178 strm->msg = (
char *)
"invalid distance too far back";
185 Tracevv((stderr,
"inflate: distance %u\n", dist));
186 op = (unsigned)(out - beg);
190 strm->msg = (
char *)
"invalid distance too far back";
205 else if (write < op) {
206 from += wsize + write - op;
261 else if ((op & 64) == 0) {
262 this = dcode[this.
val + (hold & ((1U << op) - 1))];
266 strm->msg = (
char *)
"invalid distance code";
271 else if ((op & 64) == 0) {
272 this = lcode[this.
val + (hold & ((1U << op) - 1))];
276 Tracevv((stderr,
"inflate: end of block\n"));
281 strm->msg = (
char *)
"invalid literal/length code";
285 }
while (in < last && out < end);
291 hold &= (1U <<
bits) - 1;
294 strm->next_in = in +
OFF;
295 strm->next_out = out +
OFF;
296 strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in -
last));
297 strm->avail_out = (unsigned)(out < end ?
298 257 + (end - out) : 257 - (out - end));
code const FAR * distcode
unsigned char FAR * window
void inflate_fast(z_streamp strm, unsigned start)