#include "lz4frame.h"
#include "lz4.h"
#include "lz4hc.h"
#include "xxhash.h"
#include <string.h>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | LZ4F_cctx_s |
struct | LZ4F_CDict_s |
struct | LZ4F_dctx_s |
Macros | |
#define | _1BIT 0x01 |
#define | _2BITS 0x03 |
#define | _3BITS 0x07 |
#define | _4BITS 0x0F |
#define | _8BITS 0xFF |
#define | ALLOC(s) malloc(s) |
#define | ALLOC_AND_ZERO(s) calloc(1,(s)) |
#define | assert(condition) ((void)0) |
#define | DEBUGLOG(l, ...) {} /* disabled */ |
#define | FORWARD_IF_ERROR(r) if (LZ4F_isError(r)) return (r) |
#define | FREEMEM(p) free(p) |
#define | GB *(1<<30) |
#define | KB *(1<<10) |
#define | LZ4_HC_STATIC_LINKING_ONLY |
#define | LZ4_STATIC_LINKING_ONLY |
#define | LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB |
#define | LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U |
#define | LZ4F_GENERATE_STRING(STRING) #STRING, |
#define | LZ4F_HEAPMODE 0 |
#define | LZ4F_STATIC_ASSERT(c) { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ |
#define | LZ4F_STATIC_LINKING_ONLY |
#define | MB *(1<<20) |
#define | MEM_INIT(p, v, s) memset((p),(v),(s)) |
#define | MIN(a, b) ( (a) < (b) ? (a) : (b) ) |
#define | RETURN_ERROR(e) return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e) |
#define | RETURN_ERROR_IF(c, e) if (c) RETURN_ERROR(e) |
#define | XXH_STATIC_LINKING_ONLY |
Typedefs | |
typedef unsigned char | BYTE |
typedef int(* | compressFunc_t) (void *ctx, const char *src, char *dst, int srcSize, int dstSize, int level, const LZ4F_CDict *cdict) |
typedef struct LZ4F_cctx_s | LZ4F_cctx_t |
typedef signed int | S32 |
typedef unsigned short | U16 |
typedef unsigned int | U32 |
typedef unsigned long long | U64 |
Functions | |
static int | ctxTypeID_to_size (int ctxTypeID) |
static void * | LZ4F_calloc (size_t s, LZ4F_CustomMem cmem) |
size_t | LZ4F_compressBegin (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const LZ4F_preferences_t *preferencesPtr) |
size_t | LZ4F_compressBegin_usingCDict (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const LZ4F_CDict *cdict, const LZ4F_preferences_t *preferencesPtr) |
static int | LZ4F_compressBlock (void *ctx, const char *src, char *dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict *cdict) |
static int | LZ4F_compressBlock_continue (void *ctx, const char *src, char *dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict *cdict) |
static int | LZ4F_compressBlockHC (void *ctx, const char *src, char *dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict *cdict) |
static int | LZ4F_compressBlockHC_continue (void *ctx, const char *src, char *dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict *cdict) |
size_t | LZ4F_compressBound (size_t srcSize, const LZ4F_preferences_t *preferencesPtr) |
static size_t | LZ4F_compressBound_internal (size_t srcSize, const LZ4F_preferences_t *preferencesPtr, size_t alreadyBuffered) |
size_t | LZ4F_compressEnd (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t *compressOptionsPtr) |
size_t | LZ4F_compressFrame (void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_preferences_t *preferencesPtr) |
size_t | LZ4F_compressFrame_usingCDict (LZ4F_cctx *cctx, void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_CDict *cdict, const LZ4F_preferences_t *preferencesPtr) |
size_t | LZ4F_compressFrameBound (size_t srcSize, const LZ4F_preferences_t *preferencesPtr) |
int | LZ4F_compressionLevel_max (void) |
size_t | LZ4F_compressUpdate (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_compressOptions_t *compressOptionsPtr) |
static size_t | LZ4F_compressUpdateImpl (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_compressOptions_t *compressOptionsPtr, LZ4F_blockCompression_t blockCompression) |
LZ4F_CDict * | LZ4F_createCDict (const void *dictBuffer, size_t dictSize) |
LZ4F_CDict * | LZ4F_createCDict_advanced (LZ4F_CustomMem cmem, const void *dictBuffer, size_t dictSize) |
LZ4F_errorCode_t | LZ4F_createCompressionContext (LZ4F_cctx **LZ4F_compressionContextPtr, unsigned version) |
LZ4F_cctx * | LZ4F_createCompressionContext_advanced (LZ4F_CustomMem customMem, unsigned version) |
LZ4F_errorCode_t | LZ4F_createDecompressionContext (LZ4F_dctx **LZ4F_decompressionContextPtr, unsigned versionNumber) |
LZ4F_dctx * | LZ4F_createDecompressionContext_advanced (LZ4F_CustomMem customMem, unsigned version) |
static size_t | LZ4F_decodeHeader (LZ4F_dctx *dctx, const void *src, size_t srcSize) |
size_t | LZ4F_decompress (LZ4F_dctx *dctx, void *dstBuffer, size_t *dstSizePtr, const void *srcBuffer, size_t *srcSizePtr, const LZ4F_decompressOptions_t *decompressOptionsPtr) |
size_t | LZ4F_decompress_usingDict (LZ4F_dctx *dctx, void *dstBuffer, size_t *dstSizePtr, const void *srcBuffer, size_t *srcSizePtr, const void *dict, size_t dictSize, const LZ4F_decompressOptions_t *decompressOptionsPtr) |
static int | LZ4F_doNotCompressBlock (void *ctx, const char *src, char *dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict *cdict) |
size_t | LZ4F_flush (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t *compressOptionsPtr) |
static void | LZ4F_free (void *p, LZ4F_CustomMem cmem) |
void | LZ4F_freeCDict (LZ4F_CDict *cdict) |
LZ4F_errorCode_t | LZ4F_freeCompressionContext (LZ4F_cctx *cctxPtr) |
LZ4F_errorCode_t | LZ4F_freeDecompressionContext (LZ4F_dctx *dctx) |
size_t | LZ4F_getBlockSize (LZ4F_blockSizeID_t blockSizeID) |
LZ4F_errorCodes | LZ4F_getErrorCode (size_t functionResult) |
const char * | LZ4F_getErrorName (LZ4F_errorCode_t code) |
LZ4F_errorCode_t | LZ4F_getFrameInfo (LZ4F_dctx *dctx, LZ4F_frameInfo_t *frameInfoPtr, const void *srcBuffer, size_t *srcSizePtr) |
unsigned | LZ4F_getVersion (void) |
static BYTE | LZ4F_headerChecksum (const void *header, size_t length) |
size_t | LZ4F_headerSize (const void *src, size_t srcSize) |
static void | LZ4F_initStream (void *ctx, const LZ4F_CDict *cdict, int level, LZ4F_blockMode_t blockMode) |
unsigned | LZ4F_isError (LZ4F_errorCode_t code) |
static int | LZ4F_localSaveDict (LZ4F_cctx_t *cctxPtr) |
static size_t | LZ4F_makeBlock (void *dst, const void *src, size_t srcSize, compressFunc_t compress, void *lz4ctx, int level, const LZ4F_CDict *cdict, LZ4F_blockChecksum_t crcFlag) |
static void * | LZ4F_malloc (size_t s, LZ4F_CustomMem cmem) |
static LZ4F_blockSizeID_t | LZ4F_optimalBSID (const LZ4F_blockSizeID_t requestedBSID, const size_t srcSize) |
static U32 | LZ4F_readLE32 (const void *src) |
static U64 | LZ4F_readLE64 (const void *src) |
void | LZ4F_resetDecompressionContext (LZ4F_dctx *dctx) |
static LZ4F_errorCode_t | LZ4F_returnErrorCode (LZ4F_errorCodes code) |
static compressFunc_t | LZ4F_selectCompression (LZ4F_blockMode_t blockMode, int level, LZ4F_blockCompression_t compressMode) |
size_t | LZ4F_uncompressedUpdate (LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_compressOptions_t *compressOptionsPtr) |
static void | LZ4F_updateDict (LZ4F_dctx *dctx, const BYTE *dstPtr, size_t dstSize, const BYTE *dstBufferStart, unsigned withinTmp) |
static void | LZ4F_writeLE32 (void *dst, U32 value32) |
static void | LZ4F_writeLE64 (void *dst, U64 value64) |
Variables | |
static const size_t | BFSize = LZ4F_BLOCK_CHECKSUM_SIZE |
static const size_t | BHSize = LZ4F_BLOCK_HEADER_SIZE |
static const LZ4F_compressOptions_t | k_cOptionsNull = { 0, { 0, 0, 0 } } |
static const char * | LZ4F_errorStrings [] = { LZ4F_LIST_ERRORS(LZ4F_GENERATE_STRING) } |
static const size_t | maxFHSize = LZ4F_HEADER_SIZE_MAX |
static const size_t | minFHSize = LZ4F_HEADER_SIZE_MIN |
#define _1BIT 0x01 |
Definition at line 241 of file lz4frame.c.
#define _2BITS 0x03 |
Definition at line 242 of file lz4frame.c.
#define _3BITS 0x07 |
Definition at line 243 of file lz4frame.c.
#define _4BITS 0x0F |
Definition at line 244 of file lz4frame.c.
#define _8BITS 0xFF |
Definition at line 245 of file lz4frame.c.
Definition at line 95 of file lz4frame.c.
Definition at line 96 of file lz4frame.c.
#define assert | ( | condition | ) | ((void)0) |
Definition at line 145 of file lz4frame.c.
#define DEBUGLOG | ( | l, | |
... | |||
) | {} /* disabled */ |
Definition at line 161 of file lz4frame.c.
#define FORWARD_IF_ERROR | ( | r | ) | if (LZ4F_isError(r)) return (r) |
Definition at line 319 of file lz4frame.c.
#define FREEMEM | ( | p | ) | free(p) |
Definition at line 97 of file lz4frame.c.
#define GB *(1<<30) |
Definition at line 238 of file lz4frame.c.
#define KB *(1<<10) |
Definition at line 236 of file lz4frame.c.
#define LZ4_HC_STATIC_LINKING_ONLY |
Definition at line 72 of file lz4frame.c.
#define LZ4_STATIC_LINKING_ONLY |
Definition at line 70 of file lz4frame.c.
#define LZ4F_BLOCKSIZEID_DEFAULT LZ4F_max64KB |
Definition at line 248 of file lz4frame.c.
#define LZ4F_BLOCKUNCOMPRESSED_FLAG 0x80000000U |
Definition at line 247 of file lz4frame.c.
#define LZ4F_GENERATE_STRING | ( | STRING | ) | #STRING, |
Definition at line 286 of file lz4frame.c.
#define LZ4F_HEAPMODE 0 |
Definition at line 61 of file lz4frame.c.
#define LZ4F_STATIC_ASSERT | ( | c | ) | { enum { LZ4F_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ |
Definition at line 149 of file lz4frame.c.
#define LZ4F_STATIC_LINKING_ONLY |
Definition at line 68 of file lz4frame.c.
#define MB *(1<<20) |
Definition at line 237 of file lz4frame.c.
Definition at line 90 of file lz4frame.c.
#define MIN | ( | a, | |
b | |||
) | ( (a) < (b) ? (a) : (b) ) |
Definition at line 339 of file lz4frame.c.
#define RETURN_ERROR | ( | e | ) | return LZ4F_returnErrorCode(LZ4F_ERROR_ ## e) |
Definition at line 315 of file lz4frame.c.
#define RETURN_ERROR_IF | ( | c, | |
e | |||
) | if (c) RETURN_ERROR(e) |
Definition at line 317 of file lz4frame.c.
#define XXH_STATIC_LINKING_ONLY |
Definition at line 74 of file lz4frame.c.
typedef unsigned char BYTE |
Definition at line 176 of file lz4frame.c.
typedef int(* compressFunc_t) (void *ctx, const char *src, char *dst, int srcSize, int dstSize, int level, const LZ4F_CDict *cdict) |
Definition at line 818 of file lz4frame.c.
typedef struct LZ4F_cctx_s LZ4F_cctx_t |
typedef signed int S32 |
Definition at line 179 of file lz4frame.c.
typedef unsigned short U16 |
Definition at line 177 of file lz4frame.c.
typedef unsigned int U32 |
Definition at line 178 of file lz4frame.c.
typedef unsigned long long U64 |
Definition at line 180 of file lz4frame.c.
enum dStage_t |
Definition at line 1194 of file lz4frame.c.
Enumerator | |
---|---|
LZ4B_COMPRESSED | |
LZ4B_UNCOMPRESSED |
Definition at line 260 of file lz4frame.c.
enum LZ4F_lastBlockStatus |
Enumerator | |
---|---|
notDone | |
fromTmpBuffer | |
fromSrcBuffer |
Definition at line 913 of file lz4frame.c.
|
static |
Definition at line 660 of file lz4frame.c.
|
static |
Definition at line 100 of file lz4frame.c.
size_t LZ4F_compressBegin | ( | LZ4F_cctx * | cctxPtr, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const LZ4F_preferences_t * | preferencesPtr | ||
) |
LZ4F_compressBegin() : init streaming compression AND writes frame header into @dstBuffer. @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes. @preferencesPtr can be NULL, in which case default parameters are selected.
Definition at line 795 of file lz4frame.c.
size_t LZ4F_compressBegin_usingCDict | ( | LZ4F_cctx * | cctxPtr, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const LZ4F_CDict * | cdict, | ||
const LZ4F_preferences_t * | preferencesPtr | ||
) |
LZ4F_compressBegin_usingCDict() : init streaming compression AND writes frame header into @dstBuffer. @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
Definition at line 677 of file lz4frame.c.
|
static |
Definition at line 853 of file lz4frame.c.
|
static |
Definition at line 865 of file lz4frame.c.
|
static |
Definition at line 873 of file lz4frame.c.
|
static |
Definition at line 882 of file lz4frame.c.
size_t LZ4F_compressBound | ( | size_t | srcSize, |
const LZ4F_preferences_t * | prefsPtr | ||
) |
LZ4F_compressBound() : Provides minimum dstCapacity required to guarantee success of LZ4F_compressUpdate(), given a srcSize and preferences, for a worst case scenario. When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() instead. Note that the result is only valid for a single invocation of LZ4F_compressUpdate(). When invoking LZ4F_compressUpdate() multiple times, if the output buffer is gradually filled up instead of emptied and re-used from its start, one must check if there is enough remaining capacity before each invocation, using LZ4F_compressBound().
Definition at line 809 of file lz4frame.c.
|
static |
LZ4F_compressBound_internal() : Provides dstCapacity given a srcSize to guarantee operation success in worst case situations. prefsPtr is optional : if NULL is provided, preferences will be set to cover worst case scenario.
Definition at line 371 of file lz4frame.c.
size_t LZ4F_compressEnd | ( | LZ4F_cctx * | cctxPtr, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const LZ4F_compressOptions_t * | compressOptionsPtr | ||
) |
LZ4F_compressEnd() : When you want to properly finish the compressed frame, just call LZ4F_compressEnd(). It will flush whatever data remained within compressionContext (like LZ4_flush()) but also properly finalize the frame, with an endMark and an (optional) checksum. LZ4F_compressOptions_t structure is optional : you can provide NULL as argument.
Definition at line 1151 of file lz4frame.c.
size_t LZ4F_compressFrame | ( | void * | dstBuffer, |
size_t | dstCapacity, | ||
const void * | srcBuffer, | ||
size_t | srcSize, | ||
const LZ4F_preferences_t * | preferencesPtr | ||
) |
LZ4F_compressFrame() : Compress an entire srcBuffer into a valid LZ4 frame, in a single step. dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). The LZ4F_preferences_t structure is optional : you can provide NULL as argument. All preferences will be set to default.
Definition at line 475 of file lz4frame.c.
size_t LZ4F_compressFrame_usingCDict | ( | LZ4F_cctx * | cctx, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const void * | srcBuffer, | ||
size_t | srcSize, | ||
const LZ4F_CDict * | cdict, | ||
const LZ4F_preferences_t * | preferencesPtr | ||
) |
LZ4F_compressFrame_usingCDict() : Compress srcBuffer using a dictionary, in a single step. cdict can be NULL, in which case, no dictionary is used. dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr). The LZ4F_preferences_t structure is optional : you may provide NULL as argument, however, it's the only way to provide a dictID, so it's not recommended.
Definition at line 420 of file lz4frame.c.
size_t LZ4F_compressFrameBound | ( | size_t | srcSize, |
const LZ4F_preferences_t * | preferencesPtr | ||
) |
LZ4F_compressFrameBound() : Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences. preferencesPtr
is optional. It can be replaced by NULL, in which case, the function will assume default preferences. Note : this result is only usable with LZ4F_compressFrame(). It may also be relevant to LZ4F_compressUpdate() only if no flush() operation is ever performed.
Definition at line 398 of file lz4frame.c.
int LZ4F_compressionLevel_max | ( | void | ) |
Definition at line 323 of file lz4frame.c.
size_t LZ4F_compressUpdate | ( | LZ4F_cctx * | cctxPtr, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const void * | srcBuffer, | ||
size_t | srcSize, | ||
const LZ4F_compressOptions_t * | compressOptionsPtr | ||
) |
LZ4F_compressUpdate() : LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. When successful, the function always entirely consumes @srcBuffer. src data is either buffered or compressed into @dstBuffer. If previously an uncompressed block was written, buffered data is flushed before appending compressed data is continued. @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr). @compressOptionsPtr is optional : provide NULL to mean "default".
Definition at line 1060 of file lz4frame.c.
|
static |
LZ4F_compressUpdateImpl() : LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. When successful, the function always entirely consumes @srcBuffer. src data is either buffered or compressed into @dstBuffer. If the block compression does not match the compression of the previous block, the old data is flushed and operations continue with the new compression mode. @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr) when block compression is turned on. @compressOptionsPtr is optional : provide NULL to mean "default".
Definition at line 930 of file lz4frame.c.
LZ4F_CDict* LZ4F_createCDict | ( | const void * | dictBuffer, |
size_t | dictSize | ||
) |
LZ4F_createCDict() : When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. LZ4F_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay. LZ4F_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. @dictBuffer can be released after LZ4F_CDict creation, since its content is copied within CDict
Definition at line 565 of file lz4frame.c.
LZ4F_CDict* LZ4F_createCDict_advanced | ( | LZ4F_CustomMem | cmem, |
const void * | dictBuffer, | ||
size_t | dictSize | ||
) |
Definition at line 530 of file lz4frame.c.
LZ4F_errorCode_t LZ4F_createCompressionContext | ( | LZ4F_cctx ** | LZ4F_compressionContextPtr, |
unsigned | version | ||
) |
LZ4F_createCompressionContext() : The first thing to do is to create a compressionContext object, which will be used in all compression operations. This is achieved using LZ4F_createCompressionContext(), which takes as argument a version and an LZ4F_preferences_t structure. The version provided MUST be LZ4F_VERSION. It is intended to track potential incompatible differences between different binaries. The function will provide a pointer to an allocated LZ4F_compressionContext_t object. If the result LZ4F_errorCode_t is not OK_NoError, there was an error during context creation. Object can release its memory using LZ4F_freeCompressionContext();
Definition at line 608 of file lz4frame.c.
LZ4F_cctx* LZ4F_createCompressionContext_advanced | ( | LZ4F_CustomMem | customMem, |
unsigned | version | ||
) |
Definition at line 586 of file lz4frame.c.
LZ4F_errorCode_t LZ4F_createDecompressionContext | ( | LZ4F_dctx ** | LZ4F_decompressionContextPtr, |
unsigned | versionNumber | ||
) |
LZ4F_createDecompressionContext() : Create a decompressionContext object, which will track all decompression operations. Provides a pointer to a fully allocated and initialized LZ4F_decompressionContext object. Object can later be released using LZ4F_freeDecompressionContext().
Definition at line 1247 of file lz4frame.c.
LZ4F_dctx* LZ4F_createDecompressionContext_advanced | ( | LZ4F_CustomMem | customMem, |
unsigned | version | ||
) |
Definition at line 1230 of file lz4frame.c.
|
static |
LZ4F_decodeHeader() : input : src
points at the beginning of the frame output : set internal values of dctx, such as dctx->frameInfo and dctx->dStage. Also allocates internal buffers.
Definition at line 1291 of file lz4frame.c.
size_t LZ4F_decompress | ( | LZ4F_dctx * | dctx, |
void * | dstBuffer, | ||
size_t * | dstSizePtr, | ||
const void * | srcBuffer, | ||
size_t * | srcSizePtr, | ||
const LZ4F_decompressOptions_t * | decompressOptionsPtr | ||
) |
LZ4F_decompress() : Call this function repetitively to regenerate compressed data in srcBuffer. The function will attempt to decode up to *srcSizePtr bytes from srcBuffer into dstBuffer of capacity *dstSizePtr.
The number of bytes regenerated into dstBuffer will be provided within *dstSizePtr (necessarily <= original value).
The number of bytes effectively read from srcBuffer will be provided within *srcSizePtr (necessarily <= original value). If number of bytes read is < number of bytes provided, then decompression operation is not complete. Remaining data will have to be presented again in a subsequent invocation.
The function result is an hint of the better srcSize to use for next call to LZ4F_decompress. Schematically, it's the size of the current (or remaining) compressed block + header of next block. Respecting the hint provides a small boost to performance, since it allows less buffer shuffling. Note that this is just a hint, and it's always possible to any srcSize value. When a frame is fully decoded,
Definition at line 1556 of file lz4frame.c.
size_t LZ4F_decompress_usingDict | ( | LZ4F_dctx * | dctx, |
void * | dstBuffer, | ||
size_t * | dstSizePtr, | ||
const void * | srcBuffer, | ||
size_t * | srcSizePtr, | ||
const void * | dict, | ||
size_t | dictSize, | ||
const LZ4F_decompressOptions_t * | decompressOptionsPtr | ||
) |
LZ4F_decompress_usingDict() : Same as LZ4F_decompress(), using a predefined dictionary. Dictionary is used "in place", without any preprocessing. It must remain accessible throughout the entire frame decoding.
Definition at line 2065 of file lz4frame.c.
|
static |
Definition at line 888 of file lz4frame.c.
size_t LZ4F_flush | ( | LZ4F_cctx * | cctxPtr, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const LZ4F_compressOptions_t * | compressOptionsPtr | ||
) |
LZ4F_flush() : When compressed data must be sent immediately, without waiting for a block to be filled, invoke LZ4_flush(), which will immediately compress any remaining data stored within LZ4F_cctx. The result of the function is the number of bytes written into dstBuffer. It can be zero, this means there was no data left within LZ4F_cctx. The function outputs an error code if it fails (can be tested using LZ4F_isError()) LZ4F_compressOptions_t* is optional. NULL is a valid argument.
Definition at line 1104 of file lz4frame.c.
|
static |
Definition at line 126 of file lz4frame.c.
void LZ4F_freeCDict | ( | LZ4F_CDict * | cdict | ) |
Definition at line 571 of file lz4frame.c.
LZ4F_errorCode_t LZ4F_freeCompressionContext | ( | LZ4F_cctx * | cctxPtr | ) |
Definition at line 620 of file lz4frame.c.
LZ4F_errorCode_t LZ4F_freeDecompressionContext | ( | LZ4F_dctx * | dctx | ) |
Definition at line 1259 of file lz4frame.c.
size_t LZ4F_getBlockSize | ( | LZ4F_blockSizeID_t | blockSizeID | ) |
Definition at line 325 of file lz4frame.c.
LZ4F_errorCodes LZ4F_getErrorCode | ( | size_t | functionResult | ) |
Definition at line 302 of file lz4frame.c.
const char* LZ4F_getErrorName | ( | LZ4F_errorCode_t | code | ) |
return error code string; for debugging
Definition at line 295 of file lz4frame.c.
LZ4F_errorCode_t LZ4F_getFrameInfo | ( | LZ4F_dctx * | dctx, |
LZ4F_frameInfo_t * | frameInfoPtr, | ||
const void * | srcBuffer, | ||
size_t * | srcSizePtr | ||
) |
LZ4F_getFrameInfo() : This function extracts frame parameters (max blockSize, frame checksum, etc.). Usage is optional. Objective is to provide relevant information for allocation purposes. This function works in 2 situations :
srcBuffer
, and start the decoding process. Amount of input data provided must be large enough to successfully decode the frame header. A header size is variable, but is guaranteed to be <= LZ4F_HEADER_SIZE_MAX bytes. It's possible to provide more input data than this minimum.Definition at line 1428 of file lz4frame.c.
unsigned LZ4F_getVersion | ( | void | ) |
Definition at line 321 of file lz4frame.c.
|
static |
Definition at line 341 of file lz4frame.c.
size_t LZ4F_headerSize | ( | const void * | src, |
size_t | srcSize | ||
) |
Definition at line 1387 of file lz4frame.c.
|
static |
This function prepares the internal LZ4(HC) stream for a new compression, resetting the context and attaching the dictionary, if there is one.
It needs to be called at the beginning of each independent compression stream (i.e., at the beginning of a frame in blockLinked mode, or at the beginning of each block in blockIndependent mode).
Definition at line 639 of file lz4frame.c.
unsigned LZ4F_isError | ( | LZ4F_errorCode_t | code | ) |
tells when a function result is an error code
Definition at line 290 of file lz4frame.c.
|
static |
Definition at line 906 of file lz4frame.c.
|
static |
LZ4F_makeBlock(): compress a single block, add header and optional checksum. assumption : dst buffer capacity is >= BHSize + srcSize + crcSize
Definition at line 825 of file lz4frame.c.
|
static |
Definition at line 116 of file lz4frame.c.
|
static |
Definition at line 351 of file lz4frame.c.
|
static |
Definition at line 185 of file lz4frame.c.
|
static |
Definition at line 204 of file lz4frame.c.
void LZ4F_resetDecompressionContext | ( | LZ4F_dctx * | dctx | ) |
LZ4F_resetDecompressionContext() : added in v1.8.0 In case of an error, the context is left in "undefined" state. In which case, it's necessary to reset it, before re-using it. This method can also be used to abruptly stop any unfinished decompression, and start a new one using same context resources.
Definition at line 1274 of file lz4frame.c.
|
static |
Definition at line 308 of file lz4frame.c.
|
static |
Definition at line 894 of file lz4frame.c.
size_t LZ4F_uncompressedUpdate | ( | LZ4F_cctx * | cctxPtr, |
void * | dstBuffer, | ||
size_t | dstCapacity, | ||
const void * | srcBuffer, | ||
size_t | srcSize, | ||
const LZ4F_compressOptions_t * | compressOptionsPtr | ||
) |
LZ4F_compressUpdate() : LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. When successful, the function always entirely consumes @srcBuffer. src data is either buffered or compressed into @dstBuffer. If previously an uncompressed block was written, buffered data is flushed before appending compressed data is continued. This is only supported when LZ4F_blockIndependent is used @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr). @compressOptionsPtr is optional : provide NULL to mean "default".
Definition at line 1084 of file lz4frame.c.
|
static |
Definition at line 1470 of file lz4frame.c.
|
static |
Definition at line 195 of file lz4frame.c.
|
static |
Definition at line 218 of file lz4frame.c.
|
static |
Definition at line 253 of file lz4frame.c.
|
static |
Definition at line 252 of file lz4frame.c.
|
static |
Definition at line 915 of file lz4frame.c.
|
static |
Definition at line 287 of file lz4frame.c.
|
static |
Definition at line 251 of file lz4frame.c.
|
static |
Definition at line 250 of file lz4frame.c.