GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72090
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lz4.c File Reference
#include "lz4.h"
#include <stdlib.h>
#include <string.h>
Include dependency graph for lz4.c:

Go to the source code of this file.

Macros

#define LZ4_HEAPMODE   0
 
#define ACCELERATION_DEFAULT   1
 
#define FORCE_INLINE   static
 
#define expect(expr, value)   (expr)
 
#define likely(expr)   expect((expr) != 0, 1)
 
#define unlikely(expr)   expect((expr) != 0, 0)
 
#define ALLOCATOR(n, s)   calloc(n,s)
 
#define FREEMEM   free
 
#define MEM_INIT   memset
 
#define MINMATCH   4
 
#define WILDCOPYLENGTH   8
 
#define LASTLITERALS   5
 
#define MFLIMIT   (WILDCOPYLENGTH+MINMATCH)
 
#define KB   *(1 <<10)
 
#define MB   *(1 <<20)
 
#define GB   *(1U<<30)
 
#define MAXD_LOG   16
 
#define MAX_DISTANCE   ((1 << MAXD_LOG) - 1)
 
#define ML_BITS   4
 
#define ML_MASK   ((1U<<ML_BITS)-1)
 
#define RUN_BITS   (8-ML_BITS)
 
#define RUN_MASK   ((1U<<RUN_BITS)-1)
 
#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
 
#define DEBUGLOG(l,...)   {} /* disabled */
 
#define STEPSIZE   sizeof(reg_t)
 
#define HASH_UNIT   sizeof(reg_t)
 

Typedefs

typedef unsigned char BYTE
 
typedef unsigned short U16
 
typedef unsigned int U32
 
typedef signed int S32
 
typedef unsigned long long U64
 
typedef size_t uptrval
 
typedef size_t reg_t
 

Enumerations

enum  limitedOutput_directive { notLimited = 0, limitedOutput = 1 }
 
enum  tableType_t { byPtr, byU32, byU16 }
 
enum  dict_directive { noDict = 0, withPrefix64k, usingExtDict }
 
enum  dictIssue_directive { noDictIssue = 0, dictSmall }
 
enum  endCondition_directive { endOnOutputSize = 0, endOnInputSize = 1 }
 
enum  earlyEnd_directive { full = 0, partial = 1 }
 

Functions

int LZ4_versionNumber (void)
 
const char * LZ4_versionString (void)
 
int LZ4_compressBound (int isize)
 
int LZ4_sizeofState ()
 
FORCE_INLINE U32 LZ4_hashPosition (const void *const p, tableType_t const tableType)
 
FORCE_INLINE void LZ4_putPosition (const BYTE *p, void *tableBase, tableType_t tableType, const BYTE *srcBase)
 
FORCE_INLINE const BYTELZ4_getPosition (const BYTE *p, void *tableBase, tableType_t tableType, const BYTE *srcBase)
 
FORCE_INLINE int LZ4_compress_generic (LZ4_stream_t_internal *const cctx, const char *const source, char *const dest, const int inputSize, const int maxOutputSize, const limitedOutput_directive outputLimited, const tableType_t tableType, const dict_directive dict, const dictIssue_directive dictIssue, const U32 acceleration)
 
int LZ4_compress_fast_extState (void *state, const char *source, char *dest, int inputSize, int maxOutputSize, int acceleration)
 
int LZ4_compress_fast (const char *source, char *dest, int inputSize, int maxOutputSize, int acceleration)
 
int LZ4_compress_default (const char *source, char *dest, int inputSize, int maxOutputSize)
 
int LZ4_compress_fast_force (const char *source, char *dest, int inputSize, int maxOutputSize, int acceleration)
 
int LZ4_compress_destSize (const char *src, char *dst, int *srcSizePtr, int targetDstSize)
 
LZ4_stream_tLZ4_createStream (void)
 
void LZ4_resetStream (LZ4_stream_t *LZ4_stream)
 
int LZ4_freeStream (LZ4_stream_t *LZ4_stream)
 
int LZ4_loadDict (LZ4_stream_t *LZ4_dict, const char *dictionary, int dictSize)
 
int LZ4_compress_fast_continue (LZ4_stream_t *LZ4_stream, const char *source, char *dest, int inputSize, int maxOutputSize, int acceleration)
 
int LZ4_compress_forceExtDict (LZ4_stream_t *LZ4_dict, const char *source, char *dest, int inputSize)
 
int LZ4_saveDict (LZ4_stream_t *LZ4_dict, char *safeBuffer, int dictSize)
 
FORCE_INLINE int LZ4_decompress_generic (const char *const source, char *const dest, int inputSize, int outputSize, int endOnInput, int partialDecoding, int targetOutputSize, int dict, const BYTE *const lowPrefix, const BYTE *const dictStart, const size_t dictSize)
 
int LZ4_decompress_safe (const char *source, char *dest, int compressedSize, int maxDecompressedSize)
 
int LZ4_decompress_safe_partial (const char *source, char *dest, int compressedSize, int targetOutputSize, int maxDecompressedSize)
 
int LZ4_decompress_fast (const char *source, char *dest, int originalSize)
 
LZ4_streamDecode_tLZ4_createStreamDecode (void)
 
int LZ4_freeStreamDecode (LZ4_streamDecode_t *LZ4_stream)
 
int LZ4_setStreamDecode (LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
 
int LZ4_decompress_safe_continue (LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int compressedSize, int maxOutputSize)
 
int LZ4_decompress_fast_continue (LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int originalSize)
 
FORCE_INLINE int LZ4_decompress_usingDict_generic (const char *source, char *dest, int compressedSize, int maxOutputSize, int safe, const char *dictStart, int dictSize)
 
int LZ4_decompress_safe_usingDict (const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize)
 
int LZ4_decompress_fast_usingDict (const char *source, char *dest, int originalSize, const char *dictStart, int dictSize)
 
int LZ4_decompress_safe_forceExtDict (const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize)
 
int LZ4_compress_limitedOutput (const char *source, char *dest, int inputSize, int maxOutputSize)
 
int LZ4_compress (const char *source, char *dest, int inputSize)
 
int LZ4_compress_limitedOutput_withState (void *state, const char *src, char *dst, int srcSize, int dstSize)
 
int LZ4_compress_withState (void *state, const char *src, char *dst, int srcSize)
 
int LZ4_compress_limitedOutput_continue (LZ4_stream_t *LZ4_stream, const char *src, char *dst, int srcSize, int maxDstSize)
 
int LZ4_compress_continue (LZ4_stream_t *LZ4_stream, const char *source, char *dest, int inputSize)
 
int LZ4_uncompress (const char *source, char *dest, int outputSize)
 
int LZ4_uncompress_unknownOutputSize (const char *source, char *dest, int isize, int maxOutputSize)
 
int LZ4_sizeofStreamState ()
 
int LZ4_resetStreamState (void *state, char *inputBuffer)
 
void * LZ4_create (char *inputBuffer)
 
char * LZ4_slideInputBuffer (void *LZ4_Data)
 
int LZ4_decompress_safe_withPrefix64k (const char *source, char *dest, int compressedSize, int maxOutputSize)
 
int LZ4_decompress_fast_withPrefix64k (const char *source, char *dest, int originalSize)
 

Macro Definition Documentation

#define ACCELERATION_DEFAULT   1

Definition at line 52 of file lz4.c.

Referenced by LZ4_compress_fast_continue(), and LZ4_compress_fast_extState().

#define ALLOCATOR (   n,
 
)    calloc(n,s)
#define DEBUGLOG (   l,
  ... 
)    {} /* disabled */

Definition at line 303 of file lz4.c.

#define expect (   expr,
  value 
)    (expr)

Definition at line 123 of file lz4.c.

#define FORCE_INLINE   static

Definition at line 115 of file lz4.c.

#define FREEMEM   free
#define GB   *(1U<<30)

Definition at line 278 of file lz4.c.

Referenced by LZ4_loadDict().

#define HASH_UNIT   sizeof(reg_t)

Definition at line 954 of file lz4.c.

Referenced by LZ4_loadDict().

#define LASTLITERALS   5

Definition at line 272 of file lz4.c.

Referenced by LZ4_compress_generic().

#define likely (   expr)    expect((expr) != 0, 1)

Definition at line 126 of file lz4.c.

Referenced by LZ4_decompress_generic().

#define LZ4_HEAPMODE   0

Definition at line 45 of file lz4.c.

#define LZ4_STATIC_ASSERT (   c)    { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */

Definition at line 292 of file lz4.c.

Referenced by LZ4_createStream().

#define MAX_DISTANCE   ((1 << MAXD_LOG) - 1)

Definition at line 281 of file lz4.c.

Referenced by LZ4_compress_generic().

#define MAXD_LOG   16

Definition at line 280 of file lz4.c.

#define MB   *(1 <<20)

Definition at line 277 of file lz4.c.

#define MEM_INIT   memset

Definition at line 137 of file lz4.c.

Referenced by LZ4_resetStream().

#define MFLIMIT   (WILDCOPYLENGTH+MINMATCH)

Definition at line 273 of file lz4.c.

Referenced by LZ4_compress_generic(), and LZ4_decompress_generic().

#define MINMATCH   4

Definition at line 269 of file lz4.c.

Referenced by LZ4_compress_generic(), and LZ4_decompress_generic().

#define ML_BITS   4

Definition at line 283 of file lz4.c.

Referenced by LZ4_compress_generic().

#define ML_MASK   ((1U<<ML_BITS)-1)

Definition at line 284 of file lz4.c.

Referenced by LZ4_compress_generic(), and LZ4_decompress_generic().

#define RUN_BITS   (8-ML_BITS)

Definition at line 285 of file lz4.c.

#define RUN_MASK   ((1U<<RUN_BITS)-1)

Definition at line 286 of file lz4.c.

Referenced by LZ4_compress_generic().

#define STEPSIZE   sizeof(reg_t)

Definition at line 368 of file lz4.c.

#define unlikely (   expr)    expect((expr) != 0, 0)

Definition at line 127 of file lz4.c.

Referenced by LZ4_compress_generic(), and LZ4_decompress_generic().

#define WILDCOPYLENGTH   8

Definition at line 271 of file lz4.c.

Referenced by LZ4_decompress_generic().

Typedef Documentation

typedef unsigned char BYTE

Definition at line 152 of file lz4.c.

typedef size_t reg_t

Definition at line 163 of file lz4.c.

typedef signed int S32

Definition at line 155 of file lz4.c.

typedef unsigned short U16

Definition at line 153 of file lz4.c.

typedef unsigned int U32

Definition at line 154 of file lz4.c.

typedef unsigned long long U64

Definition at line 156 of file lz4.c.

typedef size_t uptrval

Definition at line 157 of file lz4.c.

Enumeration Type Documentation

Enumerator
noDict 
withPrefix64k 
usingExtDict 

Definition at line 401 of file lz4.c.

Enumerator
noDictIssue 
dictSmall 

Definition at line 402 of file lz4.c.

Enumerator
full 
partial 

Definition at line 405 of file lz4.c.

Enumerator
endOnOutputSize 
endOnInputSize 

Definition at line 404 of file lz4.c.

Enumerator
notLimited 
limitedOutput 

Definition at line 398 of file lz4.c.

Enumerator
byPtr 
byU32 
byU16 

Definition at line 399 of file lz4.c.

Function Documentation

int LZ4_compress ( const char *  source,
char *  dest,
int  inputSize 
)

Definition at line 1419 of file lz4.c.

References LZ4_compress_default(), and LZ4_compressBound().

int LZ4_compress_continue ( LZ4_stream_t LZ4_stream,
const char *  source,
char *  dest,
int  inputSize 
)

Definition at line 1423 of file lz4.c.

References LZ4_compress_fast_continue(), and LZ4_compressBound().

int LZ4_compress_default ( const char *  source,
char *  dest,
int  sourceSize,
int  maxDestSize 
)

LZ4_compress_default() : Compresses 'sourceSize' bytes from buffer 'source' into already allocated 'dest' buffer of size 'maxDestSize'. Compression is guaranteed to succeed if 'maxDestSize' >= LZ4_compressBound(sourceSize). It also runs faster, so it's a recommended setting. If the function cannot compress 'source' into a more limited 'dest' budget, compression stops immediately, and the function result is zero. As a consequence, 'dest' content is not valid. This function never writes outside 'dest' buffer, nor read outside 'source' buffer. sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE maxDestSize : full or partial size of buffer 'dest' (which must be already allocated) return : the number of bytes written into buffer 'dest' (necessarily <= maxOutputSize) or 0 if compression fails

Definition at line 715 of file lz4.c.

References LZ4_compress_fast().

Referenced by G_lz4_compress(), LZ4_compress(), and LZ4_compress_limitedOutput().

int LZ4_compress_destSize ( const char *  source,
char *  dest,
int sourceSizePtr,
int  targetDestSize 
)

LZ4_compress_destSize() : Reverse the logic, by compressing as much data as possible from 'source' buffer into already allocated buffer 'dest' of size 'targetDestSize'. This function either compresses the entire 'source' content into 'dest' if it's large enough, or fill 'dest' buffer completely with as much data as possible from 'source'. sourceSizePtr : will be modified to indicate how many bytes where read from 'source' to fill 'dest'. New value is necessarily <= old value. return : Nb bytes written into 'dest' (necessarily <= targetDestSize) or 0 if compression fails

Definition at line 910 of file lz4.c.

References ALLOCATOR, and FREEMEM.

int LZ4_compress_fast ( const char *  source,
char *  dest,
int  sourceSize,
int  maxDestSize,
int  acceleration 
)

LZ4_compress_fast() : Same as LZ4_compress_default(), but allows to select an "acceleration" factor. The larger the acceleration value, the faster the algorithm, but also the lesser the compression. It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed. An acceleration value of "1" is the same as regular LZ4_compress_default() Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1.

Definition at line 697 of file lz4.c.

References ALLOCATOR, FREEMEM, and LZ4_compress_fast_extState().

Referenced by LZ4_compress_default().

int LZ4_compress_fast_continue ( LZ4_stream_t streamPtr,
const char *  src,
char *  dst,
int  srcSize,
int  dstCapacity,
int  acceleration 
)

LZ4_compress_fast_continue() : Compress buffer content 'src', using data from previously compressed blocks as dictionary to improve compression ratio. Important : Previous data blocks are assumed to remain present and unmodified ! 'dst' buffer must be already allocated. If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster. If not, and if compressed data cannot fit into 'dst' buffer size, compression stops, and function

Returns
==0. After an error, the stream status is invalid, it can only be reset or freed.

Definition at line 1006 of file lz4.c.

References ACCELERATION_DEFAULT, byU32, LZ4_stream_t_internal::currentOffset, LZ4_stream_t_internal::dictionary, LZ4_stream_t_internal::dictSize, dictSmall, LZ4_stream_t_internal::initCheck, LZ4_stream_u::internal_donotuse, KB, limitedOutput, LZ4_compress_generic(), noDictIssue, source, usingExtDict, and withPrefix64k.

Referenced by LZ4_compress_continue(), and LZ4_compress_limitedOutput_continue().

int LZ4_compress_fast_extState ( void *  state,
const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize,
int  acceleration 
)
int LZ4_compress_fast_force ( const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize,
int  acceleration 
)
int LZ4_compress_forceExtDict ( LZ4_stream_t LZ4_dict,
const char *  source,
char *  dest,
int  inputSize 
)
FORCE_INLINE int LZ4_compress_generic ( LZ4_stream_t_internal *const  cctx,
const char *const  source,
char *const  dest,
const int  inputSize,
const int  maxOutputSize,
const limitedOutput_directive  outputLimited,
const tableType_t  tableType,
const dict_directive  dict,
const dictIssue_directive  dictIssue,
const U32  acceleration 
)
int LZ4_compress_limitedOutput ( const char *  source,
char *  dest,
int  inputSize,
int  maxOutputSize 
)

Definition at line 1418 of file lz4.c.

References LZ4_compress_default().

int LZ4_compress_limitedOutput_continue ( LZ4_stream_t LZ4_stream,
const char *  src,
char *  dst,
int  srcSize,
int  maxDstSize 
)

Definition at line 1422 of file lz4.c.

References LZ4_compress_fast_continue().

int LZ4_compress_limitedOutput_withState ( void *  state,
const char *  src,
char *  dst,
int  srcSize,
int  dstSize 
)

Definition at line 1420 of file lz4.c.

References LZ4_compress_fast_extState().

int LZ4_compress_withState ( void *  state,
const char *  src,
char *  dst,
int  srcSize 
)

Definition at line 1421 of file lz4.c.

References LZ4_compress_fast_extState(), and LZ4_compressBound().

int LZ4_compressBound ( int  inputSize)

LZ4_compressBound() : Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) This function is primarily useful for memory allocation purposes (destination buffer size). Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example). Note that LZ4_compress_default() compress faster when dest buffer size is >= LZ4_compressBound(srcSize) inputSize : max supported value is LZ4_MAX_INPUT_SIZE return : maximum output size in a "worst case" scenario or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)

Definition at line 413 of file lz4.c.

References LZ4_COMPRESSBOUND.

Referenced by G_lz4_compress_bound(), LZ4_compress(), LZ4_compress_continue(), LZ4_compress_fast_extState(), and LZ4_compress_withState().

void* LZ4_create ( char *  inputBuffer)

Definition at line 1452 of file lz4.c.

References ALLOCATOR.

LZ4_stream_t* LZ4_createStream ( void  )

LZ4_createStream() and LZ4_freeStream() : LZ4_createStream() will allocate and initialize an LZ4_stream_t structure. LZ4_freeStream() releases its memory.

Definition at line 933 of file lz4.c.

References ALLOCATOR, LZ4_resetStream(), LZ4_STATIC_ASSERT, LZ4_STREAMSIZE, and LZ4_STREAMSIZE_U64.

LZ4_streamDecode_t* LZ4_createStreamDecode ( void  )

LZ4_createStreamDecode() and LZ4_freeStreamDecode() : creation / destruction of streaming decompression tracking structure

Definition at line 1288 of file lz4.c.

References ALLOCATOR.

int LZ4_decompress_fast ( const char *  source,
char *  dest,
int  originalSize 
)

LZ4_decompress_fast() : originalSize : is the original and therefore uncompressed size return : the number of bytes read from the source buffer (in other words, the compressed size) If the source stream is detected malformed, the function will stop decoding and return a negative result. Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes. note : This function fully respect memory boundaries for properly formed compressed data. It is a bit faster than LZ4_decompress_safe(). However, it does not provide any protection against intentionally modified data stream (malicious input). Use this function in trusted environment only (data to decode comes from a trusted source).

Definition at line 1280 of file lz4.c.

References endOnOutputSize, full, KB, LZ4_decompress_generic(), NULL, and withPrefix64k.

Referenced by LZ4_uncompress().

int LZ4_decompress_fast_usingDict ( const char *  source,
char *  dest,
int  originalSize,
const char *  dictStart,
int  dictSize 
)

Definition at line 1402 of file lz4.c.

References LZ4_decompress_usingDict_generic().

int LZ4_decompress_fast_withPrefix64k ( const char *  source,
char *  dest,
int  originalSize 
)

Definition at line 1473 of file lz4.c.

References endOnOutputSize, full, KB, LZ4_decompress_generic(), NULL, and withPrefix64k.

FORCE_INLINE int LZ4_decompress_generic ( const char *const  source,
char *const  dest,
int  inputSize,
int  outputSize,
int  endOnInput,
int  partialDecoding,
int  targetOutputSize,
int  dict,
const BYTE *const  lowPrefix,
const BYTE *const  dictStart,
const size_t  dictSize 
)

LZ4_decompress_generic() : This generic decompression function cover all use cases. It shall be instantiated several times, using different sets of directives Note that it is important this generic function is really inlined, in order to remove useless branches during compilation optimization.

Definition at line 1108 of file lz4.c.

References dest, endOnInputSize, inputSize, KB, likely, MFLIMIT, MINMATCH, ML_MASK, outputSize, source, unlikely, usingExtDict, and WILDCOPYLENGTH.

Referenced by LZ4_decompress_fast(), LZ4_decompress_fast_continue(), LZ4_decompress_fast_withPrefix64k(), LZ4_decompress_safe(), LZ4_decompress_safe_continue(), LZ4_decompress_safe_forceExtDict(), LZ4_decompress_safe_partial(), LZ4_decompress_safe_withPrefix64k(), and LZ4_decompress_usingDict_generic().

int LZ4_decompress_safe ( const char *  source,
char *  dest,
int  compressedSize,
int  maxDecompressedSize 
)

LZ4_decompress_safe() : compressedSize : is the precise full size of the compressed block. maxDecompressedSize : is the size of destination buffer, which must be already allocated. return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize) If destination buffer is not large enough, decoding will stop and output an error code (<0). If the source stream is detected malformed, the function will stop decoding and return a negative result. This function is protected against buffer overflow exploits, including malicious data packets. It never writes outside output buffer, nor reads outside input buffer.

Definition at line 1270 of file lz4.c.

References endOnInputSize, full, LZ4_decompress_generic(), noDict, and NULL.

Referenced by G_lz4_expand(), and LZ4_uncompress_unknownOutputSize().

int LZ4_decompress_safe_continue ( LZ4_streamDecode_t LZ4_streamDecode,
const char *  source,
char *  dest,
int  compressedSize,
int  maxDecompressedSize 
)

LZ4_decompress_*_continue() : These decoding functions allow decompression of multiple blocks in "streaming" mode. Previously decoded blocks must remain available at the memory position where they were decoded (up to 64 KB) In the case of a ring buffers, decoding buffer must be either :

  • Exactly same size as encoding buffer, with same update rule (block boundaries at same positions) In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).
  • Larger than encoding buffer, by a minimum of maxBlockSize more bytes. maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block. In which case, encoding and decoding buffers do not need to be synchronized, and encoding ring buffer can have any size, including small ones ( < 64 KB).
  • At least 64 KB + 8 bytes + maxBlockSize. In which case, encoding and decoding buffers do not need to be synchronized, and encoding ring buffer can have any size, including larger than decoding buffer. Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer, and indicate where it is saved using LZ4_setStreamDecode()

Definition at line 1325 of file lz4.c.

References endOnInputSize, LZ4_streamDecode_t_internal::extDictSize, LZ4_streamDecode_t_internal::externalDict, full, LZ4_streamDecode_u::internal_donotuse, LZ4_decompress_generic(), LZ4_streamDecode_t_internal::prefixEnd, LZ4_streamDecode_t_internal::prefixSize, and usingExtDict.

int LZ4_decompress_safe_forceExtDict ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize,
const char *  dictStart,
int  dictSize 
)

Definition at line 1408 of file lz4.c.

References endOnInputSize, full, LZ4_decompress_generic(), and usingExtDict.

int LZ4_decompress_safe_partial ( const char *  source,
char *  dest,
int  compressedSize,
int  targetOutputSize,
int  maxDecompressedSize 
)

LZ4_decompress_safe_partial() : This function decompress a compressed block of size 'compressedSize' at position 'source' into destination buffer 'dest' of size 'maxDecompressedSize'. The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached, reducing decompression time. return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize) Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller. Always control how many bytes were decoded. If the source stream is detected malformed, the function will stop decoding and return a negative result. This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets

Definition at line 1275 of file lz4.c.

References endOnInputSize, LZ4_decompress_generic(), noDict, NULL, and partial.

int LZ4_decompress_safe_usingDict ( const char *  source,
char *  dest,
int  compressedSize,
int  maxDecompressedSize,
const char *  dictStart,
int  dictSize 
)

LZ4_decompress_*_usingDict() : These decoding functions work the same as a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue() They are stand-alone, and don't need an LZ4_streamDecode_t structure.

Definition at line 1397 of file lz4.c.

References LZ4_decompress_usingDict_generic().

int LZ4_decompress_safe_withPrefix64k ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize 
)

Definition at line 1468 of file lz4.c.

References endOnInputSize, full, KB, LZ4_decompress_generic(), NULL, and withPrefix64k.

FORCE_INLINE int LZ4_decompress_usingDict_generic ( const char *  source,
char *  dest,
int  compressedSize,
int  maxOutputSize,
int  safe,
const char *  dictStart,
int  dictSize 
)
int LZ4_freeStream ( LZ4_stream_t LZ4_stream)

Definition at line 946 of file lz4.c.

References FREEMEM.

int LZ4_freeStreamDecode ( LZ4_streamDecode_t LZ4_stream)

Definition at line 1294 of file lz4.c.

References FREEMEM.

FORCE_INLINE const BYTE* LZ4_getPosition ( const BYTE p,
void *  tableBase,
tableType_t  tableType,
const BYTE srcBase 
)

Definition at line 468 of file lz4.c.

References LZ4_hashPosition().

Referenced by LZ4_compress_generic().

FORCE_INLINE U32 LZ4_hashPosition ( const void *const  p,
tableType_t const  tableType 
)

Definition at line 439 of file lz4.c.

References byU16.

Referenced by LZ4_compress_generic(), LZ4_getPosition(), and LZ4_putPosition().

int LZ4_loadDict ( LZ4_stream_t streamPtr,
const char *  dictionary,
int  dictSize 
)

LZ4_loadDict() : Use this function to load a static dictionary into LZ4_stream. Any previous data will be forgotten, only 'dictionary' will remain in memory. Loading a size of 0 is allowed. Return : dictionary size, in bytes (necessarily <= 64 KB)

Definition at line 955 of file lz4.c.

References byU32, LZ4_stream_t_internal::currentOffset, LZ4_stream_t_internal::dictionary, LZ4_stream_t_internal::dictSize, GB, HASH_UNIT, LZ4_stream_t_internal::hashTable, LZ4_stream_t_internal::initCheck, LZ4_stream_u::internal_donotuse, KB, LZ4_putPosition(), LZ4_resetStream(), and NULL.

FORCE_INLINE void LZ4_putPosition ( const BYTE p,
void *  tableBase,
tableType_t  tableType,
const BYTE srcBase 
)

Definition at line 455 of file lz4.c.

References LZ4_hashPosition().

Referenced by LZ4_compress_generic(), and LZ4_loadDict().

void LZ4_resetStream ( LZ4_stream_t streamPtr)

LZ4_resetStream() : An LZ4_stream_t structure can be allocated once and re-used multiple times. Use this function to init an allocated LZ4_stream_t structure and start a new compression.

Definition at line 941 of file lz4.c.

References MEM_INIT.

Referenced by LZ4_compress_fast_extState(), LZ4_compress_fast_force(), LZ4_createStream(), and LZ4_loadDict().

int LZ4_resetStreamState ( void *  state,
char *  inputBuffer 
)

Definition at line 1445 of file lz4.c.

int LZ4_saveDict ( LZ4_stream_t LZ4_dict,
char *  safeBuffer,
int  dictSize 
)

LZ4_saveDict() : If previously compressed data block is not guaranteed to remain available at its memory location, save it into a safer place (char* safeBuffer). Note : you don't need to call LZ4_loadDict() afterwards, dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue(). Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error.

Definition at line 1081 of file lz4.c.

References LZ4_stream_t_internal::dictionary, LZ4_stream_t_internal::dictSize, LZ4_stream_u::internal_donotuse, and KB.

Referenced by LZ4_slideInputBuffer().

int LZ4_setStreamDecode ( LZ4_streamDecode_t LZ4_streamDecode,
const char *  dictionary,
int  dictSize 
)

LZ4_setStreamDecode() : Use this function to instruct where to find the dictionary. This function is not necessary if previous data is still available where it was decoded. Loading a size of 0 is allowed (same effect as no dictionary). Return : 1 if OK, 0 if error

Definition at line 1308 of file lz4.c.

References LZ4_streamDecode_t_internal::extDictSize, LZ4_streamDecode_t_internal::externalDict, LZ4_streamDecode_u::internal_donotuse, NULL, LZ4_streamDecode_t_internal::prefixEnd, and LZ4_streamDecode_t_internal::prefixSize.

int LZ4_sizeofState ( void  )

LZ4_compress_fast_extState() : Same compression function, just using an externally allocated memory space to store compression state. Use LZ4_sizeofState() to know how much memory must be allocated, and allocate it on 8-bytes boundaries (using malloc() typically). Then, provide it as 'void* state' to compression function.

Definition at line 414 of file lz4.c.

References LZ4_STREAMSIZE.

int LZ4_sizeofStreamState ( )

Definition at line 1437 of file lz4.c.

References LZ4_STREAMSIZE.

char* LZ4_slideInputBuffer ( void *  LZ4_Data)

Definition at line 1459 of file lz4.c.

References LZ4_stream_t_internal::bufferStart, KB, and LZ4_saveDict().

int LZ4_uncompress ( const char *  source,
char *  dest,
int  outputSize 
)

Definition at line 1431 of file lz4.c.

References LZ4_decompress_fast().

int LZ4_uncompress_unknownOutputSize ( const char *  source,
char *  dest,
int  isize,
int  maxOutputSize 
)

Definition at line 1432 of file lz4.c.

References LZ4_decompress_safe().

int LZ4_versionNumber ( void  )

library version number; to be used when checking dll version

Definition at line 411 of file lz4.c.

References LZ4_VERSION_NUMBER.

const char* LZ4_versionString ( void  )

library version string; to be used when checking dll version

Definition at line 412 of file lz4.c.

References LZ4_VERSION_STRING.