Skip to main content

ZSTD_DCtx_refDDict

Function ZSTD_DCtx_refDDict 

Source
pub unsafe extern "C" fn ZSTD_DCtx_refDDict(
    dctx: *mut ZSTD_DCtx,
    ddict: *const ZSTD_DDict,
) -> usize
Expand description

ZSTD_DCtx_refDDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used to decompress next frames. In single-DDict mode, the dictionary remains active for decompression of future frames using the same DCtx.

If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function will store the DDict references in a table, and the DDict used for decompression will be determined at decompression time, as per the dict ID in the frame. The memory for the table is allocated on the first call to refDDict. The table is freed by ZSTD_DCtx_refDDict(dctx, NULL), by ZSTD_DCtx_reset() with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters, by any ZSTD_DCtx_loadDictionary() or ZSTD_DCtx_refPrefix() call, by disabling multiple-DDict mode, and by ZSTD_freeDCtx(). Disabling multiple-DDict mode releases all dictionary references from the set; no dictionary from the set is retained for subsequent decompression. Referencing a DDict invalidates any previously loaded dictionary or prefix.

If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary will be managed, and referencing a dictionary effectively “discards” any previous one.

@result : 0, or an error code (which can be tested with ZSTD_isError()). Special: referencing a NULL DDict means “return to no-dictionary mode”. Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx.