]> git.lizzy.rs Git - zlib.git/commitdiff
Add inflateGetDictionary() function.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 26 May 2012 17:37:17 +0000 (10:37 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sun, 27 May 2012 06:25:35 +0000 (23:25 -0700)
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 52cc6613b30a939fadc73d9dd377b7f5e12a00b2..a6de4d59edef741e0c6d609cfb55b5fdbce2cf8e 100644 (file)
@@ -67,6 +67,7 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
   EXPORT SYMBOL("inflate")
   EXPORT SYMBOL("inflateEnd")
   EXPORT SYMBOL("inflateSetDictionary")
+  EXPORT SYMBOL("inflateGetDictionary")
   EXPORT SYMBOL("inflateSync")
   EXPORT SYMBOL("inflateReset")
   EXPORT SYMBOL("inflateInit_")
index 66d867ae59feb237f23ae2710e8bfa74c599f9cf..9c94be8dc6344a93e64cb8aaaad5f2d8899b2f20 100644 (file)
      D  dictionary                65535    const options(*varsize)              Dictionary bytes
      D  dictLength                   10U 0 value                                Dictionary length
       *
+     D inflateGetDictionary...
+     D                 PR            10I 0 extproc('inflateGetDictionary')      Get dictionary
+     D  strm                               like(z_stream)                       Expansion stream
+     D  dictionary                65535    options(*varsize)                    Dictionary bytes
+     D  dictLength                   10U 0                                      Dictionary length
+      *
      D inflateSync     PR            10I 0 extproc('inflateSync')               Sync. expansion
      D  strm                               like(z_stream)                       Expansion stream
       *
index feea7cf19582f6019da4b72d054ac839689654e0..34b1466567f019fb3898bf8938e569b9b1903da0 100644 (file)
@@ -137,3 +137,6 @@ EXPORTS
 
 ; zlib1 v1.2.7 added:
         gzopen_w                                @165
+
+; zlib1 v1.2.8 added:
+        inflateGetDictionary                    @166
index c1f644d092c26ffe0dc4700704c0ac4beb275af3..3af7061f7fb8d903503ab78f6aed9da66499d499 100644 (file)
@@ -137,3 +137,6 @@ EXPORTS
 
 ; zlib1 v1.2.7 added:
         gzopen_w                                @165
+
+; zlib1 v1.2.8 added:
+        inflateGetDictionary                    @166
index 47418a1e1e1e6b3690c45d8de9e2fc3c1e6945f2..d1efdb81315f2463ac2d06084924ad7901af4d88 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -1264,6 +1264,29 @@ z_streamp strm;
     return Z_OK;
 }
 
+int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
+z_streamp strm;
+Bytef *dictionary;
+uInt *dictLength;
+{
+    struct inflate_state FAR *state;
+
+    /* check state */
+    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+    state = (struct inflate_state FAR *)strm->state;
+
+    /* copy dictionary */
+    if (state->whave && dictionary != Z_NULL) {
+        zmemcpy(dictionary, state->window + state->wnext,
+                state->whave - state->wnext);
+        zmemcpy(dictionary + state->whave - state->wnext,
+                state->window, state->wnext);
+    }
+    if (dictLength != Z_NULL)
+        *dictLength = state->whave;
+    return Z_OK;
+}
+
 int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
 z_streamp strm;
 const Bytef *dictionary;
index 04896150e4b7e41a9156e44590835894d2dfc2a3..f10fa7a67f922603deb86e4d5041cd8838cc26f2 100644 (file)
@@ -17,6 +17,7 @@ EXPORTS
     deflatePrime
     deflateSetHeader
     inflateSetDictionary
+    inflateGetDictionary
     inflateSync
     inflateCopy
     inflateReset
diff --git a/zconf.h b/zconf.h
index c71cade09f8db37b31fb360bcac0bb356ea9f095..26e7a048825980561643afe346640325668912b0 100644 (file)
--- a/zconf.h
+++ b/zconf.h
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
 #  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
index 1d31b67e2e21f1d5def700cb262d59297a8c94c9..5390baa6bb0e14c9c4d16c7bb2d3b58096de7fdb 100644 (file)
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
 #  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
index c71cade09f8db37b31fb360bcac0bb356ea9f095..26e7a048825980561643afe346640325668912b0 100644 (file)
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
 #  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
diff --git a/zlib.h b/zlib.h
index 94909ef280a594dbb37539d595ba68d477f40541..cd47df5ce45002fdb6e80d9b1c526db83fd4c54c 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -839,6 +839,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
    inflate().
 */
 
+ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
+                                             Bytef *dictionary,
+                                             uInt  *dictLength));
+/*
+     Returns the sliding dictionary being maintained by inflate.  dictLength is
+   set to the number of bytes in the dictionary, and that many bytes are copied
+   to dictionary.  dictionary must have enough space, where 32768 bytes is
+   always enough.  If inflateGetDictionary() is called with dictionary equal to
+   Z_NULL, then only the dictionary length is returned, and nothing is copied.
+   Similary, if dictLength is Z_NULL, then it is not set.
+
+     inflateSetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
+   stream state is inconsistent.
+*/
+
 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 /*
      Skips invalid compressed data until a possible full flush point (see above
index 771f420412e2162ac6c9c9aefc1c3d4b15a713f5..d7b4df77b2ed80827fc0fd6ff70efbc6a4529aff 100644 (file)
--- a/zlib.map
+++ b/zlib.map
@@ -76,3 +76,7 @@ ZLIB_1.2.5.2 {
     gzgetc_;
     inflateResetKeep;
 } ZLIB_1.2.5.1;
+
+ZLIB_1.2.7.1 {
+    inflateSetDictionary;
+} ZLIB_1.2.7;