45 #ifndef LZ4F_H_09782039843
46 #define LZ4F_H_09782039843
48 #if defined (__cplusplus)
72 #ifndef LZ4FLIB_VISIBILITY
73 # if defined(__GNUC__) && (__GNUC__ >= 4)
74 # define LZ4FLIB_VISIBILITY __attribute__ ((visibility ("default")))
76 # define LZ4FLIB_VISIBILITY
79 #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
80 # define LZ4FLIB_API __declspec(dllexport) LZ4FLIB_VISIBILITY
81 #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
82 # define LZ4FLIB_API __declspec(dllimport) LZ4FLIB_VISIBILITY
84 # define LZ4FLIB_API LZ4FLIB_VISIBILITY
87 #ifdef LZ4F_DISABLE_DEPRECATE_WARNINGS
88 # define LZ4F_DEPRECATE(x) x
90 # if defined(_MSC_VER)
91 # define LZ4F_DEPRECATE(x) x
92 # elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
93 # define LZ4F_DEPRECATE(x) x __attribute__((deprecated))
95 # define LZ4F_DEPRECATE(x) x
113 #ifdef LZ4F_ENABLE_OBSOLETE_ENUMS
114 # define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x
116 # define LZ4F_OBSOLETE_ENUM(x)
163 #ifdef LZ4F_ENABLE_OBSOLETE_ENUMS
185 #define LZ4F_INIT_FRAMEINFO { LZ4F_default, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum }
200 #define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } }
225 const void* srcBuffer,
size_t srcSize,
242 #define LZ4F_VERSION 100
259 #define LZ4F_HEADER_SIZE_MIN 7
260 #define LZ4F_HEADER_SIZE_MAX 19
263 #define LZ4F_BLOCK_HEADER_SIZE 4
266 #define LZ4F_BLOCK_CHECKSUM_SIZE 4
269 #define LZ4F_CONTENT_CHECKSUM_SIZE 4
279 void* dstBuffer,
size_t dstCapacity,
311 void* dstBuffer,
size_t dstCapacity,
312 const void* srcBuffer,
size_t srcSize,
325 void* dstBuffer,
size_t dstCapacity,
339 void* dstBuffer,
size_t dstCapacity,
374 #define LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH 5
432 const void* srcBuffer,
size_t* srcSizePtr);
466 void* dstBuffer,
size_t* dstSizePtr,
467 const void* srcBuffer,
size_t* srcSizePtr,
480 #if defined (__cplusplus)
486 #if defined(LZ4F_STATIC_LINKING_ONLY) && !defined(LZ4F_H_STATIC_09782039843)
487 #define LZ4F_H_STATIC_09782039843
489 #if defined (__cplusplus)
503 #ifdef LZ4F_PUBLISH_STATIC_FUNCTIONS
504 # define LZ4FLIB_STATIC_API LZ4FLIB_API
506 # define LZ4FLIB_STATIC_API
511 #define LZ4F_LIST_ERRORS(ITEM) \
513 ITEM(ERROR_GENERIC) \
514 ITEM(ERROR_maxBlockSize_invalid) \
515 ITEM(ERROR_blockMode_invalid) \
516 ITEM(ERROR_contentChecksumFlag_invalid) \
517 ITEM(ERROR_compressionLevel_invalid) \
518 ITEM(ERROR_headerVersion_wrong) \
519 ITEM(ERROR_blockChecksum_invalid) \
520 ITEM(ERROR_reservedFlag_set) \
521 ITEM(ERROR_allocation_failed) \
522 ITEM(ERROR_srcSize_tooLarge) \
523 ITEM(ERROR_dstMaxSize_tooSmall) \
524 ITEM(ERROR_frameHeader_incomplete) \
525 ITEM(ERROR_frameType_unknown) \
526 ITEM(ERROR_frameSize_wrong) \
527 ITEM(ERROR_srcPtr_wrong) \
528 ITEM(ERROR_decompressionFailed) \
529 ITEM(ERROR_headerChecksum_invalid) \
530 ITEM(ERROR_contentChecksum_invalid) \
531 ITEM(ERROR_frameDecoding_alreadyStarted) \
534 #define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM,
537 typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM)
538 _LZ4F_dummy_error_enum_for_c89_never_used } LZ4F_errorCodes;
572 LZ4FLIB_STATIC_API LZ4F_CDict*
LZ4F_createCDict(
const void* dictBuffer,
size_t dictSize);
588 void*
dst,
size_t dstCapacity,
590 const LZ4F_CDict* cdict,
603 void* dstBuffer,
size_t dstCapacity,
604 const LZ4F_CDict* cdict,
614 void* dstBuffer,
size_t* dstSizePtr,
615 const void* srcBuffer,
size_t* srcSizePtr,
616 const void* dict,
size_t dictSize,
619 #if defined (__cplusplus)
size_t LZ4F_getBlockSize(unsigned blockSizeID)
LZ4F_CDict * LZ4F_createCDict(const void *dictBuffer, size_t dictSize)
size_t LZ4F_compressFrame_usingCDict(LZ4F_cctx *cctx, void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_CDict *cdict, const LZ4F_preferences_t *preferencesPtr)
size_t LZ4F_decompress_usingDict(LZ4F_dctx *dctx, void *dstBuffer, size_t *dstSizePtr, const void *srcBuffer, size_t *srcSizePtr, const void *dict, size_t dictSize, const LZ4F_decompressOptions_t *decompressOptionsPtr)
LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult)
void LZ4F_freeCDict(LZ4F_CDict *cdict)
size_t LZ4F_compressBegin_usingCDict(LZ4F_cctx *cctxPtr, void *dstBuffer, size_t dstCapacity, const LZ4F_CDict *cdict, const LZ4F_preferences_t *preferencesPtr)
#define LZ4F_OBSOLETE_ENUM(x)
LZ4FLIB_API void LZ4F_resetDecompressionContext(LZ4F_dctx *dctx)
LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t *preferencesPtr)
LZ4FLIB_API size_t LZ4F_compressUpdate(LZ4F_cctx *cctx, void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_compressOptions_t *cOptPtr)
LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx *cctx)
LZ4FLIB_API int LZ4F_compressionLevel_max(void)
LZ4FLIB_API size_t LZ4F_compressEnd(LZ4F_cctx *cctx, void *dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t *cOptPtr)
LZ4FLIB_API const char * LZ4F_getErrorName(LZ4F_errorCode_t code)
LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx *dctx)
LZ4FLIB_API unsigned LZ4F_isError(LZ4F_errorCode_t code)
LZ4FLIB_API size_t LZ4F_flush(LZ4F_cctx *cctx, void *dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t *cOptPtr)
LZ4F_cctx * LZ4F_compressionContext_t
LZ4FLIB_API size_t LZ4F_headerSize(const void *src, size_t srcSize)
LZ4FLIB_API LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx **dctxPtr, unsigned version)
LZ4F_dctx * LZ4F_decompressionContext_t
LZ4FLIB_API size_t LZ4F_decompress(LZ4F_dctx *dctx, void *dstBuffer, size_t *dstSizePtr, const void *srcBuffer, size_t *srcSizePtr, const LZ4F_decompressOptions_t *dOptPtr)
LZ4FLIB_API size_t LZ4F_getFrameInfo(LZ4F_dctx *dctx, LZ4F_frameInfo_t *frameInfoPtr, const void *srcBuffer, size_t *srcSizePtr)
LZ4FLIB_API size_t LZ4F_compressBegin(LZ4F_cctx *cctx, void *dstBuffer, size_t dstCapacity, const LZ4F_preferences_t *prefsPtr)
LZ4FLIB_API unsigned LZ4F_getVersion(void)
@ LZ4F_contentChecksumEnabled
LZ4FLIB_API LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx **cctxPtr, unsigned version)
LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t *prefsPtr)
@ LZ4F_blockChecksumEnabled
LZ4FLIB_API size_t LZ4F_compressFrame(void *dstBuffer, size_t dstCapacity, const void *srcBuffer, size_t srcSize, const LZ4F_preferences_t *preferencesPtr)
LZ4F_contentChecksum_t contentChecksumFlag
unsigned long long contentSize
LZ4F_frameType_t frameType
LZ4F_blockChecksum_t blockChecksumFlag
LZ4F_blockMode_t blockMode
LZ4F_blockSizeID_t blockSizeID
LZ4F_frameInfo_t frameInfo