summaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2016-12-30 16:29:56 -0800
committerMark Adler <madler@alumni.caltech.edu>2016-12-30 16:29:56 -0800
commitee7d7b5dda25c111e61e19ac7b476c26aa6f3020 (patch)
treecfc5d9b06269fb46f1c4d1dcab77ce71ae5143bd /zlib.h
parentfeafcfaa05537869bd128af5474f62b19df8b502 (diff)
downloadzlib-ee7d7b5dda25c111e61e19ac7b476c26aa6f3020.tar.gz
Add deflateGetDictionary() function.
Per request, but its utility is likely to be very limited. See the comments in zlib.h.
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/zlib.h b/zlib.h
index 053e6e2..6f4a049 100644
--- a/zlib.h
+++ b/zlib.h
@@ -651,6 +651,28 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
not perform any compression: this will be done by deflate().
*/
+ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
+ Bytef *dictionary,
+ uInt *dictLength));
+/*
+ Returns the sliding dictionary being maintained by deflate. 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 deflateGetDictionary() 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.
+
+ deflateGetDictionary() may return a length less than the window size, even
+ when more than the window size in input has been provided. It may return up
+ to 258 bytes less in that case, due to how zlib's implementation of deflate
+ manages the sliding window and lookahead for matches, where matches can be
+ up to 258 bytes long. If the application needs the last window-size bytes of
+ input, then that would need to be saved by the application outside of zlib.
+
+ deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
+ stream state is inconsistent.
+*/
+
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
z_streamp source));
/*