Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
zstd.h File Reference
#include <limits.h>
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  ZSTD_bounds
 
struct  ZSTD_inBuffer_s
 
struct  ZSTD_outBuffer_s
 

Macros

#define ZSTD_H_235446
 
#define ZSTDLIB_VISIBLE
 
#define ZSTDLIB_HIDDEN
 
#define ZSTDLIB_API   ZSTDLIB_VISIBLE
 
#define ZSTD_VERSION_MAJOR   1
 
#define ZSTD_VERSION_MINOR   5
 
#define ZSTD_VERSION_RELEASE   2
 
#define ZSTD_VERSION_NUMBER   (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
 
#define ZSTD_LIB_VERSION   ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE
 
#define ZSTD_QUOTE(str)
 
#define ZSTD_EXPAND_AND_QUOTE(str)
 
#define ZSTD_VERSION_STRING   ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
 
#define ZSTD_CLEVEL_DEFAULT   3
 
#define ZSTD_MAGICNUMBER   0xFD2FB528 /* valid since v0.8.0 */
 
#define ZSTD_MAGIC_DICTIONARY   0xEC30A437 /* valid since v0.7.0 */
 
#define ZSTD_MAGIC_SKIPPABLE_START   0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
 
#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
 
#define ZSTD_BLOCKSIZELOG_MAX   17
 
#define ZSTD_BLOCKSIZE_MAX   (1<<ZSTD_BLOCKSIZELOG_MAX)
 
#define ZSTD_CONTENTSIZE_UNKNOWN   (0ULL - 1)
 
#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
 
#define ZSTD_COMPRESSBOUND(srcSize)
 

Typedefs

typedef struct ZSTD_inBuffer_s ZSTD_inBuffer
 
typedef struct ZSTD_outBuffer_s ZSTD_outBuffer
 
typedef ZSTD_CCtx ZSTD_CStream
 
typedef ZSTD_DCtx ZSTD_DStream
 
typedef struct ZSTD_CDict_s ZSTD_CDict
 
typedef struct ZSTD_DDict_s ZSTD_DDict
 

Enumerations

enum  ZSTD_strategy {
  ZSTD_fast =1 , ZSTD_dfast =2 , ZSTD_greedy =3 , ZSTD_lazy =4 ,
  ZSTD_lazy2 =5 , ZSTD_btlazy2 =6 , ZSTD_btopt =7 , ZSTD_btultra =8 ,
  ZSTD_btultra2 =9
}
 
enum  ZSTD_cParameter {
  ZSTD_c_compressionLevel =100 , ZSTD_c_windowLog =101 , ZSTD_c_hashLog =102 , ZSTD_c_chainLog =103 ,
  ZSTD_c_searchLog =104 , ZSTD_c_minMatch =105 , ZSTD_c_targetLength =106 , ZSTD_c_strategy =107 ,
  ZSTD_c_enableLongDistanceMatching =160 , ZSTD_c_ldmHashLog =161 , ZSTD_c_ldmMinMatch =162 , ZSTD_c_ldmBucketSizeLog =163 ,
  ZSTD_c_ldmHashRateLog =164 , ZSTD_c_contentSizeFlag =200 , ZSTD_c_checksumFlag =201 , ZSTD_c_dictIDFlag =202 ,
  ZSTD_c_nbWorkers =400 , ZSTD_c_jobSize =401 , ZSTD_c_overlapLog =402 , ZSTD_c_experimentalParam1 =500 ,
  ZSTD_c_experimentalParam2 =10 , ZSTD_c_experimentalParam3 =1000 , ZSTD_c_experimentalParam4 =1001 , ZSTD_c_experimentalParam5 =1002 ,
  ZSTD_c_experimentalParam6 =1003 , ZSTD_c_experimentalParam7 =1004 , ZSTD_c_experimentalParam8 =1005 , ZSTD_c_experimentalParam9 =1006 ,
  ZSTD_c_experimentalParam10 =1007 , ZSTD_c_experimentalParam11 =1008 , ZSTD_c_experimentalParam12 =1009 , ZSTD_c_experimentalParam13 =1010 ,
  ZSTD_c_experimentalParam14 =1011 , ZSTD_c_experimentalParam15 =1012
}
 
enum  ZSTD_ResetDirective { ZSTD_reset_session_only = 1 , ZSTD_reset_parameters = 2 , ZSTD_reset_session_and_parameters = 3 }
 
enum  ZSTD_dParameter {
  ZSTD_d_windowLogMax =100 , ZSTD_d_experimentalParam1 =1000 , ZSTD_d_experimentalParam2 =1001 , ZSTD_d_experimentalParam3 =1002 ,
  ZSTD_d_experimentalParam4 =1003
}
 
enum  ZSTD_EndDirective { ZSTD_e_continue =0 , ZSTD_e_flush =1 , ZSTD_e_end =2 }
 

Functions

ZSTDLIB_API unsigned ZSTD_versionNumber (void)
 
ZSTDLIB_API const char * ZSTD_versionString (void)
 
ZSTDLIB_API size_t ZSTD_compress (void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
 
ZSTDLIB_API size_t ZSTD_decompress (void *dst, size_t dstCapacity, const void *src, size_t compressedSize)
 
ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize (const void *src, size_t srcSize)
 
ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize (const void *src, size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_findFrameCompressedSize (const void *src, size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_compressBound (size_t srcSize)
 
ZSTDLIB_API unsigned ZSTD_isError (size_t code)
 
ZSTDLIB_API const char * ZSTD_getErrorName (size_t code)
 
ZSTDLIB_API int ZSTD_minCLevel (void)
 
ZSTDLIB_API int ZSTD_maxCLevel (void)
 
ZSTDLIB_API int ZSTD_defaultCLevel (void)
 
ZSTDLIB_API ZSTD_CCtxZSTD_createCCtx (void)
 
ZSTDLIB_API size_t ZSTD_freeCCtx (ZSTD_CCtx *cctx)
 
ZSTDLIB_API size_t ZSTD_compressCCtx (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
 
ZSTDLIB_API ZSTD_DCtxZSTD_createDCtx (void)
 
ZSTDLIB_API size_t ZSTD_freeDCtx (ZSTD_DCtx *dctx)
 
ZSTDLIB_API size_t ZSTD_decompressDCtx (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
ZSTDLIB_API ZSTD_bounds ZSTD_cParam_getBounds (ZSTD_cParameter cParam)
 
ZSTDLIB_API size_t ZSTD_CCtx_setParameter (ZSTD_CCtx *cctx, ZSTD_cParameter param, int value)
 
ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize (ZSTD_CCtx *cctx, unsigned long long pledgedSrcSize)
 
ZSTDLIB_API size_t ZSTD_CCtx_reset (ZSTD_CCtx *cctx, ZSTD_ResetDirective reset)
 
ZSTDLIB_API size_t ZSTD_compress2 (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
ZSTDLIB_API ZSTD_bounds ZSTD_dParam_getBounds (ZSTD_dParameter dParam)
 
ZSTDLIB_API size_t ZSTD_DCtx_setParameter (ZSTD_DCtx *dctx, ZSTD_dParameter param, int value)
 
ZSTDLIB_API size_t ZSTD_DCtx_reset (ZSTD_DCtx *dctx, ZSTD_ResetDirective reset)
 
ZSTDLIB_API ZSTD_CStreamZSTD_createCStream (void)
 
ZSTDLIB_API size_t ZSTD_freeCStream (ZSTD_CStream *zcs)
 
ZSTDLIB_API size_t ZSTD_compressStream2 (ZSTD_CCtx *cctx, ZSTD_outBuffer *output, ZSTD_inBuffer *input, ZSTD_EndDirective endOp)
 
ZSTDLIB_API size_t ZSTD_CStreamInSize (void)
 
ZSTDLIB_API size_t ZSTD_CStreamOutSize (void)
 
ZSTDLIB_API size_t ZSTD_initCStream (ZSTD_CStream *zcs, int compressionLevel)
 
ZSTDLIB_API size_t ZSTD_compressStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 
ZSTDLIB_API size_t ZSTD_flushStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output)
 
ZSTDLIB_API size_t ZSTD_endStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output)
 
ZSTDLIB_API ZSTD_DStreamZSTD_createDStream (void)
 
ZSTDLIB_API size_t ZSTD_freeDStream (ZSTD_DStream *zds)
 
ZSTDLIB_API size_t ZSTD_initDStream (ZSTD_DStream *zds)
 
ZSTDLIB_API size_t ZSTD_decompressStream (ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 
ZSTDLIB_API size_t ZSTD_DStreamInSize (void)
 
ZSTDLIB_API size_t ZSTD_DStreamOutSize (void)
 
ZSTDLIB_API size_t ZSTD_compress_usingDict (ZSTD_CCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize, int compressionLevel)
 
ZSTDLIB_API 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)
 
ZSTDLIB_API ZSTD_CDictZSTD_createCDict (const void *dictBuffer, size_t dictSize, int compressionLevel)
 
ZSTDLIB_API size_t ZSTD_freeCDict (ZSTD_CDict *CDict)
 
ZSTDLIB_API size_t ZSTD_compress_usingCDict (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_CDict *cdict)
 
ZSTDLIB_API ZSTD_DDictZSTD_createDDict (const void *dictBuffer, size_t dictSize)
 
ZSTDLIB_API size_t ZSTD_freeDDict (ZSTD_DDict *ddict)
 
ZSTDLIB_API size_t ZSTD_decompress_usingDDict (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
 
ZSTDLIB_API unsigned ZSTD_getDictID_fromDict (const void *dict, size_t dictSize)
 
ZSTDLIB_API unsigned ZSTD_getDictID_fromCDict (const ZSTD_CDict *cdict)
 
ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict (const ZSTD_DDict *ddict)
 
ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame (const void *src, size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary (ZSTD_CCtx *cctx, const void *dict, size_t dictSize)
 
ZSTDLIB_API size_t ZSTD_CCtx_refCDict (ZSTD_CCtx *cctx, const ZSTD_CDict *cdict)
 
ZSTDLIB_API size_t ZSTD_CCtx_refPrefix (ZSTD_CCtx *cctx, const void *prefix, size_t prefixSize)
 
ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary (ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 
ZSTDLIB_API size_t ZSTD_DCtx_refDDict (ZSTD_DCtx *dctx, const ZSTD_DDict *ddict)
 
ZSTDLIB_API size_t ZSTD_DCtx_refPrefix (ZSTD_DCtx *dctx, const void *prefix, size_t prefixSize)
 
ZSTDLIB_API size_t ZSTD_sizeof_CCtx (const ZSTD_CCtx *cctx)
 
ZSTDLIB_API size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx *dctx)
 
ZSTDLIB_API size_t ZSTD_sizeof_CStream (const ZSTD_CStream *zcs)
 
ZSTDLIB_API size_t ZSTD_sizeof_DStream (const ZSTD_DStream *zds)
 
ZSTDLIB_API size_t ZSTD_sizeof_CDict (const ZSTD_CDict *cdict)
 
ZSTDLIB_API size_t ZSTD_sizeof_DDict (const ZSTD_DDict *ddict)
 

Macro Definition Documentation

◆ ZSTD_BLOCKSIZE_MAX

#define ZSTD_BLOCKSIZE_MAX   (1<<ZSTD_BLOCKSIZELOG_MAX)

◆ ZSTD_BLOCKSIZELOG_MAX

#define ZSTD_BLOCKSIZELOG_MAX   17

◆ ZSTD_CLEVEL_DEFAULT

#define ZSTD_CLEVEL_DEFAULT   3

◆ ZSTD_COMPRESSBOUND

#define ZSTD_COMPRESSBOUND ( srcSize)
Value:
((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
char int srcSize
Definition lz4.h:806

◆ ZSTD_CONTENTSIZE_ERROR

#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)

◆ ZSTD_CONTENTSIZE_UNKNOWN

#define ZSTD_CONTENTSIZE_UNKNOWN   (0ULL - 1)

ZSTD_getFrameContentSize() : requires v1.3.0+ src should point to the start of a ZSTD encoded frame. srcSize must be at least as large as the frame header. hint : any size >= ZSTD_frameHeaderSize_max is large enough.

Returns
: - decompressed size of src frame content, if known
  • ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
  • ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) note 1 : a 0 return value means the frame is valid but "empty". note 2 : decompressed size is an optional field, it may not be present, typically in streaming mode. When return==ZSTD_CONTENTSIZE_UNKNOWN, data to decompress could be any size. In which case, it's necessary to use streaming mode to decompress data. Optionally, application can rely on some implicit limit, as ZSTD_decompress() only needs an upper bound of decompressed size. (For example, data could be necessarily cut into blocks <= 16 KB). note 3 : decompressed size is always present when compression is completed using single-pass functions, such as ZSTD_compress(), ZSTD_compressCCtx() ZSTD_compress_usingDict() or ZSTD_compress_usingCDict(). note 4 : decompressed size can be very large (64-bits value), potentially larger than what local system can handle as a single memory segment. In which case, it's necessary to use streaming mode to decompress data. note 5 : If source is untrusted, decompressed size could be wrong or intentionally modified. Always ensure return value fits within application's authorized limits. Each application can set its own limits. note 6 : This function replaces ZSTD_getDecompressedSize()

◆ ZSTD_EXPAND_AND_QUOTE

#define ZSTD_EXPAND_AND_QUOTE ( str)
Value:
const char * str
Table column heading string.
Definition list.c:109
#define ZSTD_QUOTE(str)
Definition zstd.h:85

◆ ZSTD_H_235446

#define ZSTD_H_235446

◆ ZSTD_LIB_VERSION

◆ ZSTD_MAGIC_DICTIONARY

#define ZSTD_MAGIC_DICTIONARY   0xEC30A437 /* valid since v0.7.0 */

◆ ZSTD_MAGIC_SKIPPABLE_MASK

#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0

◆ ZSTD_MAGIC_SKIPPABLE_START

#define ZSTD_MAGIC_SKIPPABLE_START   0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */

◆ ZSTD_MAGICNUMBER

#define ZSTD_MAGICNUMBER   0xFD2FB528 /* valid since v0.8.0 */

◆ ZSTD_QUOTE

#define ZSTD_QUOTE ( str)
Value:
#str

◆ ZSTD_VERSION_MAJOR

#define ZSTD_VERSION_MAJOR   1

◆ ZSTD_VERSION_MINOR

#define ZSTD_VERSION_MINOR   5

◆ ZSTD_VERSION_NUMBER

#define ZSTD_VERSION_NUMBER   (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)

◆ ZSTD_VERSION_RELEASE

#define ZSTD_VERSION_RELEASE   2

◆ ZSTD_VERSION_STRING

#define ZSTD_VERSION_STRING   ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)

◆ ZSTDLIB_API

#define ZSTDLIB_API   ZSTDLIB_VISIBLE

◆ ZSTDLIB_HIDDEN

#define ZSTDLIB_HIDDEN

◆ ZSTDLIB_VISIBLE

#define ZSTDLIB_VISIBLE

Typedef Documentation

◆ ZSTD_CDict

typedef struct ZSTD_CDict_s ZSTD_CDict

◆ ZSTD_CStream

CCtx and CStream are now effectively same object (>= v1.3.0)

◆ ZSTD_DDict

typedef struct ZSTD_DDict_s ZSTD_DDict

◆ ZSTD_DStream

DCtx and DStream are now effectively same object (>= v1.3.0)

◆ ZSTD_inBuffer

◆ ZSTD_outBuffer

Enumeration Type Documentation

◆ ZSTD_cParameter

Enumerator
ZSTD_c_compressionLevel 
ZSTD_c_windowLog 
ZSTD_c_hashLog 
ZSTD_c_chainLog 
ZSTD_c_searchLog 
ZSTD_c_minMatch 
ZSTD_c_targetLength 
ZSTD_c_strategy 
ZSTD_c_enableLongDistanceMatching 
ZSTD_c_ldmHashLog 
ZSTD_c_ldmMinMatch 
ZSTD_c_ldmBucketSizeLog 
ZSTD_c_ldmHashRateLog 
ZSTD_c_contentSizeFlag 
ZSTD_c_checksumFlag 
ZSTD_c_dictIDFlag 
ZSTD_c_nbWorkers 
ZSTD_c_jobSize 
ZSTD_c_overlapLog 
ZSTD_c_experimentalParam1 
ZSTD_c_experimentalParam2 
ZSTD_c_experimentalParam3 
ZSTD_c_experimentalParam4 
ZSTD_c_experimentalParam5 
ZSTD_c_experimentalParam6 
ZSTD_c_experimentalParam7 
ZSTD_c_experimentalParam8 
ZSTD_c_experimentalParam9 
ZSTD_c_experimentalParam10 
ZSTD_c_experimentalParam11 
ZSTD_c_experimentalParam12 
ZSTD_c_experimentalParam13 
ZSTD_c_experimentalParam14 
ZSTD_c_experimentalParam15 

◆ ZSTD_dParameter

Enumerator
ZSTD_d_windowLogMax 
ZSTD_d_experimentalParam1 
ZSTD_d_experimentalParam2 
ZSTD_d_experimentalParam3 
ZSTD_d_experimentalParam4 

◆ ZSTD_EndDirective

Enumerator
ZSTD_e_continue 
ZSTD_e_flush 
ZSTD_e_end 

◆ ZSTD_ResetDirective

Enumerator
ZSTD_reset_session_only 
ZSTD_reset_parameters 
ZSTD_reset_session_and_parameters 

◆ ZSTD_strategy

Enumerator
ZSTD_fast 
ZSTD_dfast 
ZSTD_greedy 
ZSTD_lazy 
ZSTD_lazy2 
ZSTD_btlazy2 
ZSTD_btopt 
ZSTD_btultra 
ZSTD_btultra2 

Function Documentation

◆ ZSTD_CCtx_loadDictionary()

ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary ( ZSTD_CCtx * cctx,
const void * dict,
size_t dictSize )

ZSTD_CCtx_loadDictionary() : Requires v1.4.0+ Create an internal CDict from dict buffer. Decompression will have to use same dictionary.

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary, meaning "return to no-dictionary mode". Note 1 : Dictionary is sticky, it will be used for all future compressed frames. To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters). Note 2 : Loading a dictionary involves building tables. It's also a CPU consuming operation, with non-negligible impact on latency. Tables are dependent on compression parameters, and for this reason, compression parameters can no longer be changed after loading a dictionary. Note 3 :dict content will be copied internally. Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead. In such a case, dictionary buffer must outlive its users. Note 4 : Use ZSTD_CCtx_loadDictionary_advanced() to precisely select how dictionary content must be interpreted.

◆ ZSTD_CCtx_refCDict()

ZSTDLIB_API size_t ZSTD_CCtx_refCDict ( ZSTD_CCtx * cctx,
const ZSTD_CDict * cdict )

ZSTD_CCtx_refCDict() : Requires v1.4.0+ Reference a prepared dictionary, to be used for all next compressed frames. Note that compression parameters are enforced from within CDict, and supersede any compression parameter previously set within CCtx. The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. The ignored parameters will be used again if the CCtx is returned to no-dictionary mode. The dictionary will remain valid for future compressed frames using same CCtx.

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Special : Referencing a NULL CDict means "return to no-dictionary mode". Note 1 : Currently, only one dictionary can be managed. Referencing a new dictionary effectively "discards" any previous one. Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx.

◆ ZSTD_CCtx_refPrefix()

ZSTDLIB_API size_t ZSTD_CCtx_refPrefix ( ZSTD_CCtx * cctx,
const void * prefix,
size_t prefixSize )

ZSTD_CCtx_refPrefix() : Requires v1.4.0+ Reference a prefix (single-usage dictionary) for next compressed frame. A prefix is only used once. Tables are discarded at end of frame (ZSTD_e_end). Decompression will need same prefix to properly regenerate data. Compressing with a prefix is similar in outcome as performing a diff and compressing it, but performs much faster, especially during decompression (compression speed is tunable with compression level).

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary Note 1 : Prefix buffer is referenced. It must outlive compression. Its content must remain unmodified during compression. Note 2 : If the intention is to diff some large src data blob with some prior version of itself, ensure that the window size is large enough to contain the entire source. See ZSTD_c_windowLog. Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters. It's a CPU consuming operation, with non-negligible impact on latency. If there is a need to use the same prefix multiple times, consider loadDictionary instead. Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent). Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation.

◆ ZSTD_CCtx_reset()

ZSTDLIB_API size_t ZSTD_CCtx_reset ( ZSTD_CCtx * cctx,
ZSTD_ResetDirective reset )

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. 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 removes any reference to any dictionary too. 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.

ZSTD_CCtx_reset() : Also dumps dictionary

◆ ZSTD_CCtx_setParameter()

ZSTDLIB_API size_t ZSTD_CCtx_setParameter ( ZSTD_CCtx * cctx,
ZSTD_cParameter param,
int value )

ZSTD_CCtx_setParameter() : Set one compression parameter, selected by enum ZSTD_cParameter. All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds(). Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). Setting a parameter is generally only possible during frame initialization (before starting compression). Exception : when using multi-threading mode (nbWorkers >= 1), the following parameters can be updated during compression (within same frame): => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy. new parameters will be active for next job only (after a flush()).

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

◆ ZSTD_CCtx_setPledgedSrcSize()

ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize ( ZSTD_CCtx * cctx,
unsigned long long pledgedSrcSize )

ZSTD_CCtx_setPledgedSrcSize() : Total input data size to be compressed as a single frame. Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag. This value will also be controlled at end of frame, and trigger an error if not respected.

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame. In order to mean "unknown content size", pass constant ZSTD_CONTENTSIZE_UNKNOWN. ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame. Note 2 : pledgedSrcSize is only valid once, for the next frame. It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN. Note 3 : Whenever all input data is provided and consumed in a single round, for example with ZSTD_compress2(), or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end), this value is automatically overridden by srcSize instead.

◆ ZSTD_compress()

ZSTDLIB_API size_t ZSTD_compress ( void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
int compressionLevel )

ZSTD_compress() : Compresses src content as a single zstd compressed frame into already allocated dst. Hint : compression runs faster if dstCapacity >= ZSTD_compressBound(srcSize).

Returns
: compressed size written into dst (<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()).

◆ ZSTD_compress2()

ZSTDLIB_API size_t ZSTD_compress2 ( ZSTD_CCtx * cctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize )

ZSTD_compress2() : Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API. ZSTD_compress2() always starts a new frame. Should cctx hold data from a previously unfinished frame, everything about it is forgotten.

  • Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
  • The function is always blocking, returns when compression is completed. Hint : compression runs faster if dstCapacity >= ZSTD_compressBound(srcSize).
    Returns
    : compressed size written into dst (<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()).

◆ ZSTD_compress_usingCDict()

ZSTDLIB_API size_t ZSTD_compress_usingCDict ( ZSTD_CCtx * cctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
const ZSTD_CDict * cdict )

ZSTD_compress_usingCDict() : Compression using a digested Dictionary. Recommended when same dictionary is used multiple times. Note : compression level is decided at dictionary creation time, and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)

ZSTD_compress_usingCDict() : Compression using a digested Dictionary. Faster startup than ZSTD_compress_usingDict(), recommended when same dictionary is used multiple times. Note that compression parameters are decided at CDict creation time while frame parameters are hardcoded

◆ ZSTD_compress_usingDict()

ZSTDLIB_API size_t ZSTD_compress_usingDict ( ZSTD_CCtx * ctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
const void * dict,
size_t dictSize,
int compressionLevel )

ZSTD_compress_usingDict() : Compression at an explicit compression level using a Dictionary. A dictionary can be any arbitrary data segment (also called a prefix), or a buffer with specified information (see zdict.h). Note : This function loads the dictionary, resulting in significant startup delay. It's intended for a dictionary used only once. Note 2 : When dict == NULL || dictSize < 8 no dictionary is used.

◆ ZSTD_compressBound()

ZSTDLIB_API size_t ZSTD_compressBound ( size_t srcSize)

maximum compressed size in worst case single-pass scenario

◆ ZSTD_compressCCtx()

ZSTDLIB_API size_t ZSTD_compressCCtx ( ZSTD_CCtx * cctx,
void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize,
int compressionLevel )

ZSTD_compressCCtx() : Same as ZSTD_compress(), using an explicit ZSTD_CCtx. Important : in order to behave similarly to ZSTD_compress(), this function compresses at requested compression level, ignoring any other parameter . If any advanced parameter was set using the advanced API, they will all be reset. Only compressionLevel remains.

◆ ZSTD_compressStream()

ZSTDLIB_API size_t ZSTD_compressStream ( ZSTD_CStream * zcs,
ZSTD_outBuffer * output,
ZSTD_inBuffer * input )

Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue). NOTE: The return value is different. ZSTD_compressStream() returns a hint for the next read size (if non-zero and not an error). ZSTD_compressStream2() returns the minimum nb of bytes left to flush (if non-zero and not an error).

◆ ZSTD_compressStream2()

ZSTDLIB_API size_t ZSTD_compressStream2 ( ZSTD_CCtx * cctx,
ZSTD_outBuffer * output,
ZSTD_inBuffer * input,
ZSTD_EndDirective endOp )

ZSTD_compressStream2() : Requires v1.4.0+ Behaves about the same as ZSTD_compressStream, with additional control on end directive.

  • Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
  • Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode)
  • output->pos must be <= dstCapacity, input->pos must be <= srcSize
  • output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit.
  • endOp must be a valid directive
  • When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller.
  • When nbWorkers>=1, function is non-blocking : it copies a portion of input, distributes jobs to internal worker threads, flush to output whatever is available, and then immediately returns, just indicating that there is some data remaining to be flushed. The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte.
  • Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity, the function delegates to ZSTD_compress2() which is always blocking.
  • Returns
    provides a minimum amount of data remaining to be flushed from internal buffers or an error code, which can be tested using ZSTD_isError(). if
    != 0, flush is not fully completed, there is still some data left within internal buffers. This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers. For ZSTD_e_end,
    == 0 when internal buffers are fully flushed and frame is completed.
  • after a ZSTD_e_end directive, if internal buffer is not fully flushed (
    Returns
    != 0), only ZSTD_e_end or ZSTD_e_flush operations are allowed. Before starting a new compression job, or changing compression parameters, it is required to fully flush internal buffers.

◆ ZSTD_cParam_getBounds()

ZSTDLIB_API ZSTD_bounds ZSTD_cParam_getBounds ( ZSTD_cParameter cParam)

ZSTD_cParam_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()
  • lower and upper bounds, both inclusive

◆ ZSTD_createCCtx()

ZSTDLIB_API ZSTD_CCtx * ZSTD_createCCtx ( void )

◆ ZSTD_createCDict()

ZSTDLIB_API ZSTD_CDict * ZSTD_createCDict ( const void * dictBuffer,
size_t dictSize,
int compressionLevel )

ZSTD_createCDict() : When compressing multiple messages or blocks using the same dictionary, it's recommended to digest the dictionary only once, since it's a costly operation. ZSTD_createCDict() will create a state from digesting a dictionary. The resulting state can be used for future compression operations with very limited startup cost. ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict. Note 1 : Consider experimental function ZSTD_createCDict_byReference() if you prefer to not duplicate @dictBuffer content. Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer, in which case the only thing that it transports is the @compressionLevel. This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively, expecting a ZSTD_CDict parameter with any data, including those without a known dictionary.

◆ ZSTD_createCStream()

ZSTDLIB_API ZSTD_CStream * ZSTD_createCStream ( void )

◆ ZSTD_createDCtx()

ZSTDLIB_API ZSTD_DCtx * ZSTD_createDCtx ( void )

◆ ZSTD_createDDict()

ZSTDLIB_API ZSTD_DDict * ZSTD_createDDict ( const void * dict,
size_t dictSize )

ZSTD_createDDict() : Create a digested dictionary, ready to start decompression operation without startup delay. dictBuffer can be released after DDict creation, as its content is copied inside DDict.

ZSTD_createDDict() : Create a digested dictionary, to start decompression without startup delay. dict content is copied inside DDict. Consequently, dict can be released after ZSTD_DDict creation

◆ ZSTD_createDStream()

ZSTDLIB_API ZSTD_DStream * ZSTD_createDStream ( void )

◆ ZSTD_CStreamInSize()

ZSTDLIB_API size_t ZSTD_CStreamInSize ( void )

recommended size for input buffer

◆ ZSTD_CStreamOutSize()

ZSTDLIB_API size_t ZSTD_CStreamOutSize ( void )

recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block.

◆ ZSTD_DCtx_loadDictionary()

ZSTDLIB_API 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 next frames. The dictionary remains valid for all future frames, until explicitly invalidated.

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.

◆ ZSTD_DCtx_refDDict()

ZSTDLIB_API 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().

Returns
: 0, or an error code (which can be tested with ZSTD_isError()). Note 1 : Currently, only one dictionary can be managed. Referencing a new dictionary effectively "discards" any previous one. 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.

◆ ZSTD_DCtx_refPrefix()

ZSTDLIB_API 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.

◆ ZSTD_DCtx_reset()

ZSTDLIB_API 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()

◆ ZSTD_DCtx_setParameter()

ZSTDLIB_API 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()).

◆ ZSTD_decompress()

ZSTDLIB_API size_t ZSTD_decompress ( void * dst,
size_t dstCapacity,
const void * src,
size_t srcSize )

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()).

For the case where the decompression library hasn't been included we add a dummy function to fake the process and stop the buffers being optimised out.

Zstandard decompression functions. dst must point to a space at least as large as the reconstructed output.

For the case where the decompression library hasn't been included we add a dummy function to fake the process and stop the buffers being optimised out.

◆ ZSTD_decompress_usingDDict()

ZSTDLIB_API 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 digested Dictionary. Recommended when same dictionary is used multiple times.

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

◆ ZSTD_decompress_usingDict()

ZSTDLIB_API 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.

◆ ZSTD_decompressDCtx()

ZSTDLIB_API 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.

◆ ZSTD_decompressStream()

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

◆ ZSTD_defaultCLevel()

ZSTDLIB_API int ZSTD_defaultCLevel ( void )

default compression level, specified by ZSTD_CLEVEL_DEFAULT, requires v1.5.0+

◆ ZSTD_dParam_getBounds()

ZSTDLIB_API 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

◆ ZSTD_DStreamInSize()

ZSTDLIB_API size_t ZSTD_DStreamInSize ( void )

recommended size for input buffer

◆ ZSTD_DStreamOutSize()

ZSTDLIB_API size_t ZSTD_DStreamOutSize ( void )

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

◆ ZSTD_endStream()

ZSTDLIB_API size_t ZSTD_endStream ( ZSTD_CStream * zcs,
ZSTD_outBuffer * output )

Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end).

◆ ZSTD_findFrameCompressedSize()

ZSTDLIB_API size_t ZSTD_findFrameCompressedSize ( const void * src,
size_t srcSize )

ZSTD_findFrameCompressedSize() : Requires v1.4.0+ src should point to the start of a ZSTD frame or skippable frame. srcSize must be >= first frame size

Returns
: the compressed size of the first frame starting at src, suitable to pass as srcSize to ZSTD_decompress or similar, or an error code if input is invalid

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

Returns
: the compressed size of the frame starting at src

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

◆ ZSTD_flushStream()

ZSTDLIB_API size_t ZSTD_flushStream ( ZSTD_CStream * zcs,
ZSTD_outBuffer * output )

Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush).

ZSTD_flushStream() :

Returns
: amount of data remaining to flush

◆ ZSTD_freeCCtx()

ZSTDLIB_API size_t ZSTD_freeCCtx ( ZSTD_CCtx * cctx)

◆ ZSTD_freeCDict()

ZSTDLIB_API size_t ZSTD_freeCDict ( ZSTD_CDict * CDict)

ZSTD_freeCDict() : Function frees memory allocated by ZSTD_createCDict(). If a NULL pointer is passed, no operation is performed.

◆ ZSTD_freeCStream()

ZSTDLIB_API size_t ZSTD_freeCStream ( ZSTD_CStream * zcs)

◆ ZSTD_freeDCtx()

ZSTDLIB_API size_t ZSTD_freeDCtx ( ZSTD_DCtx * dctx)

◆ ZSTD_freeDDict()

ZSTDLIB_API size_t ZSTD_freeDDict ( ZSTD_DDict * ddict)

ZSTD_freeDDict() : Function frees memory allocated with ZSTD_createDDict() If a NULL pointer is passed, no operation is performed.

◆ ZSTD_freeDStream()

ZSTDLIB_API size_t ZSTD_freeDStream ( ZSTD_DStream * zds)

◆ ZSTD_getDecompressedSize()

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

ZSTD_getDecompressedSize() : NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize(). Both functions work the same way, but ZSTD_getDecompressedSize() blends "empty", "unknown" and "error" results to the same return value (0), while ZSTD_getFrameContentSize() gives them separate return values.

Returns
: decompressed size of src frame content if known and not empty, 0 otherwise.

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)

◆ ZSTD_getDictID_fromCDict()

ZSTDLIB_API unsigned ZSTD_getDictID_fromCDict ( const ZSTD_CDict * cdict)

ZSTD_getDictID_fromCDict() : Requires v1.5.0+ Provides the dictID of the dictionary loaded into cdict. If

Returns
== 0, the dictionary is not conformant to Zstandard specification, or empty. Non-conformant dictionaries can still be loaded, but as content-only dictionaries.

ZSTD_getDictID_fromCDict() : Provides the dictID of the dictionary loaded into cdict. If

Returns
== 0, the dictionary is not conformant to Zstandard specification, or empty. Non-conformant dictionaries can still be loaded, but as content-only dictionaries.

◆ ZSTD_getDictID_fromDDict()

ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict ( const ZSTD_DDict * ddict)

ZSTD_getDictID_fromDDict() : Requires v1.4.0+ Provides the dictID of the dictionary loaded into ddict. If

Returns
== 0, the dictionary is not conformant to Zstandard specification, or empty. Non-conformant dictionaries can still be loaded, but as content-only dictionaries.

ZSTD_getDictID_fromDDict() : Provides the dictID of the dictionary loaded into ddict. If

Returns
== 0, the dictionary is not conformant to Zstandard specification, or empty. Non-conformant dictionaries can still be loaded, but as content-only dictionaries.

◆ ZSTD_getDictID_fromDict()

ZSTDLIB_API unsigned ZSTD_getDictID_fromDict ( const void * dict,
size_t dictSize )

ZSTD_getDictID_fromDict() : Requires v1.4.0+ 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.

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.

◆ ZSTD_getDictID_fromFrame()

ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame ( const void * src,
size_t srcSize )

ZSTD_getDictID_fromFrame() : Requires v1.4.0+ Provides the dictID required to decompressed the 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 to be decoded (most common case).
  • The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information. Note : this use case also happens when using a non-conformant dictionary.
  • srcSize is too small, and as a result, the frame header could not be decoded (only 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.

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

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.

◆ ZSTD_getErrorName()

ZSTDLIB_API const char * ZSTD_getErrorName ( size_t code)

provides readable string from an error code

ZSTD_getErrorName() : provides error code string from function result (useful for debugging)

◆ ZSTD_getFrameContentSize()

ZSTDLIB_API 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)

◆ ZSTD_initCStream()

ZSTDLIB_API size_t ZSTD_initCStream ( ZSTD_CStream * zcs,
int compressionLevel )

Equivalent to:

ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)
ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);

◆ ZSTD_initDStream()

ZSTDLIB_API size_t ZSTD_initDStream ( ZSTD_DStream * zds)

◆ ZSTD_isError()

ZSTDLIB_API unsigned ZSTD_isError ( size_t code)

tells if a size_t function result is an error code

ZSTD_isError() : tells if a return value is an error code symbol is required for external callers

◆ ZSTD_maxCLevel()

ZSTDLIB_API int ZSTD_maxCLevel ( void )

maximum compression level available

◆ ZSTD_minCLevel()

ZSTDLIB_API int ZSTD_minCLevel ( void )

minimum negative compression level allowed, requires v1.4.0+

◆ ZSTD_sizeof_CCtx()

ZSTDLIB_API size_t ZSTD_sizeof_CCtx ( const ZSTD_CCtx * cctx)

ZSTD_sizeof_*() : Requires v1.4.0+ These functions give the current memory usage of selected object. Note that object memory usage can evolve (increase or decrease) over time.

◆ ZSTD_sizeof_CDict()

ZSTDLIB_API size_t ZSTD_sizeof_CDict ( const ZSTD_CDict * cdict)

◆ ZSTD_sizeof_CStream()

ZSTDLIB_API size_t ZSTD_sizeof_CStream ( const ZSTD_CStream * zcs)

◆ ZSTD_sizeof_DCtx()

ZSTDLIB_API size_t ZSTD_sizeof_DCtx ( const ZSTD_DCtx * dctx)

◆ ZSTD_sizeof_DDict()

ZSTDLIB_API size_t ZSTD_sizeof_DDict ( const ZSTD_DDict * ddict)

◆ ZSTD_sizeof_DStream()

ZSTDLIB_API size_t ZSTD_sizeof_DStream ( const ZSTD_DStream * zds)

◆ ZSTD_versionNumber()

ZSTDLIB_API unsigned ZSTD_versionNumber ( void )

ZSTD_versionNumber() : Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE).

◆ ZSTD_versionString()

ZSTDLIB_API const char * ZSTD_versionString ( void )

ZSTD_versionString() : Return runtime library version, like "1.4.5". Requires v1.3.0+.