diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-05-26 10:37:17 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-05-26 23:25:35 -0700 |
commit | dca9e1d6f3ee32f26c1831a0a9b3a6a8aa775509 (patch) | |
tree | ec9bd5d51d8bec3e1cbe9ef6850b5fcf0898aac4 /inflate.c | |
parent | eb90f6a56892d7f88df99e52300498d6780cacca (diff) | |
download | zlib-dca9e1d6f3ee32f26c1831a0a9b3a6a8aa775509.tar.gz zlib-dca9e1d6f3ee32f26c1831a0a9b3a6a8aa775509.tar.bz2 zlib-dca9e1d6f3ee32f26c1831a0a9b3a6a8aa775509.zip |
Add inflateGetDictionary() function.
Diffstat (limited to 'inflate.c')
-rw-r--r-- | inflate.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -1264,6 +1264,29 @@ z_streamp strm; | |||
1264 | return Z_OK; | 1264 | return Z_OK; |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) | ||
1268 | z_streamp strm; | ||
1269 | Bytef *dictionary; | ||
1270 | uInt *dictLength; | ||
1271 | { | ||
1272 | struct inflate_state FAR *state; | ||
1273 | |||
1274 | /* check state */ | ||
1275 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1276 | state = (struct inflate_state FAR *)strm->state; | ||
1277 | |||
1278 | /* copy dictionary */ | ||
1279 | if (state->whave && dictionary != Z_NULL) { | ||
1280 | zmemcpy(dictionary, state->window + state->wnext, | ||
1281 | state->whave - state->wnext); | ||
1282 | zmemcpy(dictionary + state->whave - state->wnext, | ||
1283 | state->window, state->wnext); | ||
1284 | } | ||
1285 | if (dictLength != Z_NULL) | ||
1286 | *dictLength = state->whave; | ||
1287 | return Z_OK; | ||
1288 | } | ||
1289 | |||
1267 | int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) | 1290 | int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) |
1268 | z_streamp strm; | 1291 | z_streamp strm; |
1269 | const Bytef *dictionary; | 1292 | const Bytef *dictionary; |