]> git.lizzy.rs Git - zlib.git/commitdiff
Add undocumented inflateResetKeep() function for CAB file decoding.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 8 Oct 2011 06:00:42 +0000 (23:00 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sat, 8 Oct 2011 06:13:37 +0000 (23:13 -0700)
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.

as400/bndsrc
as400/zlib.inc
contrib/vstudio/vc10/zlibvc.def
contrib/vstudio/vc9/zlibvc.def
inflate.c
win32/zlib.def
zconf.h
zconf.h.cmakein
zconf.h.in
zlib.h
zlib.map

index dad2bc9b0915bcbb705a464a85ef7b65929e5dce..036cd63ab3231bf5dcbeb9634b746ace45a023cb 100644 (file)
@@ -180,5 +180,6 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
   EXPORT SYMBOL("inflatePrime")
   EXPORT SYMBOL("inflateReset2")
   EXPORT SYMBOL("inflateUndermine")
+  EXPORT SYMBOL("inflateResetKeep")
 
 ENDPGMEXP
index 41ff616b9ca07534b4c0ad99a363ece92ef4a02b..976dca2a65f34521957a26d1d121f7caf6e01a0c 100644 (file)
      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
index 0d6dc38fbe6f08d8529e3b4fef97418f26a24a3f..d6ab1c1b0243349225115fb14f77b9397e22f1a2 100644 (file)
@@ -128,7 +128,8 @@ EXPORTS
         inflatePrime                            @158\r
         inflateReset2                           @159\r
         inflateUndermine                        @160\r
-
-; zlib1 v1.2.6 added:
-        gzgetc_                                 @30
-        gzflags                                 @162
+\r
+; zlib1 v1.2.6 added:\r
+        gzgetc_                                 @30\r
+        gzflags                                 @162\r
+        inflateResetKeep                        @163\r
index 0d6dc38fbe6f08d8529e3b4fef97418f26a24a3f..d6ab1c1b0243349225115fb14f77b9397e22f1a2 100644 (file)
@@ -128,7 +128,8 @@ EXPORTS
         inflatePrime                            @158\r
         inflateReset2                           @159\r
         inflateUndermine                        @160\r
-
-; zlib1 v1.2.6 added:
-        gzgetc_                                 @30
-        gzflags                                 @162
+\r
+; zlib1 v1.2.6 added:\r
+        gzgetc_                                 @30\r
+        gzflags                                 @162\r
+        inflateResetKeep                        @163\r
index cf10b01ca16b39241d1167231929cd23a5a39a0e..e14b361e069fcc0e39851135dfb8f4329057a821 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -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;
index 93ea8bf380a6c04ba9852f471eda5747d13ed15f..c420d8b9117fdd49d637c522ec498e4fbeaced89 100644 (file)
@@ -77,5 +77,6 @@ EXPORTS
     inflateSyncPoint
     get_crc_table
     inflateUndermine
+    inflateResetKeep
     gzgetc_
     gzflags
diff --git a/zconf.h b/zconf.h
index ed16b063134789a531644541c5faf84f9c2c4652..df7ff61a1eb36b6db914427d48899f9e173da37d 100644 (file)
--- a/zconf.h
+++ b/zconf.h
 #  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
index 84e46805a2dbbf577d4ef526f29acf8cdaac14e8..845054702e593941c3ae2f414d907a48af7943fa 100644 (file)
 #  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
index ed16b063134789a531644541c5faf84f9c2c4652..df7ff61a1eb36b6db914427d48899f9e173da37d 100644 (file)
 #  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
diff --git a/zlib.h b/zlib.h
index 96c2c1400d6492fe91a1ec9bf4e8a6060704aff0..99cd0583d18553eaf4d3767bcebaa65520f76c2a 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -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
index 627133dfbfec0216852c1bfb285cf126fe04a228..dd27591bb8402da861413414f8205a4b86be531e 100644 (file)
--- a/zlib.map
+++ b/zlib.map
@@ -74,4 +74,5 @@ ZLIB_1.2.5.1 {
 ZLIB_1.2.5.2 {
     gzflags;
     gzgetc_;
+    inflateResetKeep;
 } ZLIB_1.2.5.1;