Classes | Macros | Typedefs | Enumerations | Functions
zstd.h File Reference
#include <limits.h>
#include <stddef.h>
Include dependency graph for zstd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ZSTD_bounds
 
struct  ZSTD_inBuffer_s
 
struct  ZSTD_outBuffer_s
 

Macros

#define ZSTD_BLOCKSIZE_MAX   (1<<ZSTD_BLOCKSIZELOG_MAX)
 
#define ZSTD_BLOCKSIZELOG_MAX   17
 
#define ZSTD_CLEVEL_DEFAULT   3
 
#define ZSTD_COMPRESSBOUND(srcSize)   (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (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 */
 
#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
 
#define ZSTD_CONTENTSIZE_UNKNOWN   (0ULL - 1)
 
#define ZSTD_DEPRECATED(message)
 
#define ZSTD_EXPAND_AND_QUOTE(str)   ZSTD_QUOTE(str)
 
#define ZSTD_H_235446
 
#define ZSTD_LIB_VERSION   ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE
 
#define ZSTD_MAGIC_DICTIONARY   0xEC30A437 /* valid since v0.7.0 */
 
#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
 
#define ZSTD_MAGIC_SKIPPABLE_START   0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
 
#define ZSTD_MAGICNUMBER   0xFD2FB528 /* valid since v0.8.0 */
 
#define ZSTD_MAX_INPUT_SIZE   ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U)
 
#define ZSTD_QUOTE(str)   #str
 
#define ZSTD_VERSION_MAJOR   1
 
#define ZSTD_VERSION_MINOR   5
 
#define ZSTD_VERSION_NUMBER   (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
 
#define ZSTD_VERSION_RELEASE   5
 
#define ZSTD_VERSION_STRING   ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
 
#define ZSTDLIB_API   ZSTDLIB_VISIBLE
 
#define ZSTDLIB_HIDDEN
 
#define ZSTDLIB_VISIBLE
 

Typedefs

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

Enumerations

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, ZSTD_c_experimentalParam16 =1013, ZSTD_c_experimentalParam17 =1014,
  ZSTD_c_experimentalParam18 =1015, ZSTD_c_experimentalParam19 =1016
}
 
enum  ZSTD_dParameter {
  ZSTD_d_windowLogMax =100, ZSTD_d_experimentalParam1 =1000, ZSTD_d_experimentalParam2 =1001, ZSTD_d_experimentalParam3 =1002,
  ZSTD_d_experimentalParam4 =1003, ZSTD_d_experimentalParam5 =1004
}
 
enum  ZSTD_EndDirective { ZSTD_e_continue =0, ZSTD_e_flush =1, ZSTD_e_end =2 }
 
enum  ZSTD_ResetDirective { ZSTD_reset_session_only = 1, ZSTD_reset_parameters = 2, ZSTD_reset_session_and_parameters = 3 }
 
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
}
 

Functions

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_CCtx_reset (ZSTD_CCtx *cctx, ZSTD_ResetDirective reset)
 
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_compress (void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
 
ZSTDLIB_API size_t ZSTD_compress2 (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
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 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_compressBound (size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_compressCCtx (ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
 
ZSTDLIB_API size_t ZSTD_compressStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 
ZSTDLIB_API size_t ZSTD_compressStream2 (ZSTD_CCtx *cctx, ZSTD_outBuffer *output, ZSTD_inBuffer *input, ZSTD_EndDirective endOp)
 
ZSTDLIB_API ZSTD_bounds ZSTD_cParam_getBounds (ZSTD_cParameter cParam)
 
ZSTDLIB_API ZSTD_CCtxZSTD_createCCtx (void)
 
ZSTDLIB_API ZSTD_CDictZSTD_createCDict (const void *dictBuffer, size_t dictSize, int compressionLevel)
 
ZSTDLIB_API ZSTD_CStreamZSTD_createCStream (void)
 
ZSTDLIB_API ZSTD_DCtxZSTD_createDCtx (void)
 
ZSTDLIB_API ZSTD_DDictZSTD_createDDict (const void *dictBuffer, size_t dictSize)
 
ZSTDLIB_API ZSTD_DStreamZSTD_createDStream (void)
 
ZSTDLIB_API size_t ZSTD_CStreamInSize (void)
 
ZSTDLIB_API size_t ZSTD_CStreamOutSize (void)
 
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_DCtx_reset (ZSTD_DCtx *dctx, ZSTD_ResetDirective reset)
 
ZSTDLIB_API size_t ZSTD_DCtx_setParameter (ZSTD_DCtx *dctx, ZSTD_dParameter param, int value)
 
ZSTDLIB_API size_t ZSTD_decompress (void *dst, size_t dstCapacity, const void *src, size_t compressedSize)
 
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 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 size_t ZSTD_decompressDCtx (ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_decompressStream (ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 
ZSTDLIB_API int ZSTD_defaultCLevel (void)
 
ZSTDLIB_API ZSTD_bounds ZSTD_dParam_getBounds (ZSTD_dParameter dParam)
 
ZSTDLIB_API size_t ZSTD_DStreamInSize (void)
 
ZSTDLIB_API size_t ZSTD_DStreamOutSize (void)
 
ZSTDLIB_API size_t ZSTD_endStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output)
 
ZSTDLIB_API size_t ZSTD_findFrameCompressedSize (const void *src, size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_flushStream (ZSTD_CStream *zcs, ZSTD_outBuffer *output)
 
ZSTDLIB_API size_t ZSTD_freeCCtx (ZSTD_CCtx *cctx)
 
ZSTDLIB_API size_t ZSTD_freeCDict (ZSTD_CDict *CDict)
 
ZSTDLIB_API size_t ZSTD_freeCStream (ZSTD_CStream *zcs)
 
ZSTDLIB_API size_t ZSTD_freeDCtx (ZSTD_DCtx *dctx)
 
ZSTDLIB_API size_t ZSTD_freeDDict (ZSTD_DDict *ddict)
 
ZSTDLIB_API size_t ZSTD_freeDStream (ZSTD_DStream *zds)
 
ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize (const void *src, size_t srcSize)
 
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_fromDict (const void *dict, size_t dictSize)
 
ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame (const void *src, size_t srcSize)
 
const ZSTDLIB_API char * ZSTD_getErrorName (size_t code)
 
ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize (const void *src, size_t srcSize)
 
ZSTDLIB_API size_t ZSTD_initCStream (ZSTD_CStream *zcs, int compressionLevel)
 
ZSTDLIB_API size_t ZSTD_initDStream (ZSTD_DStream *zds)
 
ZSTDLIB_API unsigned ZSTD_isError (size_t code)
 
ZSTDLIB_API int ZSTD_maxCLevel (void)
 
ZSTDLIB_API int ZSTD_minCLevel (void)
 
ZSTDLIB_API size_t ZSTD_sizeof_CCtx (const ZSTD_CCtx *cctx)
 
ZSTDLIB_API size_t ZSTD_sizeof_CDict (const ZSTD_CDict *cdict)
 
ZSTDLIB_API size_t ZSTD_sizeof_CStream (const ZSTD_CStream *zcs)
 
ZSTDLIB_API size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx *dctx)
 
ZSTDLIB_API size_t ZSTD_sizeof_DDict (const ZSTD_DDict *ddict)
 
ZSTDLIB_API size_t ZSTD_sizeof_DStream (const ZSTD_DStream *zds)
 
ZSTDLIB_API unsigned ZSTD_versionNumber (void)
 
const ZSTDLIB_API char * ZSTD_versionString (void)
 

Macro Definition Documentation

◆ ZSTD_BLOCKSIZE_MAX

#define ZSTD_BLOCKSIZE_MAX   (1<<ZSTD_BLOCKSIZELOG_MAX)

Definition at line 143 of file zstd.h.

◆ ZSTD_BLOCKSIZELOG_MAX

#define ZSTD_BLOCKSIZELOG_MAX   17

Definition at line 142 of file zstd.h.

◆ ZSTD_CLEVEL_DEFAULT

#define ZSTD_CLEVEL_DEFAULT   3

Definition at line 129 of file zstd.h.

◆ ZSTD_COMPRESSBOUND

#define ZSTD_COMPRESSBOUND (   srcSize)    (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (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 */

Definition at line 232 of file zstd.h.

◆ ZSTD_CONTENTSIZE_ERROR

#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)

Definition at line 192 of file zstd.h.

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

Definition at line 191 of file zstd.h.

◆ ZSTD_DEPRECATED

#define ZSTD_DEPRECATED (   message)

Definition at line 68 of file zstd.h.

◆ ZSTD_EXPAND_AND_QUOTE

#define ZSTD_EXPAND_AND_QUOTE (   str)    ZSTD_QUOTE(str)

Definition at line 118 of file zstd.h.

◆ ZSTD_H_235446

#define ZSTD_H_235446

Definition at line 15 of file zstd.h.

◆ ZSTD_LIB_VERSION

Definition at line 116 of file zstd.h.

◆ ZSTD_MAGIC_DICTIONARY

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

Definition at line 138 of file zstd.h.

◆ ZSTD_MAGIC_SKIPPABLE_MASK

#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0

Definition at line 140 of file zstd.h.

◆ ZSTD_MAGIC_SKIPPABLE_START

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

Definition at line 139 of file zstd.h.

◆ ZSTD_MAGICNUMBER

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

Definition at line 137 of file zstd.h.

◆ ZSTD_MAX_INPUT_SIZE

#define ZSTD_MAX_INPUT_SIZE   ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U)

Definition at line 231 of file zstd.h.

◆ ZSTD_QUOTE

#define ZSTD_QUOTE (   str)    #str

Definition at line 117 of file zstd.h.

◆ ZSTD_VERSION_MAJOR

#define ZSTD_VERSION_MAJOR   1

Definition at line 107 of file zstd.h.

◆ ZSTD_VERSION_MINOR

#define ZSTD_VERSION_MINOR   5

Definition at line 108 of file zstd.h.

◆ ZSTD_VERSION_NUMBER

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

Definition at line 110 of file zstd.h.

◆ ZSTD_VERSION_RELEASE

#define ZSTD_VERSION_RELEASE   5

Definition at line 109 of file zstd.h.

◆ ZSTD_VERSION_STRING

#define ZSTD_VERSION_STRING   ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)

Definition at line 119 of file zstd.h.

◆ ZSTDLIB_API

#define ZSTDLIB_API   ZSTDLIB_VISIBLE

Definition at line 47 of file zstd.h.

◆ ZSTDLIB_HIDDEN

#define ZSTDLIB_HIDDEN

Definition at line 38 of file zstd.h.

◆ ZSTDLIB_VISIBLE

#define ZSTDLIB_VISIBLE

Definition at line 30 of file zstd.h.

Typedef Documentation

◆ ZSTD_CCtx

typedef struct ZSTD_CCtx_s ZSTD_CCtx

Definition at line 259 of file zstd.h.

◆ ZSTD_CDict

typedef struct ZSTD_CDict_s ZSTD_CDict

Definition at line 930 of file zstd.h.

◆ ZSTD_CStream

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

Definition at line 738 of file zstd.h.

◆ ZSTD_DCtx

typedef struct ZSTD_DCtx_s ZSTD_DCtx

Definition at line 282 of file zstd.h.

◆ ZSTD_DDict

typedef struct ZSTD_DDict_s ZSTD_DDict

Definition at line 963 of file zstd.h.

◆ ZSTD_DStream

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

Definition at line 860 of file zstd.h.

◆ 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_c_experimentalParam16 
ZSTD_c_experimentalParam17 
ZSTD_c_experimentalParam18 
ZSTD_c_experimentalParam19 

Definition at line 328 of file zstd.h.

◆ ZSTD_dParameter

Enumerator
ZSTD_d_windowLogMax 
ZSTD_d_experimentalParam1 
ZSTD_d_experimentalParam2 
ZSTD_d_experimentalParam3 
ZSTD_d_experimentalParam4 
ZSTD_d_experimentalParam5 

Definition at line 604 of file zstd.h.

◆ ZSTD_EndDirective

Enumerator
ZSTD_e_continue 
ZSTD_e_flush 
ZSTD_e_end 

Definition at line 745 of file zstd.h.

◆ ZSTD_ResetDirective

Enumerator
ZSTD_reset_session_only 
ZSTD_reset_parameters 
ZSTD_reset_session_and_parameters 

Definition at line 554 of file zstd.h.

◆ ZSTD_strategy

Enumerator
ZSTD_fast 
ZSTD_dfast 
ZSTD_greedy 
ZSTD_lazy 
ZSTD_lazy2 
ZSTD_btlazy2 
ZSTD_btopt 
ZSTD_btultra 
ZSTD_btultra2 

Definition at line 315 of file zstd.h.

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, until parameters are reset, a new dictionary is loaded, or the dictionary is explicitly invalidated by loading a NULL dictionary. 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. Note 5 : This method does not benefit from LDM (long distance mode). If you want to employ LDM on some large dictionary content, prefer employing ZSTD_CCtx_refPrefix() described below.

Definition at line 18947 of file zstd.c.

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

Definition at line 18954 of file zstd.c.

◆ 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). This method is compatible with LDM (long distance mode).

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.

Definition at line 18972 of file zstd.c.

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

ZSTD_CCtx_reset() : Also dumps dictionary

Definition at line 18993 of file zstd.c.

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

Definition at line 18346 of file zstd.c.

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

Definition at line 18856 of file zstd.c.

◆ 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. NOTE: Providing dstCapacity >= ZSTD_compressBound(srcSize) guarantees that zstd will have enough space to successfully compress the data.

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

Definition at line 22898 of file zstd.c.

◆ 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. NOTE: Providing dstCapacity >= ZSTD_compressBound(srcSize) guarantees that zstd will have enough space to successfully compress the data, though it is possible it fails for other reasons.
    Returns
    : compressed size written into dst (<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()).

Definition at line 23961 of file zstd.c.

◆ 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

Definition at line 23311 of file zstd.c.

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

Definition at line 22873 of file zstd.c.

◆ ZSTD_compressBound()

ZSTDLIB_API size_t ZSTD_compressBound ( size_t  srcSize)

maximum compressed size in worst case single-pass scenario

Definition at line 17708 of file zstd.c.

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

Definition at line 22888 of file zstd.c.

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

Definition at line 23699 of file zstd.c.

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

Definition at line 23840 of file zstd.c.

◆ 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

Definition at line 18064 of file zstd.c.

◆ ZSTD_createCCtx()

ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx ( void  )

Definition at line 17735 of file zstd.c.

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

Definition at line 23108 of file zstd.c.

◆ ZSTD_createCStream()

ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream ( void  )

Definition at line 23326 of file zstd.c.

◆ ZSTD_createDCtx()

ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx ( void  )

Definition at line 35659 of file zstd.c.

◆ 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

Definition at line 35206 of file zstd.c.

◆ ZSTD_createDStream()

ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream ( void  )

Definition at line 36996 of file zstd.c.

◆ ZSTD_CStreamInSize()

ZSTDLIB_API size_t ZSTD_CStreamInSize ( void  )

recommended size for input buffer

Definition at line 23351 of file zstd.c.

◆ ZSTD_CStreamOutSize()

ZSTDLIB_API size_t ZSTD_CStreamOutSize ( void  )

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

Definition at line 23353 of file zstd.c.

◆ 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 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 37044 of file zstd.c.

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

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 37104 of file zstd.c.

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

Definition at line 37056 of file zstd.c.

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

Definition at line 37260 of file zstd.c.

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

Definition at line 37223 of file zstd.c.

◆ ZSTD_decompress()

ZSTDLIB_API 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 36530 of file zstd.c.

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

Definition at line 36980 of file zstd.c.

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

Definition at line 36498 of file zstd.c.

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

Definition at line 36524 of file zstd.c.

◆ ZSTD_decompressStream()

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

Definition at line 37387 of file zstd.c.

◆ ZSTD_defaultCLevel()

ZSTDLIB_API int ZSTD_defaultCLevel ( void  )

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

Definition at line 24649 of file zstd.c.

◆ 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

Definition at line 37145 of file zstd.c.

◆ ZSTD_DStreamInSize()

ZSTDLIB_API size_t ZSTD_DStreamInSize ( void  )

recommended size for input buffer

Definition at line 37020 of file zstd.c.

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

Definition at line 37021 of file zstd.c.

◆ ZSTD_endStream()

ZSTDLIB_API size_t ZSTD_endStream ( ZSTD_CStream zcs,
ZSTD_outBuffer output 
)

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

Definition at line 24493 of file zstd.c.

◆ 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

Definition at line 36153 of file zstd.c.

◆ 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

Definition at line 24485 of file zstd.c.

◆ ZSTD_freeCCtx()

ZSTDLIB_API size_t ZSTD_freeCCtx ( ZSTD_CCtx cctx)

Definition at line 17818 of file zstd.c.

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

Definition at line 23130 of file zstd.c.

◆ ZSTD_freeCStream()

ZSTDLIB_API size_t ZSTD_freeCStream ( ZSTD_CStream zcs)

Definition at line 23342 of file zstd.c.

◆ ZSTD_freeDCtx()

ZSTDLIB_API size_t ZSTD_freeDCtx ( ZSTD_DCtx dctx)

Definition at line 35673 of file zstd.c.

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

Definition at line 35248 of file zstd.c.

◆ ZSTD_freeDStream()

ZSTDLIB_API size_t ZSTD_freeDStream ( ZSTD_DStream zds)

Definition at line 37012 of file zstd.c.

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

Definition at line 36037 of file zstd.c.

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

Definition at line 23213 of file zstd.c.

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

Definition at line 35276 of file zstd.c.

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

Definition at line 36948 of file zstd.c.

◆ 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 piece of 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 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 36968 of file zstd.c.

◆ ZSTD_getErrorName()

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

Definition at line 11152 of file zstd.c.

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

Definition at line 35916 of file zstd.c.

◆ 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);

Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API to compress with a dictionary.

Definition at line 23476 of file zstd.c.

◆ ZSTD_initDStream()

ZSTDLIB_API 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 37074 of file zstd.c.

◆ 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

Definition at line 11148 of file zstd.c.

◆ ZSTD_maxCLevel()

ZSTDLIB_API int ZSTD_maxCLevel ( void  )

maximum compression level available

Definition at line 24647 of file zstd.c.

◆ ZSTD_minCLevel()

ZSTDLIB_API int ZSTD_minCLevel ( void  )

minimum negative compression level allowed, requires v1.4.0+

Definition at line 24648 of file zstd.c.

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

Definition at line 17842 of file zstd.c.

◆ ZSTD_sizeof_CDict()

ZSTDLIB_API size_t ZSTD_sizeof_CDict ( const ZSTD_CDict cdict)

Definition at line 22943 of file zstd.c.

◆ ZSTD_sizeof_CStream()

ZSTDLIB_API size_t ZSTD_sizeof_CStream ( const ZSTD_CStream zcs)

Definition at line 17852 of file zstd.c.

◆ ZSTD_sizeof_DCtx()

ZSTDLIB_API size_t ZSTD_sizeof_DCtx ( const ZSTD_DCtx dctx)

Definition at line 35572 of file zstd.c.

◆ ZSTD_sizeof_DDict()

ZSTDLIB_API size_t ZSTD_sizeof_DDict ( const ZSTD_DDict ddict)

Definition at line 35266 of file zstd.c.

◆ ZSTD_sizeof_DStream()

ZSTDLIB_API size_t ZSTD_sizeof_DStream ( const ZSTD_DStream zds)

Definition at line 37277 of file zstd.c.

◆ ZSTD_versionNumber()

ZSTDLIB_API unsigned ZSTD_versionNumber ( void  )

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

Definition at line 11136 of file zstd.c.

◆ ZSTD_versionString()

const ZSTDLIB_API char* ZSTD_versionString ( void  )

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

Definition at line 11138 of file zstd.c.



plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:50