From c3addfea0f457cd7109d17fd32ea029369cdd45e Mon Sep 17 00:00:00 2001 From: Elliot Gorokhovsky Date: Fri, 3 Feb 2023 12:47:47 -0800 Subject: improve LZ4F_decompress() documentation --- lib/lz4frame.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 2c356a3..e8ce66d 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -473,6 +473,11 @@ LZ4F_getFrameInfo(LZ4F_dctx* dctx, * `dstBuffer` can freely change between each consecutive function invocation. * `dstBuffer` content will be overwritten. * + * Note: if `LZ4F_getFrameInfo()` is called before `LZ4F_decompress()`, srcBuffer must be updated to reflect + * the number of bytes consumed after reading the frame header. Failure to update srcBuffer before calling + * `LZ4F_decompress()` will cause decompression failure or, even worse, successful but incorrect decompression. + * See the `LZ4F_getFrameInfo()` docs for details. + * * @return : an hint of how many `srcSize` bytes LZ4F_decompress() expects for next call. * Schematically, it's the size of the current (or remaining) compressed block + header of next block. * Respecting the hint provides some small speed benefit, because it skips intermediate buffers. -- cgit v0.12