From 4b5a43a219d51066c01ff2ab86af18b967f2d0dd Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Fri, 9 Sep 2011 23:22:37 -0700 Subject: zlib 1.2.0.5 --- inflate.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'inflate.c') diff --git a/inflate.c b/inflate.c index da2bb59..287efda 100644 --- a/inflate.c +++ b/inflate.c @@ -97,7 +97,7 @@ local int updatewindow OF((z_streamp strm, unsigned out)); #ifdef BUILDFIXED void makefixed OF((void)); #endif -local unsigned syncsearch OF((unsigned *have, unsigned char FAR *buf, +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateReset(strm) @@ -134,11 +134,11 @@ int stream_size; return Z_VERSION_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == Z_NULL) { + if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } - if (strm->zfree == Z_NULL) strm->zfree = zcfree; + if (strm->zfree == (free_func)0) strm->zfree = zcfree; state = (struct inflate_state FAR *) ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; @@ -559,6 +559,7 @@ int flush; return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ LOAD(); in = have; out = left; @@ -709,6 +710,8 @@ int flush; strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; case TYPE: + if (flush == Z_BLOCK) goto inf_leave; + case TYPEDO: if (state->last) { BYTEBITS(); state->mode = CHECK; @@ -1071,6 +1074,8 @@ int flush; if (state->wrap && out) strm->adler = state->check = UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 8 : 0) + + (state->mode == TYPE ? 16 : 0); if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) ret = Z_BUF_ERROR; return ret; @@ -1080,7 +1085,7 @@ int ZEXPORT inflateEnd(strm) z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == Z_NULL) + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) ZFREE(strm, state->window); @@ -1233,7 +1238,7 @@ z_streamp source; /* check input */ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == Z_NULL || source->zfree == Z_NULL) + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)source->state; -- cgit v1.2.3-55-g6feb