9 #define DONE INFLATE_DONE
10 #define BAD INFLATE_BAD
30 struct internal_state {
59 z->total_in = z->total_out = 0;
63 Tracev((stderr,
"inflate: reset\n"));
73 if (z->state->blocks !=
Z_NULL)
77 Tracev((stderr,
"inflate: end\n"));
102 if ((z->state = (
struct internal_state
FAR *)
105 z->state->blocks =
Z_NULL;
108 z->state->nowrap = 0;
112 z->state->nowrap = 1;
121 z->state->wbits = (
uInt)w;
124 if ((z->state->blocks =
131 Tracev((stderr,
"inflate: allocated\n"));
141 #define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
144 #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
158 while (1)
switch (z->state->mode)
164 z->state->mode =
BAD;
165 z->msg = (
char*)
"unknown compression method";
166 z->state->sub.marker = 5;
169 if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
171 z->state->mode =
BAD;
172 z->msg = (
char*)
"invalid window size";
173 z->state->sub.marker = 5;
176 z->state->mode =
FLAG;
180 if (((z->state->sub.method << 8) +
b) % 31)
182 z->state->mode =
BAD;
183 z->msg = (
char*)
"incorrect header check";
184 z->state->sub.marker = 5;
187 Tracev((stderr,
"inflate: zlib header ok\n"));
193 z->state->mode =
DICT4;
197 z->state->mode =
DICT3;
201 z->state->mode =
DICT2;
205 z->state->mode =
DICT1;
209 z->adler = z->state->sub.check.need;
210 z->state->mode =
DICT0;
213 z->state->mode =
BAD;
214 z->msg = (
char*)
"need dictionary";
215 z->state->sub.marker = 0;
221 z->state->mode =
BAD;
222 z->state->sub.marker = 0;
231 if (z->state->nowrap)
233 z->state->mode =
DONE;
253 if (z->state->sub.check.was != z->state->sub.check.need)
255 z->state->mode =
BAD;
256 z->msg = (
char*)
"incorrect data check";
257 z->state->sub.marker = 5;
260 Tracev((stderr,
"inflate: zlib check ok\n"));
261 z->state->mode =
DONE;
269 #ifdef NEED_DUMMY_RETURN
local void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLongf *c)
local int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
struct inflate_blocks_state FAR inflate_blocks_statef
local inflate_blocks_statef * inflate_blocks_new(z_streamp z, check_func c, uInt w)
int ZEXPORT inflateEnd(z_streamp strm)
void zcfree(voidpf opaque, voidpf ptr)
int const char int stream_size
#define ZFREE(strm, addr)
#define ZALLOC(strm, items, size)
int ZEXPORT inflate(z_streamp strm, int flush)
local int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size)
int ZEXPORT inflateReset(z_streamp strm)
voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble b
GLint GLint GLint GLint z
GLint GLint GLint GLint GLint w
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)