35 #if defined(__cplusplus)
39 #ifndef LZ4_H_2983827168210
40 #define LZ4_H_2983827168210
85 #ifndef LZ4LIB_VISIBILITY
86 #if defined(__GNUC__) && (__GNUC__ >= 4)
87 #define LZ4LIB_VISIBILITY __attribute__((visibility("default")))
89 #define LZ4LIB_VISIBILITY
92 #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT == 1)
93 #define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
94 #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT == 1)
96 __declspec(dllimport) \
101 #define LZ4LIB_API LZ4LIB_VISIBILITY
116 #if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1)
117 #define LZ4_HEAPMODE 0
118 #define LZ4HC_HEAPMODE 0
119 #define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1
120 #if !defined(LZ4_memcpy)
121 #error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'."
123 #if !defined(LZ4_memset)
124 #error "LZ4_FREESTANDING requires macro 'LZ4_memset'."
126 #if !defined(LZ4_memmove)
127 #error "LZ4_FREESTANDING requires macro 'LZ4_memmove'."
129 #elif !defined(LZ4_FREESTANDING)
130 #define LZ4_FREESTANDING 0
134 #define LZ4_VERSION_MAJOR 1
135 #define LZ4_VERSION_MINOR \
138 #define LZ4_VERSION_RELEASE 0
140 #define LZ4_VERSION_NUMBER \
141 (LZ4_VERSION_MAJOR * 100 * 100 + LZ4_VERSION_MINOR * 100 + \
144 #define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
145 #define LZ4_QUOTE(str) #str
146 #define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
147 #define LZ4_VERSION_STRING \
148 LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
169 #ifndef LZ4_MEMORY_USAGE
170 #define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
174 #define LZ4_MEMORY_USAGE_MIN 10
175 #define LZ4_MEMORY_USAGE_DEFAULT 14
176 #define LZ4_MEMORY_USAGE_MAX 20
178 #if (LZ4_MEMORY_USAGE < LZ4_MEMORY_USAGE_MIN)
179 #error "LZ4_MEMORY_USAGE is too small !"
182 #if (LZ4_MEMORY_USAGE > LZ4_MEMORY_USAGE_MAX)
183 #error "LZ4_MEMORY_USAGE is too large !"
237 int compressedSize,
int dstCapacity);
242 #define LZ4_MAX_INPUT_SIZE 0x7E000000
243 #define LZ4_COMPRESSBOUND(isize) \
244 ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE \
246 : (isize) + ((isize) / 255) + 16)
277 int dstCapacity,
int acceleration);
287 char *dst,
int srcSize,
288 int dstCapacity,
int acceleration);
316 int *srcSizePtr,
int targetDstSize);
358 int srcSize,
int targetOutputSize,
383 #if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
510 const char *src,
char *dst,
511 int srcSize,
int dstCapacity,
538 #if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
553 const char *dictionary,
int dictSize);
567 #define LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize) \
620 const char *src,
char *dst,
int srcSize,
634 int srcSize,
int dstCapacity,
635 const char *dictStart,
645 const char *src,
char *dst,
int compressedSize,
int targetOutputSize,
646 int maxOutputSize,
const char *dictStart,
int dictSize);
674 #ifdef LZ4_STATIC_LINKING_ONLY
676 #ifndef LZ4_STATIC_3504398509
677 #define LZ4_STATIC_3504398509
679 #ifdef LZ4_PUBLISH_STATIC_FUNCTIONS
680 #define LZ4LIB_STATIC_API LZ4LIB_API
682 #define LZ4LIB_STATIC_API
696 LZ4LIB_STATIC_API
int
698 int srcSize,
int dstCapacity,
706 int *srcSizePtr,
int targetDstSize,
762 #define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) \
763 (((compressedSize) >> 8) + 32)
764 #define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) \
765 ((decompressedSize) + \
766 LZ4_DECOMPRESS_INPLACE_MARGIN( \
772 #ifndef LZ4_DISTANCE_MAX
774 #define LZ4_DISTANCE_MAX 65535
777 #define LZ4_COMPRESS_INPLACE_MARGIN \
778 (LZ4_DISTANCE_MAX + 32)
780 #define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) \
781 ((maxCompressedSize) + \
782 LZ4_COMPRESS_INPLACE_MARGIN)
791 #ifndef LZ4_H_98237428734687
792 #define LZ4_H_98237428734687
802 #define LZ4_HASHLOG (LZ4_MEMORY_USAGE - 2)
803 #define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
804 #define LZ4_HASH_SIZE_U32 \
807 #if defined(__cplusplus) || \
808 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) )
838 #define LZ4_STREAM_MINSIZE \
839 ((1UL << (LZ4_MEMORY_USAGE)) + \
875 #define LZ4_STREAMDECODE_MINSIZE 32
896 #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
897 #define LZ4_DEPRECATED(message)
899 #if defined(__cplusplus) && (__cplusplus >= 201402)
900 #define LZ4_DEPRECATED(message) [[deprecated(message)]]
901 #elif defined(_MSC_VER)
902 #define LZ4_DEPRECATED(message) __declspec(deprecated(message))
903 #elif defined(__clang__) || \
904 (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45))
905 #define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
906 #elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31)
907 #define LZ4_DEPRECATED(message) __attribute__((deprecated))
910 "WARNING: LZ4_DEPRECATED needs custom implementation for this compiler")
911 #define LZ4_DEPRECATED(message)
920 int srcSize,
int maxOutputSize);
923 char *dest,
int inputSize);
927 char *dest,
int inputSize,
932 char *dest,
int inputSize);
936 const
char *source,
char *dest,
937 int inputSize,
int maxOutputSize);
944 int isize,
int maxOutputSize);
969 int compressedSize,
int maxDstSize);
1010 LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using "
1014 LZ4_DEPRECATED("This function is deprecated and unsafe. Consider migrating "
1016 "Note that the contract will change (requires block's "
1017 "compressed size, instead of decompressed size)")
1020 const
char *src,
char *dst,
int originalSize);
1021 LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using "
1025 const
char *dictStart,
1038 #if defined(__cplusplus)
int LZ4_compress_fast_extState_fastReset(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
int LZ4_compress_destSize_extState(void *state, const char *src, char *dst, int *srcSizePtr, int targetDstSize, int acceleration)
int LZ4_decompress_fast_withPrefix64k(const char *src, char *dst, int originalSize)
#define LZ4_STREAMDECODE_MINSIZE
int LZ4_saveDict(LZ4_stream_t *streamPtr, char *safeBuffer, int maxDictSize)
int LZ4_decompress_fast_usingDict(const char *src, char *dst, int originalSize, const char *dictStart, int dictSize)
int LZ4_compress_fast(const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
const char * LZ4_versionString(void)
int LZ4_compress_limitedOutput_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize, int maxOutputSize)
int LZ4_freeStream(LZ4_stream_t *streamPtr)
int LZ4_compress_fast_extState(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
LZ4_stream_t * LZ4_createStream(void)
LZ4_streamDecode_t * LZ4_createStreamDecode(void)
int LZ4_compressBound(int inputSize)
int LZ4_decompress_safe_partial(const char *src, char *dst, int srcSize, int targetOutputSize, int dstCapacity)
void * LZ4_create(char *inputBuffer)
int LZ4_compress_withState(void *state, const char *source, char *dest, int inputSize)
int LZ4_decoderRingBufferSize(int maxBlockSize)
LZ4_stream_t * LZ4_initStream(void *stateBuffer, size_t size)
int LZ4_compress_fast_continue(LZ4_stream_t *streamPtr, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
int LZ4_compress_destSize(const char *src, char *dst, int *srcSizePtr, int targetDstSize)
int LZ4_sizeofState(void)
int LZ4_compress(const char *src, char *dest, int srcSize)
int LZ4_decompress_safe_partial_usingDict(const char *src, char *dst, int compressedSize, int targetOutputSize, int maxOutputSize, const char *dictStart, int dictSize)
void LZ4_resetStream_fast(LZ4_stream_t *streamPtr)
#define LZ4_HASH_SIZE_U32
int LZ4_uncompress(const char *source, char *dest, int outputSize)
#define LZ4_STREAM_MINSIZE
int LZ4_decompress_safe_withPrefix64k(const char *src, char *dst, int compressedSize, int maxDstSize)
void LZ4_resetStream(LZ4_stream_t *streamPtr)
int LZ4_decompress_fast(const char *src, char *dst, int originalSize)
int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize)
int LZ4_compress_limitedOutput(const char *src, char *dest, int srcSize, int maxOutputSize)
int LZ4_loadDict(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize)
char * LZ4_slideInputBuffer(void *state)
int LZ4_sizeofStreamState(void)
int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
int LZ4_versionNumber(void)
int LZ4_compress_default(const char *src, char *dst, int srcSize, int dstCapacity)
int LZ4_compress_limitedOutput_withState(void *state, const char *source, char *dest, int inputSize, int maxOutputSize)
int LZ4_loadDictSlow(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize)
int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int srcSize, int dstCapacity)
int LZ4_resetStreamState(void *state, char *inputBuffer)
int LZ4_decompress_safe(const char *src, char *dst, int compressedSize, int dstCapacity)
void LZ4_attach_dictionary(LZ4_stream_t *workingStream, const LZ4_stream_t *dictionaryStream)
int LZ4_compress_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize)
int LZ4_decompress_safe_usingDict(const char *src, char *dst, int srcSize, int dstCapacity, const char *dictStart, int dictSize)
int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int originalSize)
#define LZ4_DEPRECATED(message)
int LZ4_freeStreamDecode(LZ4_streamDecode_t *LZ4_stream)
const LZ4_stream_t_internal * dictCtx
LZ4_u32 hashTable[(1<<(14 - 2))]
const LZ4_byte * dictionary
LZ4_streamDecode_t_internal internal_donotuse
LZ4_stream_t_internal internal_donotuse
char minStateSize[((1UL<<(14))+32)]