#include <limits.h>
#include <stddef.h>
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 |
#define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX) |
#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_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.
src
frame content, if knownreturn==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() #define ZSTD_EXPAND_AND_QUOTE | ( | str | ) | ZSTD_QUOTE(str) |
#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_START 0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */ |
#define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U) |
#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) |
#define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION) |
#define ZSTDLIB_API ZSTDLIB_VISIBLE |
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 |
enum ZSTD_cParameter |
enum ZSTD_dParameter |
enum ZSTD_EndDirective |
enum ZSTD_ResetDirective |
enum ZSTD_strategy |
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.
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. 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.
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).
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 :
ZSTD_CCtx_reset() : Also dumps dictionary
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()).
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.
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.
dst
(<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()). 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.
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. dst
(<= `dstCapacity), or an error code if it fails (which can be tested using ZSTD_isError()). 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
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.
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 | ||
) |
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.
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).
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.
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.
ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx | ( | void | ) |
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.
ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream | ( | void | ) |
ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx | ( | void | ) |
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
ZSTDLIB_API ZSTD_DStream* ZSTD_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 | ||
) |
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.
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. 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.
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.
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.
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).
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.
dst
(<= dstCapacity
), or an errorCode if it fails (which can be tested using ZSTD_isError()). 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.
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.
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.
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.ZSTDLIB_API int ZSTD_defaultCLevel | ( | void | ) |
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.
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 | ||
) |
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
src
, suitable to pass as srcSize
to ZSTD_decompress
or similar, or an error code if input is invalidZSTD_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
src
ZSTDLIB_API size_t ZSTD_flushStream | ( | ZSTD_CStream * | zcs, |
ZSTD_outBuffer * | output | ||
) |
Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush).
ZSTDLIB_API size_t ZSTD_freeCCtx | ( | ZSTD_CCtx * | cctx | ) |
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.
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 | ) |
ZSTD_freeDDict() : Function frees memory allocated with ZSTD_createDDict() If a NULL pointer is passed, no operation is performed.
ZSTDLIB_API size_t ZSTD_freeDStream | ( | ZSTD_DStream * | zds | ) |
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.
src
frame content if known and not empty, 0 otherwise.ZSTD_getDecompressedSize() : compatible with legacy mode
srcSize
too small) 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
ZSTD_getDictID_fromCDict() : Provides the dictID of the dictionary loaded into cdict
. If
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
ZSTD_getDictID_fromDDict() : Provides the dictID of the dictionary loaded into ddict
. If
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
ZSTD_getDictID_fromDict() : Provides the dictID stored within dictionary. if
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
srcSize
is too small, and as a result, the frame header could not be decoded (only possible if srcSize < ZSTD_FRAMEHEADERSIZE_MAX
).ZSTD_getDictID_fromFrame() : Provides the dictID required to decompress frame stored within src
. If
srcSize
is too small, and as a result, frame header could not be decoded. Note : possible if srcSize < ZSTD_FRAMEHEADERSIZE_MAX
.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)
ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize | ( | const void * | src, |
size_t | srcSize | ||
) |
ZSTD_getFrameContentSize() : compatible with legacy mode
src
if known, otherwiseZSTDLIB_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.
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);
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
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 | ) |
ZSTD_versionNumber() : Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE).
const ZSTDLIB_API char* ZSTD_versionString | ( | void | ) |
ZSTD_versionString() : Return runtime library version, like "1.4.5". Requires v1.3.0+.