35 #if defined (__cplusplus) 39 #ifndef LZ4_H_2983827168210 40 #define LZ4_H_2983827168210 78 #ifndef LZ4LIB_VISIBILITY 79 # if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(CAFE) 80 # define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default"))) 82 # define LZ4LIB_VISIBILITY 85 #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) 86 # define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY 87 #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) 88 # define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY 90 # define LZ4LIB_API LZ4LIB_VISIBILITY 94 #define LZ4_VERSION_MAJOR 1 95 #define LZ4_VERSION_MINOR 8 96 #define LZ4_VERSION_RELEASE 2 98 #define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) 100 #define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE 101 #define LZ4_QUOTE(str) #str 102 #define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str) 103 #define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) 105 LZ4LIB_API
int LZ4_versionNumber (
void);
106 LZ4LIB_API
const char* LZ4_versionString (
void);
119 #ifndef LZ4_MEMORY_USAGE 120 # define LZ4_MEMORY_USAGE 14 139 LZ4LIB_API
int LZ4_compress_default(
const char* src,
char* dst,
int srcSize,
int dstCapacity);
149 LZ4LIB_API
int LZ4_decompress_safe (
const char* src,
char* dst,
int compressedSize,
int dstCapacity);
155 #define LZ4_MAX_INPUT_SIZE 0x7E000000 156 #define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) 168 LZ4LIB_API
int LZ4_compressBound(
int inputSize);
178 LZ4LIB_API
int LZ4_compress_fast (
const char* src,
char* dst,
int srcSize,
int dstCapacity,
int acceleration);
188 LZ4LIB_API
int LZ4_sizeofState(
void);
189 LZ4LIB_API
int LZ4_compress_fast_extState (
void* state,
const char* src,
char* dst,
int srcSize,
int dstCapacity,
int acceleration);
203 LZ4LIB_API
int LZ4_compress_destSize (
const char* src,
char* dst,
int* srcSizePtr,
int targetDstSize);
221 LZ4LIB_API
int LZ4_decompress_fast (
const char* src,
char* dst,
int originalSize);
235 LZ4LIB_API
int LZ4_decompress_safe_partial (
const char* src,
char* dst,
int srcSize,
int targetOutputSize,
int dstCapacity);
241 typedef union LZ4_stream_u LZ4_stream_t;
247 LZ4LIB_API LZ4_stream_t* LZ4_createStream(
void);
248 LZ4LIB_API
int LZ4_freeStream (LZ4_stream_t* streamPtr);
254 LZ4LIB_API
void LZ4_resetStream (LZ4_stream_t* streamPtr);
262 LZ4LIB_API
int LZ4_loadDict (LZ4_stream_t* streamPtr,
const char* dictionary,
int dictSize);
280 LZ4LIB_API
int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr,
const char* src,
char* dst,
int srcSize,
int dstCapacity,
int acceleration);
289 LZ4LIB_API
int LZ4_saveDict (LZ4_stream_t* streamPtr,
char* safeBuffer,
int maxDictSize);
296 typedef union LZ4_streamDecode_u LZ4_streamDecode_t;
302 LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(
void);
303 LZ4LIB_API
int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
312 LZ4LIB_API
int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode,
const char* dictionary,
int dictSize);
325 LZ4LIB_API
int LZ4_decoderRingBufferSize(
int maxBlockSize);
326 #define LZ4_DECODER_RING_BUFFER_SIZE(mbs) (65536 + 14 + (mbs)) 353 LZ4LIB_API
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode,
const char* src,
char* dst,
int srcSize,
int dstCapacity);
354 LZ4LIB_API
int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode,
const char* src,
char* dst,
int originalSize);
363 LZ4LIB_API
int LZ4_decompress_safe_usingDict (
const char* src,
char* dst,
int srcSize,
int dstCapcity,
const char* dictStart,
int dictSize);
364 LZ4LIB_API
int LZ4_decompress_fast_usingDict (
const char* src,
char* dst,
int originalSize,
const char* dictStart,
int dictSize);
380 #ifdef LZ4_STATIC_LINKING_ONLY 413 LZ4LIB_API
void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
426 LZ4LIB_API
int LZ4_compress_fast_extState_fastReset (
void* state,
const char* src,
char* dst,
int srcSize,
int dstCapacity,
int acceleration);
454 LZ4LIB_API
void LZ4_attach_dictionary(LZ4_stream_t *working_stream,
const LZ4_stream_t *dictionary_stream);
465 #define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2) 466 #define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE) 467 #define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) 469 #if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) ) 472 typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
473 struct LZ4_stream_t_internal {
474 uint32_t hashTable[LZ4_HASH_SIZE_U32];
475 uint32_t currentOffset;
478 const uint8_t* dictionary;
479 const LZ4_stream_t_internal* dictCtx;
484 const uint8_t* externalDict;
486 const uint8_t* prefixEnd;
488 } LZ4_streamDecode_t_internal;
492 typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
493 struct LZ4_stream_t_internal {
494 unsigned int hashTable[LZ4_HASH_SIZE_U32];
495 unsigned int currentOffset;
496 unsigned short initCheck;
497 unsigned short tableType;
498 const unsigned char* dictionary;
499 const LZ4_stream_t_internal* dictCtx;
500 unsigned int dictSize;
504 const unsigned char* externalDict;
506 const unsigned char* prefixEnd;
508 } LZ4_streamDecode_t_internal;
520 #define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4) 521 #define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long)) 523 unsigned long long table[LZ4_STREAMSIZE_U64];
524 LZ4_stream_t_internal internal_donotuse;
536 #define LZ4_STREAMDECODESIZE_U64 4 537 #define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long)) 538 union LZ4_streamDecode_u {
539 unsigned long long table[LZ4_STREAMDECODESIZE_U64];
540 LZ4_streamDecode_t_internal internal_donotuse;
554 #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS 555 # define LZ4_DEPRECATED(message) 557 # define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) 558 # if defined (__cplusplus) && (__cplusplus >= 201402) 559 # define LZ4_DEPRECATED(message) [[deprecated(message)]] 560 # elif (LZ4_GCC_VERSION >= 405) || defined(__clang__) 561 # define LZ4_DEPRECATED(message) __attribute__((deprecated(message))) 562 # elif (LZ4_GCC_VERSION >= 301) 563 # define LZ4_DEPRECATED(message) __attribute__((deprecated)) 564 # elif defined(_MSC_VER) 565 # define LZ4_DEPRECATED(message) __declspec(deprecated(message)) 568 # define LZ4_DEPRECATED(message) NLIB_DEPRECATED_MSG(message) 573 LZ4_DEPRECATED(
"use LZ4_compress_default() instead") LZ4LIB_API
int LZ4_compress (const
char* source,
char* dest,
int sourceSize);
574 LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API
int LZ4_compress_limitedOutput (const
char* source,
char* dest,
int sourceSize,
int maxOutputSize);
575 LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API
int LZ4_compress_withState (
void* state, const
char* source,
char* dest,
int inputSize);
576 LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API
int LZ4_compress_limitedOutput_withState (
void* state, const
char* source,
char* dest,
int inputSize,
int maxOutputSize);
577 LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API
int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const
char* source,
char* dest,
int inputSize);
578 LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API
int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const
char* source,
char* dest,
int inputSize,
int maxOutputSize);
581 LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API
int LZ4_uncompress (const
char* source,
char* dest,
int outputSize);
582 LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API
int LZ4_uncompress_unknownOutputSize (const
char* source,
char* dest,
int isize,
int maxOutputSize);
593 LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API
void* LZ4_create (
char* inputBuffer);
594 LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API
int LZ4_sizeofStreamState(
void);
595 LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API
int LZ4_resetStreamState(
void* state,
char* inputBuffer);
596 LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API
char* LZ4_slideInputBuffer (
void* state);
599 LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API
int LZ4_decompress_safe_withPrefix64k (const
char* src,
char* dst,
int compressedSize,
int maxDstSize);
600 LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API
int LZ4_decompress_fast_withPrefix64k (const
char* src,
char* dst,
int originalSize);
605 #if defined (__cplusplus)