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.
This commit is contained in:
Mark Adler 2011-10-07 23:00:42 -07:00
parent f442c1e89e
commit 77b47d55f1
11 changed files with 35 additions and 12 deletions

View File

@ -180,5 +180,6 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
EXPORT SYMBOL("inflatePrime")
EXPORT SYMBOL("inflateReset2")
EXPORT SYMBOL("inflateUndermine")
EXPORT SYMBOL("inflateResetKeep")
ENDPGMEXP

View File

@ -431,6 +431,10 @@
D strm like(z_stream) Expansion stream
D arg 10I 0 value Error code
*
D inflateResetKeep...
D PR 10I 0 extproc('inflateResetKeep') End and init. stream
D strm like(z_stream) Expansion stream
*
D gzflags PR 10U 0 extproc('gzflags')
*
/endif

View File

@ -128,7 +128,8 @@ EXPORTS
inflatePrime @158
inflateReset2 @159
inflateUndermine @160
; zlib1 v1.2.6 added:
gzgetc_ @30
gzflags @162
; zlib1 v1.2.6 added:
gzgetc_ @30
gzflags @162
inflateResetKeep @163

View File

@ -128,7 +128,8 @@ EXPORTS
inflatePrime @158
inflateReset2 @159
inflateUndermine @160
; zlib1 v1.2.6 added:
gzgetc_ @30
gzflags @162
; zlib1 v1.2.6 added:
gzgetc_ @30
gzflags @162
inflateResetKeep @163

View File

@ -100,7 +100,7 @@ local int updatewindow OF((z_streamp strm, unsigned out));
local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
unsigned len));
int ZEXPORT inflateReset(strm)
int ZEXPORT inflateResetKeep(strm)
z_streamp strm;
{
struct inflate_state FAR *state;
@ -115,9 +115,6 @@ z_streamp strm;
state->havedict = 0;
state->dmax = 32768U;
state->head = Z_NULL;
state->wsize = 0;
state->whave = 0;
state->wnext = 0;
state->hold = 0;
state->bits = 0;
state->lencode = state->distcode = state->next = state->codes;
@ -127,6 +124,19 @@ z_streamp strm;
return Z_OK;
}
int ZEXPORT inflateReset(strm)
z_streamp strm;
{
struct inflate_state FAR *state;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
state->wsize = 0;
state->whave = 0;
state->wnext = 0;
return inflateResetKeep(strm);
}
int ZEXPORT inflateReset2(strm, windowBits)
z_streamp strm;
int windowBits;

View File

@ -77,5 +77,6 @@ EXPORTS
inflateSyncPoint
get_crc_table
inflateUndermine
inflateResetKeep
gzgetc_
gzflags

View File

@ -103,6 +103,7 @@
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table

View File

@ -105,6 +105,7 @@
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table

View File

@ -103,6 +103,7 @@
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table

1
zlib.h
View File

@ -1687,6 +1687,7 @@ ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
#ifndef Z_SOLO
ZEXTERN unsigned long ZEXPORT gzflags OF((void));
#endif

View File

@ -74,4 +74,5 @@ ZLIB_1.2.5.1 {
ZLIB_1.2.5.2 {
gzflags;
gzgetc_;
inflateResetKeep;
} ZLIB_1.2.5.1;