![]() |
Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
|
#include "../common/zstd_deps.h"
#include "../common/mem.h"
#include "../common/fse.h"
#include "../common/huf.h"
#include "../common/xxhash.h"
#include "../common/zstd_internal.h"
#include "zstd_decompress_internal.h"
#include "zstd_ddict.h"
#include "zstd_decompress_block.h"
Macros | |
#define | ZSTD_HEAPMODE 1 |
#define | ZSTD_LEGACY_SUPPORT 0 |
#define | ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1) |
#define | ZSTD_NO_FORWARD_PROGRESS_MAX 16 |
#define | FSE_STATIC_LINKING_ONLY |
#define | HUF_STATIC_LINKING_ONLY |
#define | DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT 4 |
#define | DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT |
#define | DDICT_HASHSET_TABLE_BASE_SIZE 64 |
#define | DDICT_HASHSET_RESIZE_FACTOR 2 |
#define | CHECK_DBOUNDS(p, v) |
#define CHECK_DBOUNDS | ( | p, | |
v ) |
#define DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT 4 |
#define DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT |
#define DDICT_HASHSET_RESIZE_FACTOR 2 |
#define DDICT_HASHSET_TABLE_BASE_SIZE 64 |
#define FSE_STATIC_LINKING_ONLY |
#define HUF_STATIC_LINKING_ONLY |
#define ZSTD_HEAPMODE 1 |
HEAPMODE : Select how default decompression function ZSTD_decompress() allocates its context, on stack (0), or into heap (1, default; requires malloc()). Note that functions with explicit context such as ZSTD_decompressDCtx() are unaffected.
#define ZSTD_LEGACY_SUPPORT 0 |
LEGACY_SUPPORT : if set to 1+, ZSTD_decompress() can decode older formats (v0.1+)
#define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1) |
MAXWINDOWSIZE_DEFAULT : maximum window size accepted by DStream by default. Frames requiring more memory will be rejected. It's possible to set a different limit using ZSTD_DCtx_setMaxWindowSize().
#define ZSTD_NO_FORWARD_PROGRESS_MAX 16 |
NO_FORWARD_PROGRESS_MAX : maximum allowed nb of calls to ZSTD_decompressStream() without any forward progress (defined as: no byte read from input, and no byte flushed to output) before triggering an error.
ZSTD_DCtx * ZSTD_createDCtx | ( | void | ) |
ZSTD_DCtx * ZSTD_createDCtx_advanced | ( | ZSTD_customMem | customMem | ) |
ZSTD_DStream * ZSTD_createDStream | ( | void | ) |
ZSTD_DStream * ZSTD_createDStream_advanced | ( | ZSTD_customMem | customMem | ) |
size_t ZSTD_DCtx_getParameter | ( | ZSTD_DCtx * | dctx, |
ZSTD_dParameter | param, | ||
int * | value ) |
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.
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. size_t ZSTD_DCtx_loadDictionary_advanced | ( | ZSTD_DCtx * | dctx, |
const void * | dict, | ||
size_t | dictSize, | ||
ZSTD_dictLoadMethod_e | dictLoadMethod, | ||
ZSTD_dictContentType_e | dictContentType ) |
size_t ZSTD_DCtx_loadDictionary_byReference | ( | ZSTD_DCtx * | dctx, |
const void * | dict, | ||
size_t | dictSize ) |
size_t ZSTD_DCtx_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().
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.
size_t ZSTD_DCtx_refPrefix_advanced | ( | ZSTD_DCtx * | dctx, |
const void * | prefix, | ||
size_t | prefixSize, | ||
ZSTD_dictContentType_e | dictContentType ) |
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.
size_t ZSTD_DCtx_setFormat | ( | ZSTD_DCtx * | dctx, |
ZSTD_format_e | format ) |
size_t ZSTD_DCtx_setMaxWindowSize | ( | ZSTD_DCtx * | dctx, |
size_t | maxWindowSize ) |
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).
size_t ZSTD_decodingBufferSize_min | ( | unsigned long long | windowSize, |
unsigned long long | frameContentSize ) |
size_t ZSTD_decompress | ( | void * | dst, |
size_t | dstCapacity, | ||
const void * | src, | ||
size_t | srcSize ) |
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.
size_t ZSTD_decompress_usingDDict | ( | ZSTD_DCtx * | dctx, |
void * | dst, | ||
size_t | dstCapacity, | ||
const void * | src, | ||
size_t | srcSize, | ||
const ZSTD_DDict * | ddict ) |
ZSTD_decompress_usingDDict() : Decompression using a pre-digested Dictionary Use dictionary without significant overhead.
static 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.
size_t ZSTD_decompressBegin | ( | ZSTD_DCtx * | dctx | ) |
size_t ZSTD_decompressBegin_usingDDict | ( | ZSTD_DCtx * | dctx, |
const ZSTD_DDict * | ddict ) |
unsigned long long ZSTD_decompressBound | ( | const void * | src, |
size_t | srcSize ) |
ZSTD_decompressBound() : compatible with legacy mode src
must point to the start of a ZSTD frame or a skippeable frame srcSize
must be at least as large as the frame contained
static size_t ZSTD_decompressContinue | ( | ZSTD_DCtx * | dctx, |
void * | dst, | ||
size_t | dstCapacity, | ||
const void * | src, | ||
size_t | srcSize ) |
ZSTD_decompressContinue() : srcSize : must be the exact nb of bytes expected (see ZSTD_nextSrcSizeToDecompress())
dst
(necessarily <= `dstCapacity) or an error code, which can be tested using ZSTD_isError() 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.
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.size_t ZSTD_decompressStream_simpleArgs | ( | ZSTD_DCtx * | dctx, |
void * | dst, | ||
size_t | dstCapacity, | ||
size_t * | dstPos, | ||
const void * | src, | ||
size_t | srcSize, | ||
size_t * | srcPos ) |
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.
size_t ZSTD_DStreamInSize | ( | void | ) |
recommended size for input buffer
size_t ZSTD_DStreamOutSize | ( | void | ) |
recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances.
size_t ZSTD_estimateDCtxSize | ( | void | ) |
size_t ZSTD_estimateDStreamSize | ( | size_t | windowSize | ) |
size_t ZSTD_estimateDStreamSize_fromFrame | ( | const void * | src, |
size_t | srcSize ) |
unsigned long long ZSTD_findDecompressedSize | ( | const void * | src, |
size_t | srcSize ) |
ZSTD_findDecompressedSize() : compatible with legacy mode srcSize
must be the exact length of some number of ZSTD compressed and/or skippable frames
size_t ZSTD_findFrameCompressedSize | ( | const void * | src, |
size_t | srcSize ) |
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
src
size_t ZSTD_frameHeaderSize | ( | const void * | src, |
size_t | srcSize ) |
ZSTD_frameHeaderSize() : srcSize must be >= ZSTD_frameHeaderSize_prefix.
size_t ZSTD_freeDCtx | ( | ZSTD_DCtx * | dctx | ) |
size_t ZSTD_freeDStream | ( | ZSTD_DStream * | zds | ) |
unsigned long long ZSTD_getDecompressedSize | ( | const void * | src, |
size_t | srcSize ) |
ZSTD_getDecompressedSize() : compatible with legacy mode
srcSize
too small) unsigned ZSTD_getDictID_fromDict | ( | const void * | dict, |
size_t | dictSize ) |
ZSTD_getDictID_fromDict() : Provides the dictID stored within dictionary. if
unsigned ZSTD_getDictID_fromFrame | ( | const void * | src, |
size_t | srcSize ) |
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
.unsigned long long ZSTD_getFrameContentSize | ( | const void * | src, |
size_t | srcSize ) |
ZSTD_getFrameContentSize() : compatible with legacy mode
src
if known, otherwisesize_t ZSTD_getFrameHeader | ( | ZSTD_frameHeader * | zfhPtr, |
const void * | src, | ||
size_t | srcSize ) |
ZSTD_getFrameHeader() : decode Frame Header, or require larger srcSize
. note : this function does not consume input, it only reads it.
zfhPtr
is correctly filled, >0, srcSize
is too small, value is wanted srcSize
amount, or an error code, which can be tested using ZSTD_isError() size_t ZSTD_getFrameHeader_advanced | ( | ZSTD_frameHeader * | zfhPtr, |
const void * | src, | ||
size_t | srcSize, | ||
ZSTD_format_e | format ) |
ZSTD_getFrameHeader_advanced() : decode Frame Header, or require larger srcSize
. note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless
zfhPtr
is correctly filled, >0, srcSize
is too small, value is wanted srcSize
amount, or an error code, which can be tested using ZSTD_isError() 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);
size_t ZSTD_initDStream_usingDDict | ( | ZSTD_DStream * | dctx, |
const ZSTD_DDict * | ddict ) |
size_t ZSTD_initDStream_usingDict | ( | ZSTD_DStream * | zds, |
const void * | dict, | ||
size_t | dictSize ) |
ZSTD_DCtx * ZSTD_initStaticDCtx | ( | void * | workspace, |
size_t | workspaceSize ) |
ZSTD_DStream * ZSTD_initStaticDStream | ( | void * | workspace, |
size_t | workspaceSize ) |
ZSTD_insertBlock() : insert src
block into dctx
history. Useful to track uncompressed blocks.
unsigned ZSTD_isFrame | ( | const void * | buffer, |
size_t | size ) |
ZSTD_isFrame() : Tells if the content of buffer
starts with a valid Frame Identifier. Note : Frame Identifier is 4 bytes. If size < 4
,
unsigned ZSTD_isSkippableFrame | ( | const void * | buffer, |
size_t | size ) |
ZSTD_isSkippableFrame() : Tells if the content of buffer
starts with a valid Frame Identifier for a skippable frame. Note : Frame Identifier is 4 bytes. If size < 4
,
size_t ZSTD_loadDEntropy | ( | ZSTD_entropyDTables_t * | entropy, |
const void *const | dict, | ||
size_t const | dictSize ) |
ZSTD_loadDEntropy() : dict : must point at beginning of a valid zstd dictionary.
ZSTD_nextInputType_e ZSTD_nextInputType | ( | ZSTD_DCtx * | dctx | ) |
static size_t ZSTD_nextSrcSizeToDecompress | ( | ZSTD_DCtx * | dctx | ) |
ZSTDLIB_API size_t ZSTD_readSkippableFrame | ( | void * | dst, |
size_t | dstCapacity, | ||
unsigned * | magicVariant, | ||
const void * | src, | ||
size_t | srcSize ) |
ZSTD_readSkippableFrame() : Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer.
The parameter magicVariant will receive the magicVariant that was supplied when the frame was written, i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested in the magicVariant.
Returns an error if destination buffer is not large enough, or if the frame is not skippable.
size_t ZSTD_resetDStream | ( | ZSTD_DStream * | dctx | ) |
size_t ZSTD_sizeof_DStream | ( | const ZSTD_DStream * | dctx | ) |