/*1* LZ4 - Fast LZ compression algorithm2* Header File3* Copyright (C) 2011-2017, Yann Collet.45BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)67Redistribution and use in source and binary forms, with or without8modification, are permitted provided that the following conditions are9met:1011* Redistributions of source code must retain the above copyright12notice, this list of conditions and the following disclaimer.13* Redistributions in binary form must reproduce the above14copyright notice, this list of conditions and the following disclaimer15in the documentation and/or other materials provided with the16distribution.1718THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS19"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR21A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT22OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT24LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,25DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY26THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE28OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2930You can contact the author at :31- LZ4 homepage : http://www.lz4.org32- LZ4 source repository : https://github.com/lz4/lz433*/34#if defined (__cplusplus)35extern "C" {36#endif3738#ifndef LZ4_H_298382716821039#define LZ4_H_29838271682104041/* --- Dependency --- */42#include <stddef.h> /* size_t */434445/**46Introduction4748LZ4 is lossless compression algorithm, providing compression speed at 400 MB/s per core,49scalable with multi-cores CPU. It features an extremely fast decoder, with speed in50multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.5152The LZ4 compression library provides in-memory compression and decompression functions.53Compression can be done in:54- a single step (described as Simple Functions)55- a single step, reusing a context (described in Advanced Functions)56- unbounded multiple steps (described as Streaming compression)5758lz4.h provides block compression functions. It gives full buffer control to user.59Decompressing an lz4-compressed block also requires metadata (such as compressed size).60Each application is free to encode such metadata in whichever way it wants.6162An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md),63take care of encoding standard metadata alongside LZ4-compressed blocks.64If your application requires interoperability, it's recommended to use it.65A library is provided to take care of it, see lz4frame.h.66*/6768/*^***************************************************************69* Export parameters70*****************************************************************/71/*72* LZ4_DLL_EXPORT :73* Enable exporting of functions when building a Windows DLL74* LZ4LIB_VISIBILITY :75* Control library symbols visibility.76*/77#ifndef LZ4LIB_VISIBILITY78# if defined(__GNUC__) && (__GNUC__ >= 4)79# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))80# else81# define LZ4LIB_VISIBILITY82# endif83#endif84#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)85# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY86#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)87# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/88#else89# define LZ4LIB_API LZ4LIB_VISIBILITY90#endif9192/*------ Version ------*/93#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */94#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */95#define LZ4_VERSION_RELEASE 2 /* for tweaks, bug-fixes, or development */9697#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)9899#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE100#define LZ4_QUOTE(str) #str101#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)102#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)103104LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */105LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; unseful to check dll version */106107108/*-************************************109* Tuning parameter110**************************************/111/*!112* LZ4_MEMORY_USAGE :113* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)114* Increasing memory usage improves compression ratio115* Reduced memory usage may improve speed, thanks to cache effect116* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache117*/118#ifndef LZ4_MEMORY_USAGE119# define LZ4_MEMORY_USAGE 14120#endif121122/*-************************************123* Simple Functions124**************************************/125/*! LZ4_compress_default() :126Compresses 'srcSize' bytes from buffer 'src'127into already allocated 'dst' buffer of size 'dstCapacity'.128Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize).129It also runs faster, so it's a recommended setting.130If the function cannot compress 'src' into a more limited 'dst' budget,131compression stops *immediately*, and the function result is zero.132Note : as a consequence, 'dst' content is not valid.133Note 2 : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).134srcSize : max supported value is LZ4_MAX_INPUT_SIZE.135dstCapacity : size of buffer 'dst' (which must be already allocated)136return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity)137or 0 if compression fails */138LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);139140/*! LZ4_decompress_safe() :141compressedSize : is the exact complete size of the compressed block.142dstCapacity : is the size of destination buffer, which must be already allocated.143return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity)144If destination buffer is not large enough, decoding will stop and output an error code (negative value).145If the source stream is detected malformed, the function will stop decoding and return a negative result.146This function is protected against malicious data packets.147*/148LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);149150151/*-************************************152* Advanced Functions153**************************************/154#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */155#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)156157/*!158LZ4_compressBound() :159Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)160This function is primarily useful for memory allocation purposes (destination buffer size).161Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).162Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize)163inputSize : max supported value is LZ4_MAX_INPUT_SIZE164return : maximum output size in a "worst case" scenario165or 0, if input size is incorrect (too large or negative)166*/167LZ4LIB_API int LZ4_compressBound(int inputSize);168169/*!170LZ4_compress_fast() :171Same as LZ4_compress_default(), but allows selection of "acceleration" factor.172The larger the acceleration value, the faster the algorithm, but also the lesser the compression.173It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.174An acceleration value of "1" is the same as regular LZ4_compress_default()175Values <= 0 will be replaced by ACCELERATION_DEFAULT (currently == 1, see lz4.c).176*/177LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);178179180/*!181LZ4_compress_fast_extState() :182Same compression function, just using an externally allocated memory space to store compression state.183Use LZ4_sizeofState() to know how much memory must be allocated,184and allocate it on 8-bytes boundaries (using malloc() typically).185Then, provide it as 'void* state' to compression function.186*/187LZ4LIB_API int LZ4_sizeofState(void);188LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);189190191/*!192LZ4_compress_destSize() :193Reverse the logic : compresses as much data as possible from 'src' buffer194into already allocated buffer 'dst' of size 'targetDestSize'.195This function either compresses the entire 'src' content into 'dst' if it's large enough,196or fill 'dst' buffer completely with as much data as possible from 'src'.197*srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'.198New value is necessarily <= old value.199return : Nb bytes written into 'dst' (necessarily <= targetDestSize)200or 0 if compression fails201*/202LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize);203204205/*!206LZ4_decompress_fast() : **unsafe!**207This function is a bit faster than LZ4_decompress_safe(),208but doesn't provide any security guarantee.209originalSize : is the uncompressed size to regenerate210Destination buffer must be already allocated, and its size must be >= 'originalSize' bytes.211return : number of bytes read from source buffer (== compressed size).212If the source stream is detected malformed, the function stops decoding and return a negative result.213note : This function respects memory boundaries for *properly formed* compressed data.214However, it does not provide any protection against malicious input.215It also doesn't know 'src' size, and implies it's >= compressed size.216Use this function in trusted environment **only**.217*/218LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);219220/*!221LZ4_decompress_safe_partial() :222This function decompress a compressed block of size 'srcSize' at position 'src'223into destination buffer 'dst' of size 'dstCapacity'.224The function will decompress a minimum of 'targetOutputSize' bytes, and stop after that.225However, it's not accurate, and may write more than 'targetOutputSize' (but always <= dstCapacity).226@return : the number of bytes decoded in the destination buffer (necessarily <= dstCapacity)227Note : this number can also be < targetOutputSize, if compressed block contains less data.228Therefore, always control how many bytes were decoded.229If source stream is detected malformed, function returns a negative result.230This function is protected against malicious data packets.231*/232LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);233234235/*-*********************************************236* Streaming Compression Functions237***********************************************/238typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */239240/*! LZ4_createStream() and LZ4_freeStream() :241* LZ4_createStream() will allocate and initialize an `LZ4_stream_t` structure.242* LZ4_freeStream() releases its memory.243*/244LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);245LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);246247/*! LZ4_resetStream() :248* An LZ4_stream_t structure can be allocated once and re-used multiple times.249* Use this function to start compressing a new stream.250*/251LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);252253/*! LZ4_loadDict() :254* Use this function to load a static dictionary into LZ4_stream_t.255* Any previous data will be forgotten, only 'dictionary' will remain in memory.256* Loading a size of 0 is allowed, and is the same as reset.257* @return : dictionary size, in bytes (necessarily <= 64 KB)258*/259LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);260261/*! LZ4_compress_fast_continue() :262* Compress 'src' content using data from previously compressed blocks, for better compression ratio.263* 'dst' buffer must be already allocated.264* If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.265*266* Important : The previous 64KB of compressed data is assumed to remain present and unmodified in memory!267*268* Special 1 : When input is a double-buffer, they can have any size, including < 64 KB.269* Make sure that buffers are separated by at least one byte.270* This way, each block only depends on previous block.271* Special 2 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.272*273* @return : size of compressed block274* or 0 if there is an error (typically, cannot fit into 'dst').275* After an error, the stream status is invalid, it can only be reset or freed.276*/277LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);278279/*! LZ4_saveDict() :280* If last 64KB data cannot be guaranteed to remain available at its current memory location,281* save it into a safer place (char* safeBuffer).282* This is schematically equivalent to a memcpy() followed by LZ4_loadDict(),283* but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.284* @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.285*/286LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);287288289/*-**********************************************290* Streaming Decompression Functions291* Bufferless synchronous API292************************************************/293typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* incomplete type (defined later) */294295/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :296* creation / destruction of streaming decompression tracking structure.297* A tracking structure can be re-used multiple times sequentially. */298LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);299LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);300301/*! LZ4_setStreamDecode() :302* An LZ4_streamDecode_t structure can be allocated once and re-used multiple times.303* Use this function to start decompression of a new stream of blocks.304* A dictionary can optionnally be set. Use NULL or size 0 for a reset order.305* @return : 1 if OK, 0 if error306*/307LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);308309/*! LZ4_decompress_*_continue() :310* These decoding functions allow decompression of consecutive blocks in "streaming" mode.311* A block is an unsplittable entity, it must be presented entirely to a decompression function.312* Decompression functions only accept one block at a time.313* The last 64KB of previously decoded data *must* remain available and unmodified at the memory position where they were decoded.314* If less than 64KB of data has been decoded all the data must be present.315*316* Special : if application sets a ring buffer for decompression, it must respect one of the following conditions :317* - Exactly same size as encoding buffer, with same update rule (block boundaries at same positions)318* In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).319* - Larger than encoding buffer, by a minimum of maxBlockSize more bytes.320* maxBlockSize is implementation dependent. It's the maximum size of any single block.321* In which case, encoding and decoding buffers do not need to be synchronized,322* and encoding ring buffer can have any size, including small ones ( < 64 KB).323* - _At least_ 64 KB + 8 bytes + maxBlockSize.324* In which case, encoding and decoding buffers do not need to be synchronized,325* and encoding ring buffer can have any size, including larger than decoding buffer.326* Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer,327* and indicate where it is saved using LZ4_setStreamDecode() before decompressing next block.328*/329LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity);330LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);331332333/*! LZ4_decompress_*_usingDict() :334* These decoding functions work the same as335* a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue()336* They are stand-alone, and don't need an LZ4_streamDecode_t structure.337*/338LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);339LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);340341342/*^**********************************************343* !!!!!! STATIC LINKING ONLY !!!!!!344***********************************************/345346/*-************************************347* Unstable declarations348**************************************349* Declarations in this section should be considered unstable.350* Use at your own peril, etc., etc.351* They may be removed in the future.352* Their signatures may change.353**************************************/354355#ifdef LZ4_STATIC_LINKING_ONLY356357/*! LZ4_resetStream_fast() :358* When an LZ4_stream_t is known to be in a internally coherent state,359* it can often be prepared for a new compression with almost no work, only360* sometimes falling back to the full, expensive reset that is always required361* when the stream is in an indeterminate state (i.e., the reset performed by362* LZ4_resetStream()).363*364* LZ4_streams are guaranteed to be in a valid state when:365* - returned from LZ4_createStream()366* - reset by LZ4_resetStream()367* - memset(stream, 0, sizeof(LZ4_stream_t))368* - the stream was in a valid state and was reset by LZ4_resetStream_fast()369* - the stream was in a valid state and was then used in any compression call370* that returned success371* - the stream was in an indeterminate state and was used in a compression372* call that fully reset the state (LZ4_compress_fast_extState()) and that373* returned success374*/375LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);376377/*! LZ4_compress_fast_extState_fastReset() :378* A variant of LZ4_compress_fast_extState().379*380* Using this variant avoids an expensive initialization step. It is only safe381* to call if the state buffer is known to be correctly initialized already382* (see above comment on LZ4_resetStream_fast() for a definition of "correctly383* initialized"). From a high level, the difference is that this function384* initializes the provided state with a call to LZ4_resetStream_fast() while385* LZ4_compress_fast_extState() starts with a call to LZ4_resetStream().386*/387LZ4LIB_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);388389/*! LZ4_attach_dictionary() :390* This is an experimental API that allows for the efficient use of a391* static dictionary many times.392*393* Rather than re-loading the dictionary buffer into a working context before394* each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a395* working LZ4_stream_t, this function introduces a no-copy setup mechanism,396* in which the working stream references the dictionary stream in-place.397*398* Several assumptions are made about the state of the dictionary stream.399* Currently, only streams which have been prepared by LZ4_loadDict() should400* be expected to work.401*402* Alternatively, the provided dictionary stream pointer may be NULL, in which403* case any existing dictionary stream is unset.404*405* If a dictionary is provided, it replaces any pre-existing stream history.406* The dictionary contents are the only history that can be referenced and407* logically immediately precede the data compressed in the first subsequent408* compression call.409*410* The dictionary will only remain attached to the working stream through the411* first compression call, at the end of which it is cleared. The dictionary412* stream (and source buffer) must remain in-place / accessible / unchanged413* through the completion of the first compression call on the stream.414*/415LZ4LIB_API void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream);416417#endif418419/*-************************************420* Private definitions421**************************************422* Do not use these definitions.423* They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.424* Using these definitions will expose code to API and/or ABI break in future versions of the library.425**************************************/426#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)427#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)428#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */429430#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)431#include <stdint.h>432433typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;434struct LZ4_stream_t_internal {435uint32_t hashTable[LZ4_HASH_SIZE_U32];436uint32_t currentOffset;437uint16_t initCheck;438uint16_t tableType;439const uint8_t* dictionary;440const LZ4_stream_t_internal* dictCtx;441uint32_t dictSize;442};443444typedef struct {445const uint8_t* externalDict;446size_t extDictSize;447const uint8_t* prefixEnd;448size_t prefixSize;449} LZ4_streamDecode_t_internal;450451#else452453typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;454struct LZ4_stream_t_internal {455unsigned int hashTable[LZ4_HASH_SIZE_U32];456unsigned int currentOffset;457unsigned short initCheck;458unsigned short tableType;459const unsigned char* dictionary;460const LZ4_stream_t_internal* dictCtx;461unsigned int dictSize;462};463464typedef struct {465const unsigned char* externalDict;466size_t extDictSize;467const unsigned char* prefixEnd;468size_t prefixSize;469} LZ4_streamDecode_t_internal;470471#endif472473/*!474* LZ4_stream_t :475* information structure to track an LZ4 stream.476* init this structure before first use.477* note : only use in association with static linking !478* this definition is not API/ABI safe,479* it may change in a future version !480*/481#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)482#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long))483union LZ4_stream_u {484unsigned long long table[LZ4_STREAMSIZE_U64];485LZ4_stream_t_internal internal_donotuse;486} ; /* previously typedef'd to LZ4_stream_t */487488489/*!490* LZ4_streamDecode_t :491* information structure to track an LZ4 stream during decompression.492* init this structure using LZ4_setStreamDecode (or memset()) before first use493* note : only use in association with static linking !494* this definition is not API/ABI safe,495* and may change in a future version !496*/497#define LZ4_STREAMDECODESIZE_U64 4498#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))499union LZ4_streamDecode_u {500unsigned long long table[LZ4_STREAMDECODESIZE_U64];501LZ4_streamDecode_t_internal internal_donotuse;502} ; /* previously typedef'd to LZ4_streamDecode_t */503504505/*-************************************506* Obsolete Functions507**************************************/508509/*! Deprecation warnings510Should deprecation warnings be a problem,511it is generally possible to disable them,512typically with -Wno-deprecated-declarations for gcc513or _CRT_SECURE_NO_WARNINGS in Visual.514Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */515#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS516# define LZ4_DEPRECATED(message) /* disable deprecation warnings */517#else518# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)519# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */520# define LZ4_DEPRECATED(message) [[deprecated(message)]]521# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)522# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))523# elif (LZ4_GCC_VERSION >= 301)524# define LZ4_DEPRECATED(message) __attribute__((deprecated))525# elif defined(_MSC_VER)526# define LZ4_DEPRECATED(message) __declspec(deprecated(message))527# else528# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")529# define LZ4_DEPRECATED(message)530# endif531#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */532533/* Obsolete compression functions */534LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* source, char* dest, int sourceSize);535LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);536LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);537LZ4_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);538LZ4_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);539LZ4_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);540541/* Obsolete decompression functions */542LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);543LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);544545/* Obsolete streaming functions; degraded functionality; do not use!546*547* In order to perform streaming compression, these functions depended on data548* that is no longer tracked in the state. They have been preserved as well as549* possible: using them will still produce a correct output. However, they don't550* actually retain any history between compression calls. The compression ratio551* achieved will therefore be no better than compressing each chunk552* independently.553*/554LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);555LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);556LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);557LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);558559/* Obsolete streaming decoding functions */560LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);561LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);562563#endif /* LZ4_H_2983827168210 */564565566#if defined (__cplusplus)567}568#endif569570571