#[export_name = "inflateSetDictionary"]
pub unsafe extern "C-unwind" fn inflateSetDictionary(
strm: *mut z_stream,
dictionary: *const u8,
dictLength: c_uint,
) -> c_int
Expand description
Initializes the decompression dictionary from the given uncompressed byte sequence.
This function must be called immediately after a call of inflate
, if that call returned Z_NEED_DICT
.
The dictionary chosen by the compressor can be determined from the Adler-32 value returned by that call of inflate.
The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary
).
For raw inflate, this function can be called at any time to set the dictionary.
If the provided dictionary is smaller than the window and there is already data in the window, then the provided dictionary will amend what’s there.
The application must insure that the same dictionary that was used for compression is provided.
inflateSetDictionary
does not perform any decompression: this will be done by subsequent calls of inflate
.
§Returns
Z_OK
if successZ_STREAM_ERROR
if the source stream state was inconsistent ordictionary
isNULL
Z_DATA_ERROR
if the given dictionary doesn’t match the expected one (i.e. it has an incorrect Adler-32 value).
§Safety
The caller must guarantee that
- Either
strm
isNULL
strm
satisfies the requirements of&mut *strm
and was initialized withinflateInit_
or similar
- Either
dictionary
isNULL
dictionary
anddictLength
satisfy the requirements ofcore::slice::from_raw_parts_mut::<u8>