@@ -651,6 +651,28 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
651651 not perform any compression: this will be done by deflate().
652652*/
653653
654+ ZEXTERN int ZEXPORT deflateGetDictionary OF ((z_streamp strm ,
655+ Bytef * dictionary ,
656+ uInt * dictLength ));
657+ /*
658+ Returns the sliding dictionary being maintained by deflate. dictLength is
659+ set to the number of bytes in the dictionary, and that many bytes are copied
660+ to dictionary. dictionary must have enough space, where 32768 bytes is
661+ always enough. If deflateGetDictionary() is called with dictionary equal to
662+ Z_NULL, then only the dictionary length is returned, and nothing is copied.
663+ Similary, if dictLength is Z_NULL, then it is not set.
664+
665+ deflateGetDictionary() may return a length less than the window size, even
666+ when more than the window size in input has been provided. It may return up
667+ to 258 bytes less in that case, due to how zlib's implementation of deflate
668+ manages the sliding window and lookahead for matches, where matches can be
669+ up to 258 bytes long. If the application needs the last window-size bytes of
670+ input, then that would need to be saved by the application outside of zlib.
671+
672+ deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
673+ stream state is inconsistent.
674+ */
675+
654676ZEXTERN int ZEXPORT deflateCopy OF ((z_streamp dest ,
655677 z_streamp source ));
656678/*
0 commit comments