Skip to main content

ZSTD_CCtx_reset

Function ZSTD_CCtx_reset 

Source
pub unsafe extern "C" fn ZSTD_CCtx_reset(
    cctx: *mut ZSTD_CCtx,
    reset: ZSTD_ResetDirective,
) -> usize
Expand description

ZSTD_CCtx_reset() : There are 2 different things that can be reset, independently or jointly :

  • The session : will stop compressing current frame, and make CCtx ready to start a new one. Useful after an error, or to interrupt any ongoing compression. Any internal data not yet flushed is cancelled. With nbWorkers >= 1, it waits for the jobs already started to complete. Compression parameters and dictionary remain unchanged. They will be used to compress next frame. Resetting session never fails.
  • The parameters : changes all parameters back to “default”. This also removes any reference to any dictionary or external sequence producer. Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing) otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())
  • Both : similar to resetting the session, followed by resetting parameters.