Project Alice
Loading...
Searching...
No Matches
zstd_decompress.c File Reference
Include dependency graph for zstd_decompress.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ZSTD_HEAPMODE   1
 
#define ZSTD_LEGACY_SUPPORT   0
 
#define ZSTD_MAXWINDOWSIZE_DEFAULT   (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1)
 
#define ZSTD_NO_FORWARD_PROGRESS_MAX   16
 
#define FSE_STATIC_LINKING_ONLY
 
#define DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT   4
 
#define DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT
 
#define DDICT_HASHSET_TABLE_BASE_SIZE   64
 
#define DDICT_HASHSET_RESIZE_FACTOR   2
 
#define CHECK_DBOUNDS(p, v)
 

Functions

size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx *dctx)
 
size_t ZSTD_estimateDCtxSize (void)
 
ZSTD_DCtxZSTD_initStaticDCtx (void *workspace, size_t workspaceSize)
 
ZSTD_DCtxZSTD_createDCtx_advanced (ZSTD_customMem customMem)
 
ZSTD_DCtxZSTD_createDCtx (void)
 
size_t ZSTD_freeDCtx (ZSTD_DCtx *dctx)
 
void ZSTD_copyDCtx (ZSTD_DCtx *dstDCtx, const ZSTD_DCtx *srcDCtx)
 
unsigned ZSTD_isFrame (const void *buffer, size_t size)
 
unsigned ZSTD_isSkippableFrame (const void *buffer, size_t size)
 
size_t ZSTD_frameHeaderSize (const void *src, size_t srcSize)
 
size_t ZSTD_getFrameHeader_advanced (ZSTD_frameHeader *zfhPtr, const void *src, size_t srcSize, ZSTD_format_e format)
 
size_t ZSTD_getFrameHeader (ZSTD_frameHeader *zfhPtr, const void *src, size_t srcSize)
 
unsigned long long ZSTD_getFrameContentSize (const void *src, size_t srcSize)
 
size_t ZSTD_readSkippableFrame (void *dst, size_t dstCapacity, unsigned *magicVariant, const void *src, size_t srcSize)
 
unsigned long long ZSTD_findDecompressedSize (const void *src, size_t srcSize)
 
unsigned long long ZSTD_getDecompressedSize (const void *src, size_t srcSize)
 
size_t ZSTD_findFrameCompressedSize (const void *src, size_t srcSize)
 
unsigned long long ZSTD_decompressBound (const void *src, size_t srcSize)
 
size_t ZSTD_decompressionMargin (void const *src, size_t srcSize)
 
size_t ZSTD_insertBlock (ZSTD_DCtx *dctx, const void *blockStart, size_t blockSize)
 
size_t ZSTD_decompress_usingDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
 
size_t ZSTD_decompressDCtx (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
size_t ZSTD_decompress (void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
size_t ZSTD_nextSrcSizeToDecompress (ZSTD_DCtx *dctx)
 
ZSTD_nextInputType_e ZSTD_nextInputType (ZSTD_DCtx *dctx)
 
size_t ZSTD_decompressContinue (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
size_t ZSTD_loadDEntropy (ZSTD_entropyDTables_t *entropy, const void *const dict, size_t const dictSize)
 
size_t ZSTD_decompressBegin (ZSTD_DCtx *dctx)
 
size_t ZSTD_decompressBegin_usingDict (ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 
size_t ZSTD_decompressBegin_usingDDict (ZSTD_DCtx *dctx, const ZSTD_DDict *ddict)
 
unsigned ZSTD_getDictID_fromDict (const void *dict, size_t dictSize)
 
unsigned ZSTD_getDictID_fromFrame (const void *src, size_t srcSize)
 
size_t ZSTD_decompress_usingDDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
 
ZSTD_DStreamZSTD_createDStream (void)
 
ZSTD_DStreamZSTD_initStaticDStream (void *workspace, size_t workspaceSize)
 
ZSTD_DStreamZSTD_createDStream_advanced (ZSTD_customMem customMem)
 
size_t ZSTD_freeDStream (ZSTD_DStream *zds)
 
size_t ZSTD_DStreamInSize (void)
 
size_t ZSTD_DStreamOutSize (void)
 
size_t ZSTD_DCtx_loadDictionary_advanced (ZSTD_DCtx *dctx, const void *dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType)
 
size_t ZSTD_DCtx_loadDictionary_byReference (ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 
size_t ZSTD_DCtx_loadDictionary (ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 
size_t ZSTD_DCtx_refPrefix_advanced (ZSTD_DCtx *dctx, const void *prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType)
 
size_t ZSTD_DCtx_refPrefix (ZSTD_DCtx *dctx, const void *prefix, size_t prefixSize)
 
size_t ZSTD_initDStream_usingDict (ZSTD_DStream *zds, const void *dict, size_t dictSize)
 
size_t ZSTD_initDStream (ZSTD_DStream *zds)
 
size_t ZSTD_initDStream_usingDDict (ZSTD_DStream *dctx, const ZSTD_DDict *ddict)
 
size_t ZSTD_resetDStream (ZSTD_DStream *dctx)
 
size_t ZSTD_DCtx_refDDict (ZSTD_DCtx *dctx, const ZSTD_DDict *ddict)
 
size_t ZSTD_DCtx_setMaxWindowSize (ZSTD_DCtx *dctx, size_t maxWindowSize)
 
size_t ZSTD_DCtx_setFormat (ZSTD_DCtx *dctx, ZSTD_format_e format)
 
ZSTD_bounds ZSTD_dParam_getBounds (ZSTD_dParameter dParam)
 
size_t ZSTD_DCtx_getParameter (ZSTD_DCtx *dctx, ZSTD_dParameter param, int *value)
 
size_t ZSTD_DCtx_setParameter (ZSTD_DCtx *dctx, ZSTD_dParameter dParam, int value)
 
size_t ZSTD_DCtx_reset (ZSTD_DCtx *dctx, ZSTD_ResetDirective reset)
 
size_t ZSTD_sizeof_DStream (const ZSTD_DStream *dctx)
 
size_t ZSTD_decodingBufferSize_min (unsigned long long windowSize, unsigned long long frameContentSize)
 
size_t ZSTD_estimateDStreamSize (size_t windowSize)
 
size_t ZSTD_estimateDStreamSize_fromFrame (const void *src, size_t srcSize)
 
size_t ZSTD_decompressStream (ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 
size_t ZSTD_decompressStream_simpleArgs (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, size_t *dstPos, const void *src, size_t srcSize, size_t *srcPos)
 

Macro Definition Documentation

◆ CHECK_DBOUNDS

#define CHECK_DBOUNDS (   p,
 
)
Value:
{ \
RETURN_ERROR_IF(!ZSTD_dParam_withinBounds(p, v), parameter_outOfBound, ""); \
}

Definition at line 1867 of file zstd_decompress.c.

◆ DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT

#define DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT   4

Definition at line 82 of file zstd_decompress.c.

◆ DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT

#define DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT
Value:
3 /* These two constants represent SIZE_MULT/COUNT_MULT load factor without using a float.
* Currently, that means a 0.75 load factor.
* So, if count * COUNT_MULT / size * SIZE_MULT != 0, then we've exceeded
* the load factor of the ddict hash set.
*/

Definition at line 83 of file zstd_decompress.c.

◆ DDICT_HASHSET_RESIZE_FACTOR

#define DDICT_HASHSET_RESIZE_FACTOR   2

Definition at line 86 of file zstd_decompress.c.

◆ DDICT_HASHSET_TABLE_BASE_SIZE

#define DDICT_HASHSET_TABLE_BASE_SIZE   64

Definition at line 85 of file zstd_decompress.c.

◆ FSE_STATIC_LINKING_ONLY

#define FSE_STATIC_LINKING_ONLY

Definition at line 64 of file zstd_decompress.c.

◆ ZSTD_HEAPMODE

#define ZSTD_HEAPMODE   1

HEAPMODE : Select how default decompression function ZSTD_decompress() allocates its context, on stack (0), or into heap (1, default; requires malloc()). Note that functions with explicit context such as ZSTD_decompressDCtx() are unaffected.

Definition at line 22 of file zstd_decompress.c.

◆ ZSTD_LEGACY_SUPPORT

#define ZSTD_LEGACY_SUPPORT   0

LEGACY_SUPPORT : if set to 1+, ZSTD_decompress() can decode older formats (v0.1+)

Definition at line 30 of file zstd_decompress.c.

◆ ZSTD_MAXWINDOWSIZE_DEFAULT

#define ZSTD_MAXWINDOWSIZE_DEFAULT   (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1)

MAXWINDOWSIZE_DEFAULT : maximum window size accepted by DStream by default. Frames requiring more memory will be rejected. It's possible to set a different limit using ZSTD_DCtx_setMaxWindowSize().

Definition at line 40 of file zstd_decompress.c.

◆ ZSTD_NO_FORWARD_PROGRESS_MAX

#define ZSTD_NO_FORWARD_PROGRESS_MAX   16

NO_FORWARD_PROGRESS_MAX : maximum allowed nb of calls to ZSTD_decompressStream() without any forward progress (defined as: no byte read from input, and no byte flushed to output) before triggering an error.

Definition at line 51 of file zstd_decompress.c.

Function Documentation

◆ ZSTD_copyDCtx()

void ZSTD_copyDCtx ( ZSTD_DCtx dstDCtx,
const ZSTD_DCtx srcDCtx 
)

Definition at line 342 of file zstd_decompress.c.

◆ ZSTD_createDCtx()

ZSTD_DCtx * ZSTD_createDCtx ( void  )

Definition at line 306 of file zstd_decompress.c.

◆ ZSTD_createDCtx_advanced()

ZSTD_DCtx * ZSTD_createDCtx_advanced ( ZSTD_customMem  customMem)

Definition at line 301 of file zstd_decompress.c.

◆ ZSTD_createDStream()

ZSTD_DStream * ZSTD_createDStream ( void  )

Definition at line 1666 of file zstd_decompress.c.

◆ ZSTD_createDStream_advanced()

ZSTD_DStream * ZSTD_createDStream_advanced ( ZSTD_customMem  customMem)

Definition at line 1677 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_DCtx_getParameter()

size_t ZSTD_DCtx_getParameter ( ZSTD_DCtx dctx,
ZSTD_dParameter  param,
int *  value 
)

Definition at line 1871 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_DCtx_loadDictionary()

size_t ZSTD_DCtx_loadDictionary ( ZSTD_DCtx dctx,
const void *  dict,
size_t  dictSize 
)

ZSTD_DCtx_loadDictionary() : Requires v1.4.0+ Create an internal DDict from dict buffer, to be used to decompress all future frames. The dictionary remains valid for all future frames, until explicitly invalidated, or a new dictionary is loaded.

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, meaning "return to no-dictionary mode". Note 1 : Loading a dictionary involves building tables, which has a non-negligible impact on CPU usage and latency. It's recommended to "load once, use many times", to amortize the cost Note 2 :dict content will be copied internally, so dict can be released after loading. Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead. Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of how dictionary content is loaded and interpreted.

Definition at line 1714 of file zstd_decompress.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_DCtx_loadDictionary_advanced()

size_t ZSTD_DCtx_loadDictionary_advanced ( ZSTD_DCtx dctx,
const void *  dict,
size_t  dictSize,
ZSTD_dictLoadMethod_e  dictLoadMethod,
ZSTD_dictContentType_e  dictContentType 
)

Definition at line 1693 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_DCtx_loadDictionary_byReference()

size_t ZSTD_DCtx_loadDictionary_byReference ( ZSTD_DCtx dctx,
const void *  dict,
size_t  dictSize 
)

Definition at line 1709 of file zstd_decompress.c.

◆ ZSTD_DCtx_refDDict()

size_t ZSTD_DCtx_refDDict ( ZSTD_DCtx dctx,
const ZSTD_DDict ddict 
)

ZSTD_DCtx_refDDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used to decompress next frames. The dictionary remains active for decompression of future frames using 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, and can be freed with ZSTD_freeDCtx().

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

Returns
: 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.

Definition at line 1774 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_DCtx_refPrefix()

size_t ZSTD_DCtx_refPrefix ( ZSTD_DCtx dctx,
const void *  prefix,
size_t  prefixSize 
)

ZSTD_DCtx_refPrefix() : Requires v1.4.0+ Reference a prefix (single-usage dictionary) to decompress next frame. This is the reverse operation of ZSTD_CCtx_refPrefix(), and must use the same prefix as the one used during compression. Prefix is only used once. Reference is discarded at end of frame. End of frame is reached when ZSTD_decompressStream() returns 0.

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary Note 2 : Prefix buffer is referenced. It must outlive decompression. Prefix buffer must remain unmodified up to the end of frame, reached when ZSTD_decompressStream() returns 0. Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent). Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section) Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost. A full dictionary is more costly, as it requires building tables.

Definition at line 1726 of file zstd_decompress.c.

◆ ZSTD_DCtx_refPrefix_advanced()

size_t ZSTD_DCtx_refPrefix_advanced ( ZSTD_DCtx dctx,
const void *  prefix,
size_t  prefixSize,
ZSTD_dictContentType_e  dictContentType 
)

Definition at line 1719 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_DCtx_reset()

size_t ZSTD_DCtx_reset ( ZSTD_DCtx dctx,
ZSTD_ResetDirective  reset 
)

ZSTD_DCtx_reset() : Return a DCtx to clean state. Session and parameters can be reset jointly or separately. Parameters can only be reset when no active frame is being decompressed.

Returns
: 0, or an error code, which can be tested with ZSTD_isError()

Definition at line 1941 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_DCtx_setFormat()

size_t ZSTD_DCtx_setFormat ( ZSTD_DCtx dctx,
ZSTD_format_e  format 
)

Definition at line 1810 of file zstd_decompress.c.

◆ ZSTD_DCtx_setMaxWindowSize()

size_t ZSTD_DCtx_setMaxWindowSize ( ZSTD_DCtx dctx,
size_t  maxWindowSize 
)

Definition at line 1798 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_DCtx_setParameter()

size_t ZSTD_DCtx_setParameter ( ZSTD_DCtx dctx,
ZSTD_dParameter  param,
int  value 
)

ZSTD_DCtx_setParameter() : Set one compression parameter, selected by enum ZSTD_dParameter. All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds(). Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). Setting a parameter is only possible during frame initialization (before starting decompression).

Returns
: 0, or an error code (which can be tested using ZSTD_isError()).

Definition at line 1900 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_decodingBufferSize_min()

size_t ZSTD_decodingBufferSize_min ( unsigned long long  windowSize,
unsigned long long  frameContentSize 
)

Definition at line 1982 of file zstd_decompress.c.

◆ ZSTD_decompress()

size_t ZSTD_decompress ( void *  dst,
size_t  dstCapacity,
const void *  src,
size_t  compressedSize 
)

ZSTD_decompress() : compressedSize : must be the exact size of some number of compressed and/or skippable frames. dstCapacity is an upper bound of originalSize to regenerate. If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data.

Returns
: the number of bytes decompressed into dst (<= dstCapacity), or an errorCode if it fails (which can be tested using ZSTD_isError()).

Definition at line 1197 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_decompress_usingDDict()

size_t ZSTD_decompress_usingDDict ( ZSTD_DCtx dctx,
void *  dst,
size_t  dstCapacity,
const void *  src,
size_t  srcSize,
const ZSTD_DDict ddict 
)

ZSTD_decompress_usingDDict() : Decompression using a pre-digested Dictionary Use dictionary without significant overhead.

Definition at line 1650 of file zstd_decompress.c.

◆ ZSTD_decompress_usingDict()

size_t ZSTD_decompress_usingDict ( ZSTD_DCtx dctx,
void *  dst,
size_t  dstCapacity,
const void *  src,
size_t  srcSize,
const void *  dict,
size_t  dictSize 
)

ZSTD_decompress_usingDict() : Decompression using a known Dictionary. Dictionary must be identical to the one used during compression. Note : This function loads the dictionary, resulting in significant startup delay. It's intended for a dictionary used only once. Note : When dict == NULL || dictSize < 8 no dictionary is used.

Definition at line 1165 of file zstd_decompress.c.

◆ ZSTD_decompressBegin()

size_t ZSTD_decompressBegin ( ZSTD_DCtx dctx)

Definition at line 1554 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_decompressBegin_usingDDict()

size_t ZSTD_decompressBegin_usingDDict ( ZSTD_DCtx dctx,
const ZSTD_DDict ddict 
)

Definition at line 1595 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_decompressBegin_usingDict()

size_t ZSTD_decompressBegin_usingDict ( ZSTD_DCtx dctx,
const void *  dict,
size_t  dictSize 
)

Definition at line 1582 of file zstd_decompress.c.

◆ ZSTD_decompressBound()

unsigned long long ZSTD_decompressBound ( const void *  src,
size_t  srcSize 
)

ZSTD_decompressBound() : compatible with legacy mode src must point to the start of a ZSTD frame or a skippeable frame srcSize must be at least as large as the frame contained

Returns
: the maximum decompressed size of the compressed source

Definition at line 814 of file zstd_decompress.c.

◆ ZSTD_decompressContinue()

size_t ZSTD_decompressContinue ( ZSTD_DCtx dctx,
void *  dst,
size_t  dstCapacity,
const void *  src,
size_t  srcSize 
)

ZSTD_decompressContinue() : srcSize : must be the exact nb of bytes expected (see ZSTD_nextSrcSizeToDecompress())

Returns
: nb of bytes generated into dst (necessarily <= `dstCapacity) or an error code, which can be tested using ZSTD_isError()

Definition at line 1269 of file zstd_decompress.c.

◆ ZSTD_decompressDCtx()

size_t ZSTD_decompressDCtx ( ZSTD_DCtx dctx,
void *  dst,
size_t  dstCapacity,
const void *  src,
size_t  srcSize 
)

ZSTD_decompressDCtx() : Same as ZSTD_decompress(), requires an allocated ZSTD_DCtx. Compatible with sticky parameters (see below).

Definition at line 1191 of file zstd_decompress.c.

◆ ZSTD_decompressionMargin()

size_t ZSTD_decompressionMargin ( void const *  src,
size_t  srcSize 
)

Definition at line 832 of file zstd_decompress.c.

◆ ZSTD_decompressStream()

size_t ZSTD_decompressStream ( ZSTD_DStream zds,
ZSTD_outBuffer output,
ZSTD_inBuffer input 
)

ZSTD_decompressStream() : Streaming decompression function. Call repetitively to consume full input updating it as necessary. Function will update both input and output pos fields exposing current state via these fields:

  • input.pos < input.size, some input remaining and caller should provide remaining input on the next call.
  • output.pos < output.size, decoder finished and flushed all remaining buffers.
  • output.pos == output.size, potentially uncflushed data present in the internal buffers, call ZSTD_decompressStream() again to flush remaining data to output. Note : with no additional input, amount of data flushed <= ZSTD_BLOCKSIZE_MAX.
Returns
: 0 when a frame is completely decoded and fully flushed, or an error code, which can be tested using ZSTD_isError(), or any other value > 0, which means there is some decoding or flushing to do to complete current frame.

Note: when an operation returns with an error code, the @zds state may be left in undefined state. It's UB to invoke ZSTD_decompressStream() on such a state. In order to re-use such a state, it must be first reset, which can be done explicitly (ZSTD_DCtx_reset()), or is implied for operations starting some new decompression job (ZSTD_initDStream, ZSTD_decompressDCtx(), ZSTD_decompress_usingDict())

Definition at line 2080 of file zstd_decompress.c.

◆ ZSTD_decompressStream_simpleArgs()

size_t ZSTD_decompressStream_simpleArgs ( ZSTD_DCtx dctx,
void *  dst,
size_t  dstCapacity,
size_t *  dstPos,
const void *  src,
size_t  srcSize,
size_t *  srcPos 
)

Definition at line 2385 of file zstd_decompress.c.

◆ ZSTD_dParam_getBounds()

ZSTD_bounds ZSTD_dParam_getBounds ( ZSTD_dParameter  dParam)

ZSTD_dParam_getBounds() : All parameters must belong to an interval with lower and upper bounds, otherwise they will either trigger an error or be automatically clamped.

Returns
: a structure, ZSTD_bounds, which contains
  • an error status field, which must be tested using ZSTD_isError()
  • both lower and upper bounds, inclusive

Definition at line 1815 of file zstd_decompress.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_DStreamInSize()

size_t ZSTD_DStreamInSize ( void  )

recommended size for input buffer

Definition at line 1690 of file zstd_decompress.c.

◆ ZSTD_DStreamOutSize()

size_t ZSTD_DStreamOutSize ( void  )

recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances.

Definition at line 1691 of file zstd_decompress.c.

◆ ZSTD_estimateDCtxSize()

size_t ZSTD_estimateDCtxSize ( void  )

Definition at line 225 of file zstd_decompress.c.

◆ ZSTD_estimateDStreamSize()

size_t ZSTD_estimateDStreamSize ( size_t  windowSize)

Definition at line 1987 of file zstd_decompress.c.

◆ ZSTD_estimateDStreamSize_fromFrame()

size_t ZSTD_estimateDStreamSize_fromFrame ( const void *  src,
size_t  srcSize 
)

Definition at line 1995 of file zstd_decompress.c.

◆ ZSTD_findDecompressedSize()

unsigned long long ZSTD_findDecompressedSize ( const void *  src,
size_t  srcSize 
)

ZSTD_findDecompressedSize() : srcSize must be the exact length of some number of ZSTD compressed and/or skippable frames note: compatible with legacy mode

Returns
: decompressed size of the frames contained

Definition at line 637 of file zstd_decompress.c.

◆ ZSTD_findFrameCompressedSize()

size_t ZSTD_findFrameCompressedSize ( const void *  src,
size_t  srcSize 
)

ZSTD_findFrameCompressedSize() : See docs in zstd.h Note: compatible with legacy mode

Definition at line 803 of file zstd_decompress.c.

◆ ZSTD_frameHeaderSize()

size_t ZSTD_frameHeaderSize ( const void *  src,
size_t  srcSize 
)

ZSTD_frameHeaderSize() : srcSize must be >= ZSTD_frameHeaderSize_prefix.

Returns
: size of the Frame Header, or an error code (if srcSize is too small)

Definition at line 431 of file zstd_decompress.c.

◆ ZSTD_freeDCtx()

size_t ZSTD_freeDCtx ( ZSTD_DCtx dctx)

Definition at line 320 of file zstd_decompress.c.

◆ ZSTD_freeDStream()

size_t ZSTD_freeDStream ( ZSTD_DStream zds)

Definition at line 1682 of file zstd_decompress.c.

◆ ZSTD_getDecompressedSize()

unsigned long long ZSTD_getDecompressedSize ( const void *  src,
size_t  srcSize 
)

ZSTD_getDecompressedSize() : compatible with legacy mode

Returns
: decompressed size if known, 0 otherwise note : 0 can mean any of the following :
  • frame content is empty
  • decompressed size field is not present in frame header
  • frame header unknown / not supported
  • frame header not complete (srcSize too small)

Definition at line 684 of file zstd_decompress.c.

◆ ZSTD_getDictID_fromDict()

unsigned ZSTD_getDictID_fromDict ( const void *  dict,
size_t  dictSize 
)

ZSTD_getDictID_fromDict() : Provides the dictID stored within dictionary. if

Returns
== 0, the dictionary is not conformant with Zstandard specification. It can still be loaded, but as a content-only dictionary.

Definition at line 1618 of file zstd_decompress.c.

◆ ZSTD_getDictID_fromFrame()

unsigned ZSTD_getDictID_fromFrame ( const void *  src,
size_t  srcSize 
)

ZSTD_getDictID_fromFrame() : Provides the dictID required to decompress frame stored within src. If

Returns
== 0, the dictID could not be decoded. This could for one of the following reasons :
  • The frame does not require a dictionary (most common case).
  • The frame was built with dictID intentionally removed. Needed dictionary is a hidden piece of information. Note : this use case also happens when using a non-conformant dictionary.
  • srcSize is too small, and as a result, frame header could not be decoded. Note : possible if srcSize < ZSTD_FRAMEHEADERSIZE_MAX.
  • This is not a Zstandard frame. When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code.

Definition at line 1638 of file zstd_decompress.c.

◆ ZSTD_getFrameContentSize()

unsigned long long ZSTD_getFrameContentSize ( const void *  src,
size_t  srcSize 
)

ZSTD_getFrameContentSize() : compatible with legacy mode

Returns
: decompressed size of the single frame pointed to be src if known, otherwise
  • ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
  • ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small)

Definition at line 563 of file zstd_decompress.c.

◆ ZSTD_getFrameHeader()

size_t ZSTD_getFrameHeader ( ZSTD_frameHeader *  zfhPtr,
const void *  src,
size_t  srcSize 
)

ZSTD_getFrameHeader() : decode Frame Header, or require larger srcSize. note : this function does not consume input, it only reads it.

Returns
: 0, zfhPtr is correctly filled, >0, srcSize is too small, value is wanted srcSize amount, or an error code, which can be tested using ZSTD_isError()

Definition at line 553 of file zstd_decompress.c.

◆ ZSTD_getFrameHeader_advanced()

size_t ZSTD_getFrameHeader_advanced ( ZSTD_frameHeader *  zfhPtr,
const void *  src,
size_t  srcSize,
ZSTD_format_e  format 
)

ZSTD_getFrameHeader_advanced() : decode Frame Header, or require larger srcSize. note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless

Returns
: 0, zfhPtr is correctly filled, >0, srcSize is too small, value is wanted srcSize amount, or an error code, which can be tested using ZSTD_isError()

Definition at line 443 of file zstd_decompress.c.

◆ ZSTD_initDStream()

size_t ZSTD_initDStream ( ZSTD_DStream zds)

ZSTD_initDStream() : Initialize/reset DStream state for new decompression operation. Call before new decompression operation using same DStream.

Note : This function is redundant with the advanced API and equivalent to: ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); ZSTD_DCtx_refDDict(zds, NULL);

Definition at line 1744 of file zstd_decompress.c.

◆ ZSTD_initDStream_usingDDict()

size_t ZSTD_initDStream_usingDDict ( ZSTD_DStream dctx,
const ZSTD_DDict ddict 
)

Definition at line 1755 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_initDStream_usingDict()

size_t ZSTD_initDStream_usingDict ( ZSTD_DStream zds,
const void *  dict,
size_t  dictSize 
)

Definition at line 1735 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_initStaticDCtx()

ZSTD_DCtx * ZSTD_initStaticDCtx ( void *  workspace,
size_t  workspaceSize 
)

Definition at line 277 of file zstd_decompress.c.

Here is the caller graph for this function:

◆ ZSTD_initStaticDStream()

ZSTD_DStream * ZSTD_initStaticDStream ( void *  workspace,
size_t  workspaceSize 
)

Definition at line 1672 of file zstd_decompress.c.

◆ ZSTD_insertBlock()

size_t ZSTD_insertBlock ( ZSTD_DCtx dctx,
const void *  blockStart,
size_t  blockSize 
)

ZSTD_insertBlock() : insert src block into dctx history. Useful to track uncompressed blocks.

Definition at line 881 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_isFrame()

unsigned ZSTD_isFrame ( const void *  buffer,
size_t  size 
)

ZSTD_isFrame() : Tells if the content of buffer starts with a valid Frame Identifier. Note : Frame Identifier is 4 bytes. If size < 4,

Returns
will always be 0. Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. Note 3 : Skippable Frame Identifiers are considered valid.

Definition at line 381 of file zstd_decompress.c.

◆ ZSTD_isSkippableFrame()

unsigned ZSTD_isSkippableFrame ( const void *  buffer,
size_t  size 
)

ZSTD_isSkippableFrame() : Tells if the content of buffer starts with a valid Frame Identifier for a skippable frame. Note : Frame Identifier is 4 bytes. If size < 4,

Returns
will always be 0.

Definition at line 398 of file zstd_decompress.c.

◆ ZSTD_loadDEntropy()

size_t ZSTD_loadDEntropy ( ZSTD_entropyDTables_t entropy,
const void *const  dict,
size_t const  dictSize 
)

ZSTD_loadDEntropy() : dict : must point at beginning of a valid zstd dictionary.

Returns
: size of entropy tables read

Definition at line 1446 of file zstd_decompress.c.

◆ ZSTD_nextInputType()

ZSTD_nextInputType_e ZSTD_nextInputType ( ZSTD_DCtx dctx)

Definition at line 1238 of file zstd_decompress.c.

◆ ZSTD_nextSrcSizeToDecompress()

size_t ZSTD_nextSrcSizeToDecompress ( ZSTD_DCtx dctx)

Definition at line 1218 of file zstd_decompress.c.

◆ ZSTD_readSkippableFrame()

size_t ZSTD_readSkippableFrame ( void *  dst,
size_t  dstCapacity,
unsigned *  magicVariant,
const void *  src,
size_t  srcSize 
)

ZSTD_readSkippableFrame() : Retrieves content of a skippable frame, and writes it to dst buffer.

The parameter magicVariant will receive the magicVariant that was supplied when the frame was written, i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested in the magicVariant.

Returns an error if destination buffer is not large enough, or if this is not a valid skippable frame.

Returns
: number of bytes written or a ZSTD error.

Definition at line 608 of file zstd_decompress.c.

◆ ZSTD_resetDStream()

size_t ZSTD_resetDStream ( ZSTD_DStream dctx)

Definition at line 1766 of file zstd_decompress.c.

Here is the call graph for this function:

◆ ZSTD_sizeof_DCtx()

size_t ZSTD_sizeof_DCtx ( const ZSTD_DCtx dctx)

Definition at line 217 of file zstd_decompress.c.

◆ ZSTD_sizeof_DStream()

size_t ZSTD_sizeof_DStream ( const ZSTD_DStream dctx)

Definition at line 1959 of file zstd_decompress.c.