summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliot Gorokhovsky <embg@fb.com>2023-02-03 20:47:47 (GMT)
committerElliot Gorokhovsky <embg@fb.com>2023-02-03 20:51:05 (GMT)
commitc3addfea0f457cd7109d17fd32ea029369cdd45e (patch)
treeeb53b6d4b9162f36a1dd439a29f215ba497b0c55
parent1f3adea1c68ea61f41903d959b4f98f45aa527a7 (diff)
downloadlz4-c3addfea0f457cd7109d17fd32ea029369cdd45e.zip
lz4-c3addfea0f457cd7109d17fd32ea029369cdd45e.tar.gz
lz4-c3addfea0f457cd7109d17fd32ea029369cdd45e.tar.bz2
improve LZ4F_decompress() documentation
-rw-r--r--lib/lz4frame.h5
1 files changed, 5 insertions, 0 deletions
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.