diff options
Diffstat (limited to 'inflate.c')
-rw-r--r-- | inflate.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -97,7 +97,7 @@ local int updatewindow OF((z_streamp strm, unsigned out)); | |||
97 | #ifdef BUILDFIXED | 97 | #ifdef BUILDFIXED |
98 | void makefixed OF((void)); | 98 | void makefixed OF((void)); |
99 | #endif | 99 | #endif |
100 | local unsigned syncsearch OF((unsigned *have, unsigned char FAR *buf, | 100 | local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, |
101 | unsigned len)); | 101 | unsigned len)); |
102 | 102 | ||
103 | int ZEXPORT inflateReset(strm) | 103 | int ZEXPORT inflateReset(strm) |
@@ -134,11 +134,11 @@ int stream_size; | |||
134 | return Z_VERSION_ERROR; | 134 | return Z_VERSION_ERROR; |
135 | if (strm == Z_NULL) return Z_STREAM_ERROR; | 135 | if (strm == Z_NULL) return Z_STREAM_ERROR; |
136 | strm->msg = Z_NULL; /* in case we return an error */ | 136 | strm->msg = Z_NULL; /* in case we return an error */ |
137 | if (strm->zalloc == Z_NULL) { | 137 | if (strm->zalloc == (alloc_func)0) { |
138 | strm->zalloc = zcalloc; | 138 | strm->zalloc = zcalloc; |
139 | strm->opaque = (voidpf)0; | 139 | strm->opaque = (voidpf)0; |
140 | } | 140 | } |
141 | if (strm->zfree == Z_NULL) strm->zfree = zcfree; | 141 | if (strm->zfree == (free_func)0) strm->zfree = zcfree; |
142 | state = (struct inflate_state FAR *) | 142 | state = (struct inflate_state FAR *) |
143 | ZALLOC(strm, 1, sizeof(struct inflate_state)); | 143 | ZALLOC(strm, 1, sizeof(struct inflate_state)); |
144 | if (state == Z_NULL) return Z_MEM_ERROR; | 144 | if (state == Z_NULL) return Z_MEM_ERROR; |
@@ -559,6 +559,7 @@ int flush; | |||
559 | return Z_STREAM_ERROR; | 559 | return Z_STREAM_ERROR; |
560 | 560 | ||
561 | state = (struct inflate_state FAR *)strm->state; | 561 | state = (struct inflate_state FAR *)strm->state; |
562 | if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ | ||
562 | LOAD(); | 563 | LOAD(); |
563 | in = have; | 564 | in = have; |
564 | out = left; | 565 | out = left; |
@@ -709,6 +710,8 @@ int flush; | |||
709 | strm->adler = state->check = adler32(0L, Z_NULL, 0); | 710 | strm->adler = state->check = adler32(0L, Z_NULL, 0); |
710 | state->mode = TYPE; | 711 | state->mode = TYPE; |
711 | case TYPE: | 712 | case TYPE: |
713 | if (flush == Z_BLOCK) goto inf_leave; | ||
714 | case TYPEDO: | ||
712 | if (state->last) { | 715 | if (state->last) { |
713 | BYTEBITS(); | 716 | BYTEBITS(); |
714 | state->mode = CHECK; | 717 | state->mode = CHECK; |
@@ -1071,6 +1074,8 @@ int flush; | |||
1071 | if (state->wrap && out) | 1074 | if (state->wrap && out) |
1072 | strm->adler = state->check = | 1075 | strm->adler = state->check = |
1073 | UPDATE(state->check, strm->next_out - out, out); | 1076 | UPDATE(state->check, strm->next_out - out, out); |
1077 | strm->data_type = state->bits + (state->last ? 8 : 0) + | ||
1078 | (state->mode == TYPE ? 16 : 0); | ||
1074 | if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) | 1079 | if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) |
1075 | ret = Z_BUF_ERROR; | 1080 | ret = Z_BUF_ERROR; |
1076 | return ret; | 1081 | return ret; |
@@ -1080,7 +1085,7 @@ int ZEXPORT inflateEnd(strm) | |||
1080 | z_streamp strm; | 1085 | z_streamp strm; |
1081 | { | 1086 | { |
1082 | struct inflate_state FAR *state; | 1087 | struct inflate_state FAR *state; |
1083 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == Z_NULL) | 1088 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) |
1084 | return Z_STREAM_ERROR; | 1089 | return Z_STREAM_ERROR; |
1085 | state = (struct inflate_state FAR *)strm->state; | 1090 | state = (struct inflate_state FAR *)strm->state; |
1086 | if (state->window != Z_NULL) ZFREE(strm, state->window); | 1091 | if (state->window != Z_NULL) ZFREE(strm, state->window); |
@@ -1233,7 +1238,7 @@ z_streamp source; | |||
1233 | 1238 | ||
1234 | /* check input */ | 1239 | /* check input */ |
1235 | if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || | 1240 | if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || |
1236 | source->zalloc == Z_NULL || source->zfree == Z_NULL) | 1241 | source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) |
1237 | return Z_STREAM_ERROR; | 1242 | return Z_STREAM_ERROR; |
1238 | state = (struct inflate_state FAR *)source->state; | 1243 | state = (struct inflate_state FAR *)source->state; |
1239 | 1244 | ||