aboutsummaryrefslogtreecommitdiff
path: root/inflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-10-07 23:00:42 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-10-07 23:13:37 -0700
commit77b47d55f14be032c0ee10da44bbe7591be0abd8 (patch)
tree7e6532ef42e56abe8a2b29b7821b29f58372d259 /inflate.c
parentf442c1e89e99ae5a0068a2d32e7284c2623f09fd (diff)
downloadzlib-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.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/inflate.c b/inflate.c
index cf10b01..e14b361 100644
--- a/inflate.c
+++ b/inflate.c
@@ -100,7 +100,7 @@ local int updatewindow OF((z_streamp strm, unsigned out));
100local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, 100local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
101 unsigned len)); 101 unsigned len));
102 102
103int ZEXPORT inflateReset(strm) 103int ZEXPORT inflateResetKeep(strm)
104z_streamp strm; 104z_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
127int ZEXPORT inflateReset(strm)
128z_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
130int ZEXPORT inflateReset2(strm, windowBits) 140int ZEXPORT inflateReset2(strm, windowBits)
131z_streamp strm; 141z_streamp strm;
132int windowBits; 142int windowBits;