Blame src/lz4frame.h

Packit 2997f0
/*
Packit 2997f0
   LZ4 auto-framing library
Packit 2997f0
   Header File
Packit 2997f0
   Copyright (C) 2011-2017, Yann Collet.
Packit 2997f0
   BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Packit 2997f0
Packit 2997f0
   Redistribution and use in source and binary forms, with or without
Packit 2997f0
   modification, are permitted provided that the following conditions are
Packit 2997f0
   met:
Packit 2997f0
Packit 2997f0
       * Redistributions of source code must retain the above copyright
Packit 2997f0
   notice, this list of conditions and the following disclaimer.
Packit 2997f0
       * Redistributions in binary form must reproduce the above
Packit 2997f0
   copyright notice, this list of conditions and the following disclaimer
Packit 2997f0
   in the documentation and/or other materials provided with the
Packit 2997f0
   distribution.
Packit 2997f0
Packit 2997f0
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 2997f0
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 2997f0
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 2997f0
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 2997f0
   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 2997f0
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 2997f0
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 2997f0
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 2997f0
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 2997f0
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 2997f0
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 2997f0
Packit 2997f0
   You can contact the author at :
Packit 2997f0
   - LZ4 source repository : https://github.com/lz4/lz4
Packit 2997f0
   - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
Packit 2997f0
*/
Packit 2997f0
Packit 2997f0
/* LZ4F is a stand-alone API to create LZ4-compressed frames
Packit 2997f0
 * conformant with specification v1.5.1.
Packit 2997f0
 * It also offers streaming capabilities.
Packit 2997f0
 * lz4.h is not required when using lz4frame.h.
Packit 2997f0
 * */
Packit 2997f0
Packit 2997f0
#ifndef LZ4F_H_09782039843
Packit 2997f0
#define LZ4F_H_09782039843
Packit 2997f0
Packit 2997f0
#if defined (__cplusplus)
Packit 2997f0
extern "C" {
Packit 2997f0
#endif
Packit 2997f0
Packit 2997f0
/* ---   Dependency   --- */
Packit 2997f0
#include <stddef.h>   /* size_t */
Packit 2997f0
Packit 2997f0
Packit 2997f0
/**
Packit 2997f0
  Introduction
Packit 2997f0
Packit 2997f0
  lz4frame.h implements LZ4 frame specification (doc/lz4_Frame_format.md).
Packit 2997f0
  lz4frame.h provides frame compression functions that take care
Packit 2997f0
  of encoding standard metadata alongside LZ4-compressed blocks.
Packit 2997f0
*/
Packit 2997f0
Packit 2997f0
/*-***************************************************************
Packit 2997f0
 *  Compiler specifics
Packit 2997f0
 *****************************************************************/
Packit 2997f0
/*  LZ4_DLL_EXPORT :
Packit 2997f0
 *  Enable exporting of functions when building a Windows DLL
Packit 2997f0
 *  LZ4FLIB_API :
Packit 2997f0
 *  Control library symbols visibility.
Packit 2997f0
 */
Packit 2997f0
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
Packit 2997f0
#  define LZ4FLIB_API __declspec(dllexport)
Packit 2997f0
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
Packit 2997f0
#  define LZ4FLIB_API __declspec(dllimport)
Packit 2997f0
#elif defined(__GNUC__) && (__GNUC__ >= 4)
Packit 2997f0
#  define LZ4FLIB_API __attribute__ ((__visibility__ ("default")))
Packit 2997f0
#else
Packit 2997f0
#  define LZ4FLIB_API
Packit 2997f0
#endif
Packit 2997f0
Packit 2997f0
#if defined(_MSC_VER)
Packit 2997f0
#  define LZ4F_DEPRECATE(x) x   /* __declspec(deprecated) x - only works with C++ */
Packit 2997f0
#elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
Packit 2997f0
#  define LZ4F_DEPRECATE(x) x __attribute__((deprecated))
Packit 2997f0
#else
Packit 2997f0
#  define LZ4F_DEPRECATE(x) x   /* no deprecation warning for this compiler */
Packit 2997f0
#endif
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*-************************************
Packit 2997f0
 *  Error management
Packit 2997f0
 **************************************/
Packit 2997f0
typedef size_t LZ4F_errorCode_t;
Packit 2997f0
Packit 2997f0
LZ4FLIB_API unsigned    LZ4F_isError(LZ4F_errorCode_t code);   /**< tells if a `LZ4F_errorCode_t` function result is an error code */
Packit 2997f0
LZ4FLIB_API const char* LZ4F_getErrorName(LZ4F_errorCode_t code);   /**< return error code string; useful for debugging */
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*-************************************
Packit 2997f0
 *  Frame compression types
Packit 2997f0
 **************************************/
Packit 2997f0
/* #define LZ4F_DISABLE_OBSOLETE_ENUMS */  /* uncomment to disable obsolete enums */
Packit 2997f0
#ifndef LZ4F_DISABLE_OBSOLETE_ENUMS
Packit 2997f0
#  define LZ4F_OBSOLETE_ENUM(x) , LZ4F_DEPRECATE(x) = LZ4F_##x
Packit 2997f0
#else
Packit 2997f0
#  define LZ4F_OBSOLETE_ENUM(x)
Packit 2997f0
#endif
Packit 2997f0
Packit 2997f0
/* The larger the block size, the (slightly) better the compression ratio,
Packit 2997f0
 * though there are diminishing returns.
Packit 2997f0
 * Larger blocks also increase memory usage on both compression and decompression sides. */
Packit 2997f0
typedef enum {
Packit 2997f0
    LZ4F_default=0,
Packit 2997f0
    LZ4F_max64KB=4,
Packit 2997f0
    LZ4F_max256KB=5,
Packit 2997f0
    LZ4F_max1MB=6,
Packit 2997f0
    LZ4F_max4MB=7
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(max64KB)
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(max256KB)
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(max1MB)
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(max4MB)
Packit 2997f0
} LZ4F_blockSizeID_t;
Packit 2997f0
Packit 2997f0
/* Linked blocks sharply reduce inefficiencies when using small blocks,
Packit 2997f0
 * they compress better.
Packit 2997f0
 * However, some LZ4 decoders are only compatible with independent blocks */
Packit 2997f0
typedef enum {
Packit 2997f0
    LZ4F_blockLinked=0,
Packit 2997f0
    LZ4F_blockIndependent
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(blockLinked)
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(blockIndependent)
Packit 2997f0
} LZ4F_blockMode_t;
Packit 2997f0
Packit 2997f0
typedef enum {
Packit 2997f0
    LZ4F_noContentChecksum=0,
Packit 2997f0
    LZ4F_contentChecksumEnabled
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(noContentChecksum)
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(contentChecksumEnabled)
Packit 2997f0
} LZ4F_contentChecksum_t;
Packit 2997f0
Packit 2997f0
typedef enum {
Packit 2997f0
    LZ4F_frame=0,
Packit 2997f0
    LZ4F_skippableFrame
Packit 2997f0
    LZ4F_OBSOLETE_ENUM(skippableFrame)
Packit 2997f0
} LZ4F_frameType_t;
Packit 2997f0
Packit 2997f0
#ifndef LZ4F_DISABLE_OBSOLETE_ENUMS
Packit 2997f0
typedef LZ4F_blockSizeID_t blockSizeID_t;
Packit 2997f0
typedef LZ4F_blockMode_t blockMode_t;
Packit 2997f0
typedef LZ4F_frameType_t frameType_t;
Packit 2997f0
typedef LZ4F_contentChecksum_t contentChecksum_t;
Packit 2997f0
#endif
Packit 2997f0
Packit 2997f0
/*! LZ4F_frameInfo_t :
Packit 2997f0
 * makes it possible to supply detailed frame parameters to the stream interface.
Packit 2997f0
 * It's not required to set all fields, as long as the structure was initially memset() to zero.
Packit 2997f0
 * All reserved fields must be set to zero. */
Packit 2997f0
typedef struct {
Packit 2997f0
  LZ4F_blockSizeID_t     blockSizeID;           /* max64KB, max256KB, max1MB, max4MB ; 0 == default */
Packit 2997f0
  LZ4F_blockMode_t       blockMode;             /* blockLinked, blockIndependent ; 0 == default */
Packit 2997f0
  LZ4F_contentChecksum_t contentChecksumFlag;   /* noContentChecksum, contentChecksumEnabled ; 0 == default  */
Packit 2997f0
  LZ4F_frameType_t       frameType;             /* LZ4F_frame, skippableFrame ; 0 == default */
Packit 2997f0
  unsigned long long     contentSize;           /* Size of uncompressed (original) content ; 0 == unknown */
Packit 2997f0
  unsigned               reserved[2];           /* must be zero for forward compatibility */
Packit 2997f0
} LZ4F_frameInfo_t;
Packit 2997f0
Packit 2997f0
/*! LZ4F_preferences_t :
Packit 2997f0
 * makes it possible to supply detailed compression parameters to the stream interface.
Packit 2997f0
 * It's not required to set all fields, as long as the structure was initially memset() to zero.
Packit 2997f0
 * All reserved fields must be set to zero. */
Packit 2997f0
typedef struct {
Packit 2997f0
  LZ4F_frameInfo_t frameInfo;
Packit 2997f0
  int      compressionLevel;       /* 0 == default (fast mode); values above LZ4HC_CLEVEL_MAX count as LZ4HC_CLEVEL_MAX; values below 0 count as 0 */
Packit 2997f0
  unsigned autoFlush;              /* 1 == always flush (reduce usage of tmp buffer) */
Packit 2997f0
  unsigned reserved[4];            /* must be zero for forward compatibility */
Packit 2997f0
} LZ4F_preferences_t;
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*-*********************************
Packit 2997f0
*  Simple compression function
Packit 2997f0
***********************************/
Packit 2997f0
/*!LZ4F_compressFrameBound() :
Packit 2997f0
 * Returns the maximum possible size of a frame compressed with LZ4F_compressFrame() given srcSize content and preferences.
Packit 2997f0
 * Note : this result is only usable with LZ4F_compressFrame(), not with multi-segments compression.
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
Packit 2997f0
Packit 2997f0
/*!LZ4F_compressFrame() :
Packit 2997f0
 * Compress an entire srcBuffer into a valid LZ4 frame, as defined by specification v1.5.1
Packit 2997f0
 * An important rule is that dstBuffer MUST be large enough (dstCapacity) to store the result in worst case situation.
Packit 2997f0
 * This value is supplied by LZ4F_compressFrameBound().
Packit 2997f0
 * If this condition is not respected, LZ4F_compressFrame() will fail (result is an errorCode).
Packit 2997f0
 * The LZ4F_preferences_t structure is optional : you can provide NULL as argument. All preferences will be set to default.
Packit 2997f0
 * @return : number of bytes written into dstBuffer.
Packit 2997f0
 *           or an error code if it fails (can be tested using LZ4F_isError())
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity, const void* srcBuffer, size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
Packit 2997f0
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*-***********************************
Packit 2997f0
*  Advanced compression functions
Packit 2997f0
*************************************/
Packit 2997f0
typedef struct LZ4F_cctx_s LZ4F_cctx;   /* incomplete type */
Packit 2997f0
typedef LZ4F_cctx* LZ4F_compressionContext_t;   /* for compatibility with previous API version */
Packit 2997f0
Packit 2997f0
typedef struct {
Packit 2997f0
  unsigned stableSrc;    /* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */
Packit 2997f0
  unsigned reserved[3];
Packit 2997f0
} LZ4F_compressOptions_t;
Packit 2997f0
Packit 2997f0
/*---   Resource Management   ---*/
Packit 2997f0
Packit 2997f0
#define LZ4F_VERSION 100
Packit 2997f0
LZ4FLIB_API unsigned LZ4F_getVersion(void);
Packit 2997f0
/*! LZ4F_createCompressionContext() :
Packit 2997f0
 * The first thing to do is to create a compressionContext object, which will be used in all compression operations.
Packit 2997f0
 * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version.
Packit 2997f0
 * The version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL.
Packit 2997f0
 * The function will provide a pointer to a fully allocated LZ4F_cctx object.
Packit 2997f0
 * If @return != zero, there was an error during context creation.
Packit 2997f0
 * Object can release its memory using LZ4F_freeCompressionContext();
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx** cctxPtr, unsigned version);
Packit 2997f0
LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*----    Compression    ----*/
Packit 2997f0
Packit 2997f0
#define LZ4F_HEADER_SIZE_MAX 15
Packit 2997f0
/*! LZ4F_compressBegin() :
Packit 2997f0
 * will write the frame header into dstBuffer.
Packit 2997f0
 * dstCapacity must be large enough to store the header. Maximum header size is LZ4F_HEADER_SIZE_MAX bytes.
Packit 2997f0
 * `prefsPtr` is optional : you can provide NULL as argument, all preferences will then be set to default.
Packit 2997f0
 * @return : number of bytes written into dstBuffer for the header
Packit 2997f0
 *           or an error code (which can be tested using LZ4F_isError())
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_compressBegin(LZ4F_cctx* cctx, void* dstBuffer, size_t dstCapacity, const LZ4F_preferences_t* prefsPtr);
Packit 2997f0
Packit 2997f0
/*! LZ4F_compressBound() :
Packit 2997f0
 * Provides dstCapacity given a srcSize to guarantee operation success in worst case situations.
Packit 2997f0
 * prefsPtr is optional : you can provide NULL as argument, preferences will be set to cover worst case scenario.
Packit 2997f0
 * Result is always the same for a srcSize and prefsPtr, so it can be trusted to size reusable buffers.
Packit 2997f0
 * When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() operations.
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* prefsPtr);
Packit 2997f0
Packit 2997f0
/*! LZ4F_compressUpdate() :
Packit 2997f0
 * LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary.
Packit 2997f0
 * An important rule is that dstCapacity MUST be large enough to ensure operation success even in worst case situations.
Packit 2997f0
 * This value is provided by LZ4F_compressBound().
Packit 2997f0
 * If this condition is not respected, LZ4F_compress() will fail (result is an errorCode).
Packit 2997f0
 * LZ4F_compressUpdate() doesn't guarantee error recovery. When an error occurs, compression context must be freed or resized.
Packit 2997f0
 * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
Packit 2997f0
 * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
Packit 2997f0
 *           or an error code if it fails (which can be tested using LZ4F_isError())
Packit 2997f0
 */
Packit 2997f0
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);
Packit 2997f0
Packit 2997f0
/*! LZ4F_flush() :
Packit 2997f0
 * When data must be generated and sent immediately, without waiting for a block to be completely filled,
Packit 2997f0
 * it's possible to call LZ4_flush(). It will immediately compress any data buffered within cctx.
Packit 2997f0
 * `dstCapacity` must be large enough to ensure the operation will be successful.
Packit 2997f0
 * `cOptPtr` is optional : it's possible to provide NULL, all options will be set to default.
Packit 2997f0
 * @return : number of bytes written into dstBuffer (it can be zero, which means there was no data stored within cctx)
Packit 2997f0
 *           or an error code if it fails (which can be tested using LZ4F_isError())
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_flush(LZ4F_cctx* cctx, void* dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t* cOptPtr);
Packit 2997f0
Packit 2997f0
/*! LZ4F_compressEnd() :
Packit 2997f0
 * To properly finish an LZ4 frame, invoke LZ4F_compressEnd().
Packit 2997f0
 * It will flush whatever data remained within `cctx` (like LZ4_flush())
Packit 2997f0
 * and properly finalize the frame, with an endMark and a checksum.
Packit 2997f0
 * `cOptPtr` is optional : NULL can be provided, in which case all options will be set to default.
Packit 2997f0
 * @return : number of bytes written into dstBuffer (necessarily >= 4 (endMark), or 8 if optional frame checksum is enabled)
Packit 2997f0
 *           or an error code if it fails (which can be tested using LZ4F_isError())
Packit 2997f0
 * A successful call to LZ4F_compressEnd() makes `cctx` available again for another compression task.
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_compressEnd(LZ4F_cctx* cctx, void* dstBuffer, size_t dstCapacity, const LZ4F_compressOptions_t* cOptPtr);
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*-*********************************
Packit 2997f0
*  Decompression functions
Packit 2997f0
***********************************/
Packit 2997f0
typedef struct LZ4F_dctx_s LZ4F_dctx;   /* incomplete type */
Packit 2997f0
typedef LZ4F_dctx* LZ4F_decompressionContext_t;   /* compatibility with previous API versions */
Packit 2997f0
Packit 2997f0
typedef struct {
Packit 2997f0
  unsigned stableDst;       /* guarantee that decompressed data will still be there on next function calls (avoid storage into tmp buffers) */
Packit 2997f0
  unsigned reserved[3];
Packit 2997f0
} LZ4F_decompressOptions_t;
Packit 2997f0
Packit 2997f0
Packit 2997f0
/* Resource management */
Packit 2997f0
Packit 2997f0
/*!LZ4F_createDecompressionContext() :
Packit 2997f0
 * Create an LZ4F_decompressionContext_t object, which will be used to track all decompression operations.
Packit 2997f0
 * The version provided MUST be LZ4F_VERSION. It is intended to track potential breaking differences between different versions.
Packit 2997f0
 * The function will provide a pointer to a fully allocated and initialized LZ4F_decompressionContext_t object.
Packit 2997f0
 * The result is an errorCode, which can be tested using LZ4F_isError().
Packit 2997f0
 * dctx memory can be released using LZ4F_freeDecompressionContext();
Packit 2997f0
 * The result of LZ4F_freeDecompressionContext() is indicative of the current state of decompressionContext when being released.
Packit 2997f0
 * That is, it should be == 0 if decompression has been completed fully and correctly.
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** dctxPtr, unsigned version);
Packit 2997f0
LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx);
Packit 2997f0
Packit 2997f0
Packit 2997f0
/*-***********************************
Packit 2997f0
*  Streaming decompression functions
Packit 2997f0
*************************************/
Packit 2997f0
Packit 2997f0
/*! LZ4F_getFrameInfo() :
Packit 2997f0
 * This function extracts frame parameters (such as max blockSize, frame checksum, etc.).
Packit 2997f0
 * Its usage is optional. Extracted information can be useful for allocation purposes, typically.
Packit 2997f0
 * This function works in 2 situations :
Packit 2997f0
 *   - At the beginning of a new frame, in which case it will decode this information from `srcBuffer`, and start the decoding process.
Packit 2997f0
 *     Input size must be large enough to successfully decode the entire frame header.
Packit 2997f0
 *     Frame header size is variable, but is guaranteed to be <= LZ4F_HEADER_SIZE_MAX bytes.
Packit 2997f0
 *     It's allowed to provide more input data than this minimum.
Packit 2997f0
 *   - After decoding has been started.
Packit 2997f0
 *     In which case, no input is read, frame parameters are extracted from dctx.
Packit 2997f0
 *     If decoding has just started, but not yet extracted information from header, LZ4F_getFrameInfo() will fail.
Packit 2997f0
 * The number of bytes consumed from srcBuffer will be updated within *srcSizePtr (necessarily <= original value).
Packit 2997f0
 * Decompression must resume from (srcBuffer + *srcSizePtr).
Packit 2997f0
 * @return : an hint about how many srcSize bytes LZ4F_decompress() expects for next call,
Packit 2997f0
 *           or an error code which can be tested using LZ4F_isError()
Packit 2997f0
 * note 1 : in case of error, dctx is not modified. Decoding operations can resume from where they stopped.
Packit 2997f0
 * note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure.
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_getFrameInfo(LZ4F_dctx* dctx,
Packit 2997f0
                                     LZ4F_frameInfo_t* frameInfoPtr,
Packit 2997f0
                                     const void* srcBuffer, size_t* srcSizePtr);
Packit 2997f0
Packit 2997f0
/*! LZ4F_decompress() :
Packit 2997f0
 * Call this function repetitively to regenerate data compressed within `srcBuffer`.
Packit 2997f0
 * The function will attempt to decode up to *srcSizePtr bytes from srcBuffer, into dstBuffer of capacity *dstSizePtr.
Packit 2997f0
 *
Packit 2997f0
 * The number of bytes regenerated into dstBuffer will be provided within *dstSizePtr (necessarily <= original value).
Packit 2997f0
 *
Packit 2997f0
 * The number of bytes read from srcBuffer will be provided within *srcSizePtr (necessarily <= original value).
Packit 2997f0
 * Number of bytes read can be < number of bytes provided, meaning there is some more data to decode.
Packit 2997f0
 * It typically happens when dstBuffer is not large enough to contain all decoded data.
Packit 2997f0
 * Remaining data will have to be presented again in a subsequent invocation.
Packit 2997f0
 *
Packit 2997f0
 * `dstBuffer` content is expected to be flushed between each invocation, as its content will be overwritten.
Packit 2997f0
 * `dstBuffer` can be changed at will between each consecutive function invocation.
Packit 2997f0
 *
Packit 2997f0
 * @return is an hint of how many `srcSize` bytes LZ4F_decompress() expects for next call.
Packit 2997f0
 * Schematically, it's the size of the current (or remaining) compressed block + header of next block.
Packit 2997f0
 * Respecting the hint provides some small speed benefit, because it skips intermediate buffers.
Packit 2997f0
 * This is just a hint though, it's always possible to provide any srcSize.
Packit 2997f0
 * When a frame is fully decoded, @return will be 0 (no more data expected).
Packit 2997f0
 * If decompression failed, @return is an error code, which can be tested using LZ4F_isError().
Packit 2997f0
 *
Packit 2997f0
 * After a frame is fully decoded, dctx can be used again to decompress another frame.
Packit 2997f0
 * After a decompression error, use LZ4F_resetDecompressionContext() before re-using dctx, to return to clean state.
Packit 2997f0
 */
Packit 2997f0
LZ4FLIB_API size_t LZ4F_decompress(LZ4F_dctx* dctx,
Packit 2997f0
                                   void* dstBuffer, size_t* dstSizePtr,
Packit 2997f0
                                   const void* srcBuffer, size_t* srcSizePtr,
Packit 2997f0
                                   const LZ4F_decompressOptions_t* dOptPtr);
Packit 2997f0
Packit 2997f0
Packit 2997f0
Packit 2997f0
#if defined (__cplusplus)
Packit 2997f0
}
Packit 2997f0
#endif
Packit 2997f0
Packit 2997f0
#endif  /* LZ4F_H_09782039843 */