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 !"
227 int compressedSize,
int dstCapacity);
232 #define LZ4_MAX_INPUT_SIZE 0x7E000000
233 #define LZ4_COMPRESSBOUND(isize) \
234 ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE \
236 : (isize) + ((isize) / 255) + 16)
262 int dstCapacity,
int acceleration);
272 char *
dst,
int srcSize,
273 int dstCapacity,
int acceleration);
300 int *srcSizePtr,
int targetDstSize);
339 int srcSize,
int targetOutputSize,
364 #if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
487 const char *
src,
char *
dst,
488 int srcSize,
int dstCapacity,
515 #if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
530 const char *dictionary,
int dictSize);
544 #define LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize) \
596 const char *
src,
char *
dst,
int srcSize,
609 int srcSize,
int dstCapacity,
620 const char *
src,
char *
dst,
int compressedSize,
int targetOutputSize,
649 #ifdef LZ4_STATIC_LINKING_ONLY
651 #ifndef LZ4_STATIC_3504398509
652 #define LZ4_STATIC_3504398509
654 #ifdef LZ4_PUBLISH_STATIC_FUNCTIONS
655 #define LZ4LIB_STATIC_API LZ4LIB_API
657 #define LZ4LIB_STATIC_API
671 LZ4LIB_STATIC_API
int
673 int srcSize,
int dstCapacity,
681 int *srcSizePtr,
int targetDstSize,
737 #define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) \
738 (((compressedSize) >> 8) + 32)
739 #define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) \
740 ((decompressedSize) + \
741 LZ4_DECOMPRESS_INPLACE_MARGIN( \
747 #ifndef LZ4_DISTANCE_MAX
749 #define LZ4_DISTANCE_MAX 65535
752 #define LZ4_COMPRESS_INPLACE_MARGIN \
753 (LZ4_DISTANCE_MAX + 32)
755 #define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) \
756 ((maxCompressedSize) + \
757 LZ4_COMPRESS_INPLACE_MARGIN)
766 #ifndef LZ4_H_98237428734687
767 #define LZ4_H_98237428734687
777 #define LZ4_HASHLOG (LZ4_MEMORY_USAGE - 2)
778 #define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
779 #define LZ4_HASH_SIZE_U32 \
782 #if defined(__cplusplus) || \
783 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) )
813 #define LZ4_STREAM_MINSIZE \
814 ((1UL << (LZ4_MEMORY_USAGE)) + \
850 #define LZ4_STREAMDECODE_MINSIZE 32
871 #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
872 #define LZ4_DEPRECATED(message)
874 #if defined(__cplusplus) && (__cplusplus >= 201402)
875 #define LZ4_DEPRECATED(message) [[deprecated(message)]]
876 #elif defined(_MSC_VER)
877 #define LZ4_DEPRECATED(message) __declspec(deprecated(message))
878 #elif defined(__clang__) || \
879 (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45))
880 #define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
881 #elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31)
882 #define LZ4_DEPRECATED(message) __attribute__((deprecated))
885 "WARNING: LZ4_DEPRECATED needs custom implementation for this compiler")
886 #define LZ4_DEPRECATED(message)
895 int srcSize,
int maxOutputSize);
898 char *dest,
int inputSize);
902 char *dest,
int inputSize,
907 char *dest,
int inputSize);
911 const
char *source,
char *dest,
912 int inputSize,
int maxOutputSize);
919 int isize,
int maxOutputSize);
944 int compressedSize,
int maxDstSize);
980 LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using "
984 LZ4_DEPRECATED("This function is deprecated and unsafe. Consider migrating "
986 "Note that the contract will change (requires block's "
987 "compressed size, instead of decompressed size)")
991 LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using "
1008 #if defined(__cplusplus)
int LZ4_decompress_fast_usingDict(const char *source, char *dest, int originalSize, const char *dictStart, int dictSize)
LZ4_FORCE_O2 int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int originalSize)
LZ4_FORCE_O2 int LZ4_decompress_fast(const char *source, char *dest, int originalSize)
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)
LZ4LIB_API int LZ4_compress_fast_continue(LZ4_stream_t *streamPtr, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
#define LZ4_STREAMDECODE_MINSIZE
LZ4LIB_API int LZ4_compress(const char *src, char *dest, int srcSize)
LZ4LIB_API char * LZ4_slideInputBuffer(void *state)
LZ4LIB_API int LZ4_compress_fast(const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
LZ4LIB_API void LZ4_resetStream_fast(LZ4_stream_t *streamPtr)
char int const char * dictStart
LZ4LIB_API int LZ4_compress_limitedOutput(const char *src, char *dest, int srcSize, int maxOutputSize)
LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize)
LZ4LIB_API int LZ4_decompress_safe_partial_usingDict(const char *src, char *dst, int compressedSize, int targetOutputSize, int maxOutputSize, const char *dictStart, int dictSize)
LZ4LIB_API int LZ4_freeStreamDecode(LZ4_streamDecode_t *LZ4_stream)
LZ4LIB_API const char * LZ4_versionString(void)
LZ4LIB_API int LZ4_decompress_safe_withPrefix64k(const char *src, char *dst, int compressedSize, int maxDstSize)
LZ4LIB_API int LZ4_loadDictSlow(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize)
LZ4LIB_API int LZ4_saveDict(LZ4_stream_t *streamPtr, char *safeBuffer, int maxDictSize)
LZ4LIB_API int LZ4_versionNumber(void)
LZ4LIB_API LZ4_streamDecode_t * LZ4_createStreamDecode(void)
LZ4LIB_API void * LZ4_create(char *inputBuffer)
LZ4LIB_API int LZ4_uncompress(const char *source, char *dest, int outputSize)
LZ4LIB_API int LZ4_sizeofState(void)
#define LZ4_HASH_SIZE_U32
#define LZ4_STREAM_MINSIZE
LZ4LIB_API int LZ4_compressBound(int inputSize)
LZ4LIB_API int LZ4_decompress_safe(const char *src, char *dst, int compressedSize, int dstCapacity)
LZ4LIB_API int LZ4_compress_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize)
LZ4LIB_API int LZ4_resetStreamState(void *state, char *inputBuffer)
LZ4LIB_API int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
LZ4LIB_API int LZ4_decompress_safe_usingDict(const char *src, char *dst, int srcSize, int dstCapacity, const char *dictStart, int dictSize)
LZ4LIB_API int LZ4_freeStream(LZ4_stream_t *streamPtr)
LZ4LIB_API int LZ4_compress_limitedOutput_withState(void *state, const char *source, char *dest, int inputSize, int maxOutputSize)
LZ4LIB_API LZ4_stream_t * LZ4_initStream(void *stateBuffer, size_t size)
LZ4LIB_API int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize)
LZ4LIB_API int LZ4_compress_fast_extState(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
LZ4LIB_API int LZ4_decompress_safe_partial(const char *src, char *dst, int srcSize, int targetOutputSize, int dstCapacity)
LZ4LIB_API int LZ4_decompress_fast_withPrefix64k(const char *src, char *dst, int originalSize)
LZ4LIB_API int LZ4_compress_limitedOutput_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize, int maxOutputSize)
LZ4LIB_API int LZ4_loadDict(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize)
LZ4LIB_API void LZ4_attach_dictionary(LZ4_stream_t *workingStream, const LZ4_stream_t *dictionaryStream)
LZ4LIB_API int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int srcSize, int dstCapacity)
LZ4LIB_API void LZ4_resetStream(LZ4_stream_t *streamPtr)
char int const char int dictSize
LZ4LIB_API int LZ4_compress_destSize(const char *src, char *dst, int *srcSizePtr, int targetDstSize)
LZ4LIB_API int LZ4_compress_default(const char *src, char *dst, int srcSize, int dstCapacity)
LZ4LIB_API LZ4_stream_t * LZ4_createStream(void)
LZ4LIB_API int LZ4_sizeofStreamState(void)
LZ4LIB_API int LZ4_compress_withState(void *state, const char *source, char *dest, int inputSize)
#define LZ4_DEPRECATED(message)
const LZ4_stream_t_internal * dictCtx
const LZ4_byte * dictionary
LZ4_u32 hashTable[LZ4_HASH_SIZE_U32]
LZ4_streamDecode_t_internal internal_donotuse
char minStateSize[LZ4_STREAMDECODE_MINSIZE]
char minStateSize[LZ4_STREAM_MINSIZE]
LZ4_stream_t_internal internal_donotuse