diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2016-12-30 16:29:56 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2016-12-30 16:29:56 -0800 |
commit | ee7d7b5dda25c111e61e19ac7b476c26aa6f3020 (patch) | |
tree | cfc5d9b06269fb46f1c4d1dcab77ce71ae5143bd /deflate.c | |
parent | feafcfaa05537869bd128af5474f62b19df8b502 (diff) | |
download | zlib-ee7d7b5dda25c111e61e19ac7b476c26aa6f3020.tar.gz zlib-ee7d7b5dda25c111e61e19ac7b476c26aa6f3020.tar.bz2 zlib-ee7d7b5dda25c111e61e19ac7b476c26aa6f3020.zip |
Add deflateGetDictionary() function.
Per request, but its utility is likely to be very limited. See the
comments in zlib.h.
Diffstat (limited to '')
-rw-r--r-- | deflate.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -441,6 +441,27 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | |||
441 | } | 441 | } |
442 | 442 | ||
443 | /* ========================================================================= */ | 443 | /* ========================================================================= */ |
444 | int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) | ||
445 | z_streamp strm; | ||
446 | Bytef *dictionary; | ||
447 | uInt *dictLength; | ||
448 | { | ||
449 | deflate_state *s; | ||
450 | |||
451 | if (deflateStateCheck(strm)) | ||
452 | return Z_STREAM_ERROR; | ||
453 | s = strm->state; | ||
454 | uInt len = s->strstart + s->lookahead; | ||
455 | if (len > s->w_size) | ||
456 | len = s->w_size; | ||
457 | if (dictionary != Z_NULL && len) | ||
458 | zmemcpy(dictionary, s->window + s->strstart + s->lookahead - len, len); | ||
459 | if (dictLength != Z_NULL) | ||
460 | *dictLength = len; | ||
461 | return Z_OK; | ||
462 | } | ||
463 | |||
464 | /* ========================================================================= */ | ||
444 | int ZEXPORT deflateResetKeep (strm) | 465 | int ZEXPORT deflateResetKeep (strm) |
445 | z_streamp strm; | 466 | z_streamp strm; |
446 | { | 467 | { |