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 | |
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.
-rw-r--r-- | as400/bndsrc | 1 | ||||
-rw-r--r-- | as400/zlib.inc | 4 | ||||
-rw-r--r-- | contrib/vstudio/vc10/zlibvc.def | 9 | ||||
-rw-r--r-- | contrib/vstudio/vc9/zlibvc.def | 9 | ||||
-rw-r--r-- | inflate.c | 18 | ||||
-rw-r--r-- | win32/zlib.def | 1 | ||||
-rw-r--r-- | zconf.h | 1 | ||||
-rw-r--r-- | zconf.h.cmakein | 1 | ||||
-rw-r--r-- | zconf.h.in | 1 | ||||
-rw-r--r-- | zlib.h | 1 | ||||
-rw-r--r-- | zlib.map | 1 |
11 files changed, 35 insertions, 12 deletions
diff --git a/as400/bndsrc b/as400/bndsrc index dad2bc9..036cd63 100644 --- a/as400/bndsrc +++ b/as400/bndsrc | |||
@@ -180,5 +180,6 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') | |||
180 | EXPORT SYMBOL("inflatePrime") | 180 | EXPORT SYMBOL("inflatePrime") |
181 | EXPORT SYMBOL("inflateReset2") | 181 | EXPORT SYMBOL("inflateReset2") |
182 | EXPORT SYMBOL("inflateUndermine") | 182 | EXPORT SYMBOL("inflateUndermine") |
183 | EXPORT SYMBOL("inflateResetKeep") | ||
183 | 184 | ||
184 | ENDPGMEXP | 185 | ENDPGMEXP |
diff --git a/as400/zlib.inc b/as400/zlib.inc index 41ff616..976dca2 100644 --- a/as400/zlib.inc +++ b/as400/zlib.inc | |||
@@ -431,6 +431,10 @@ | |||
431 | D strm like(z_stream) Expansion stream | 431 | D strm like(z_stream) Expansion stream |
432 | D arg 10I 0 value Error code | 432 | D arg 10I 0 value Error code |
433 | * | 433 | * |
434 | D inflateResetKeep... | ||
435 | D PR 10I 0 extproc('inflateResetKeep') End and init. stream | ||
436 | D strm like(z_stream) Expansion stream | ||
437 | * | ||
434 | D gzflags PR 10U 0 extproc('gzflags') | 438 | D gzflags PR 10U 0 extproc('gzflags') |
435 | * | 439 | * |
436 | /endif | 440 | /endif |
diff --git a/contrib/vstudio/vc10/zlibvc.def b/contrib/vstudio/vc10/zlibvc.def index 0d6dc38..d6ab1c1 100644 --- a/contrib/vstudio/vc10/zlibvc.def +++ b/contrib/vstudio/vc10/zlibvc.def | |||
@@ -128,7 +128,8 @@ EXPORTS | |||
128 | inflatePrime @158 | 128 | inflatePrime @158 |
129 | inflateReset2 @159 | 129 | inflateReset2 @159 |
130 | inflateUndermine @160 | 130 | inflateUndermine @160 |
131 | 131 | ||
132 | ; zlib1 v1.2.6 added: | 132 | ; zlib1 v1.2.6 added: |
133 | gzgetc_ @30 | 133 | gzgetc_ @30 |
134 | gzflags @162 | 134 | gzflags @162 |
135 | inflateResetKeep @163 | ||
diff --git a/contrib/vstudio/vc9/zlibvc.def b/contrib/vstudio/vc9/zlibvc.def index 0d6dc38..d6ab1c1 100644 --- a/contrib/vstudio/vc9/zlibvc.def +++ b/contrib/vstudio/vc9/zlibvc.def | |||
@@ -128,7 +128,8 @@ EXPORTS | |||
128 | inflatePrime @158 | 128 | inflatePrime @158 |
129 | inflateReset2 @159 | 129 | inflateReset2 @159 |
130 | inflateUndermine @160 | 130 | inflateUndermine @160 |
131 | 131 | ||
132 | ; zlib1 v1.2.6 added: | 132 | ; zlib1 v1.2.6 added: |
133 | gzgetc_ @30 | 133 | gzgetc_ @30 |
134 | gzflags @162 | 134 | gzflags @162 |
135 | inflateResetKeep @163 | ||
@@ -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; |
diff --git a/win32/zlib.def b/win32/zlib.def index 93ea8bf..c420d8b 100644 --- a/win32/zlib.def +++ b/win32/zlib.def | |||
@@ -77,5 +77,6 @@ EXPORTS | |||
77 | inflateSyncPoint | 77 | inflateSyncPoint |
78 | get_crc_table | 78 | get_crc_table |
79 | inflateUndermine | 79 | inflateUndermine |
80 | inflateResetKeep | ||
80 | gzgetc_ | 81 | gzgetc_ |
81 | gzflags | 82 | gzflags |
@@ -103,6 +103,7 @@ | |||
103 | # define inflateSync z_inflateSync | 103 | # define inflateSync z_inflateSync |
104 | # define inflateSyncPoint z_inflateSyncPoint | 104 | # define inflateSyncPoint z_inflateSyncPoint |
105 | # define inflateUndermine z_inflateUndermine | 105 | # define inflateUndermine z_inflateUndermine |
106 | # define inflateResetKeep z_inflateResetKeep | ||
106 | # define inflate_copyright z_inflate_copyright | 107 | # define inflate_copyright z_inflate_copyright |
107 | # define inflate_fast z_inflate_fast | 108 | # define inflate_fast z_inflate_fast |
108 | # define inflate_table z_inflate_table | 109 | # define inflate_table z_inflate_table |
diff --git a/zconf.h.cmakein b/zconf.h.cmakein index 84e4680..8450547 100644 --- a/zconf.h.cmakein +++ b/zconf.h.cmakein | |||
@@ -105,6 +105,7 @@ | |||
105 | # define inflateSync z_inflateSync | 105 | # define inflateSync z_inflateSync |
106 | # define inflateSyncPoint z_inflateSyncPoint | 106 | # define inflateSyncPoint z_inflateSyncPoint |
107 | # define inflateUndermine z_inflateUndermine | 107 | # define inflateUndermine z_inflateUndermine |
108 | # define inflateResetKeep z_inflateResetKeep | ||
108 | # define inflate_copyright z_inflate_copyright | 109 | # define inflate_copyright z_inflate_copyright |
109 | # define inflate_fast z_inflate_fast | 110 | # define inflate_fast z_inflate_fast |
110 | # define inflate_table z_inflate_table | 111 | # define inflate_table z_inflate_table |
@@ -103,6 +103,7 @@ | |||
103 | # define inflateSync z_inflateSync | 103 | # define inflateSync z_inflateSync |
104 | # define inflateSyncPoint z_inflateSyncPoint | 104 | # define inflateSyncPoint z_inflateSyncPoint |
105 | # define inflateUndermine z_inflateUndermine | 105 | # define inflateUndermine z_inflateUndermine |
106 | # define inflateResetKeep z_inflateResetKeep | ||
106 | # define inflate_copyright z_inflate_copyright | 107 | # define inflate_copyright z_inflate_copyright |
107 | # define inflate_fast z_inflate_fast | 108 | # define inflate_fast z_inflate_fast |
108 | # define inflate_table z_inflate_table | 109 | # define inflate_table z_inflate_table |
@@ -1687,6 +1687,7 @@ ZEXTERN const char * ZEXPORT zError OF((int)); | |||
1687 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | 1687 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
1688 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | 1688 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |
1689 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | 1689 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); |
1690 | ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | ||
1690 | #ifndef Z_SOLO | 1691 | #ifndef Z_SOLO |
1691 | ZEXTERN unsigned long ZEXPORT gzflags OF((void)); | 1692 | ZEXTERN unsigned long ZEXPORT gzflags OF((void)); |
1692 | #endif | 1693 | #endif |
@@ -74,4 +74,5 @@ ZLIB_1.2.5.1 { | |||
74 | ZLIB_1.2.5.2 { | 74 | ZLIB_1.2.5.2 { |
75 | gzflags; | 75 | gzflags; |
76 | gzgetc_; | 76 | gzgetc_; |
77 | inflateResetKeep; | ||
77 | } ZLIB_1.2.5.1; | 78 | } ZLIB_1.2.5.1; |