diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2022-07-05 22:07:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 22:07:36 (GMT) |
commit | 4da5c4dd30ccc584b0c6fafe948375b00b5fb2bd (patch) | |
tree | f89fd17c2b9db0ea0fc50f060cec97e9b818f90e /lib/lz4frame.h | |
parent | f745a01cfd6363093de97e6969661cbe99e2393d (diff) | |
parent | 0ac3c74de1b6de584c361f3e9485dde35f10c756 (diff) | |
download | lz4-4da5c4dd30ccc584b0c6fafe948375b00b5fb2bd.zip lz4-4da5c4dd30ccc584b0c6fafe948375b00b5fb2bd.tar.gz lz4-4da5c4dd30ccc584b0c6fafe948375b00b5fb2bd.tar.bz2 |
Merge pull request #1094 from alexmohr/add-uncompressed-api
frame-api: add function to insert uncomressed data
Diffstat (limited to 'lib/lz4frame.h')
-rw-r--r-- | lib/lz4frame.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 6bf20e4..2c5a559 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -306,6 +306,8 @@ LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* * This value is provided by LZ4F_compressBound(). * If this condition is not respected, LZ4F_compress() will fail (result is an errorCode). * After an error, the state is left in a UB state, and must be re-initialized or freed. + * If previously an uncompressed block was written, buffered data is flushed + * before appending compressed data is continued. * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). * or an error code if it fails (which can be tested using LZ4F_isError()) @@ -545,6 +547,24 @@ LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult); LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(unsigned); +/*! LZ4F_uncompressedUpdate() : + * LZ4F_uncompressedUpdate() can be called repetitively to add as much data uncompressed data as necessary. + * Important rule: dstCapacity MUST be large enough to store the entire source buffer as + * no compression is done for this operation + * If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode). + * After an error, the state is left in a UB state, and must be re-initialized or freed. + * If previously a compressed block was written, buffered data is flushed + * before appending uncompressed data is continued. + * This is only supported when LZ4F_blockIndependent is used + * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default. + * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). + * or an error code if it fails (which can be tested using LZ4F_isError()) + */ +LZ4FLIB_STATIC_API size_t LZ4F_uncompressedUpdate(LZ4F_cctx* cctx, + void* dstBuffer, size_t dstCapacity, + const void* srcBuffer, size_t srcSize, + const LZ4F_compressOptions_t* cOptPtr); + /********************************** * Bulk processing dictionary API *********************************/ |