diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-10-07 23:00:42 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-10-07 23:13:37 -0700 |
commit | 77b47d55f14be032c0ee10da44bbe7591be0abd8 (patch) | |
tree | 7e6532ef42e56abe8a2b29b7821b29f58372d259 /inflate.c | |
parent | f442c1e89e99ae5a0068a2d32e7284c2623f09fd (diff) | |
download | zlib-77b47d55f14be032c0ee10da44bbe7591be0abd8.tar.gz zlib-77b47d55f14be032c0ee10da44bbe7591be0abd8.tar.bz2 zlib-77b47d55f14be032c0ee10da44bbe7591be0abd8.zip |
Add undocumented inflateResetKeep() function for CAB file decoding.
The Microsoft CAB file format compresses each block with completed
deflate streams that depend on the sliding window history of the
previous block in order to decode. inflateResetKeep() does what
inflateReset() does, except the sliding window history from the
previous inflate operation is retained.
Diffstat (limited to 'inflate.c')
-rw-r--r-- | inflate.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -100,7 +100,7 @@ local int updatewindow OF((z_streamp strm, unsigned out)); | |||
100 | local unsigned syncsearch OF((unsigned FAR *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 inflateResetKeep(strm) |
104 | z_streamp strm; | 104 | z_streamp strm; |
105 | { | 105 | { |
106 | struct inflate_state FAR *state; | 106 | struct inflate_state FAR *state; |
@@ -115,9 +115,6 @@ z_streamp strm; | |||
115 | state->havedict = 0; | 115 | state->havedict = 0; |
116 | state->dmax = 32768U; | 116 | state->dmax = 32768U; |
117 | state->head = Z_NULL; | 117 | state->head = Z_NULL; |
118 | state->wsize = 0; | ||
119 | state->whave = 0; | ||
120 | state->wnext = 0; | ||
121 | state->hold = 0; | 118 | state->hold = 0; |
122 | state->bits = 0; | 119 | state->bits = 0; |
123 | state->lencode = state->distcode = state->next = state->codes; | 120 | state->lencode = state->distcode = state->next = state->codes; |
@@ -127,6 +124,19 @@ z_streamp strm; | |||
127 | return Z_OK; | 124 | return Z_OK; |
128 | } | 125 | } |
129 | 126 | ||
127 | int ZEXPORT inflateReset(strm) | ||
128 | z_streamp strm; | ||
129 | { | ||
130 | struct inflate_state FAR *state; | ||
131 | |||
132 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
133 | state = (struct inflate_state FAR *)strm->state; | ||
134 | state->wsize = 0; | ||
135 | state->whave = 0; | ||
136 | state->wnext = 0; | ||
137 | return inflateResetKeep(strm); | ||
138 | } | ||
139 | |||
130 | int ZEXPORT inflateReset2(strm, windowBits) | 140 | int ZEXPORT inflateReset2(strm, windowBits) |
131 | z_streamp strm; | 141 | z_streamp strm; |
132 | int windowBits; | 142 | int windowBits; |