summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-08-30 22:42:04 (GMT)
committerYann Collet <cyan@fb.com>2017-08-30 22:42:04 (GMT)
commite3c71584ff3242ce0a42e1cdeb183756b2c47da4 (patch)
treeecff73b80d75f282d5d9ea7936412b2269857fc5 /lib
parent69c3f4bb55c6f0498f3ba6e23218e82c5d6ab075 (diff)
downloadlz4-e3c71584ff3242ce0a42e1cdeb183756b2c47da4.zip
lz4-e3c71584ff3242ce0a42e1cdeb183756b2c47da4.tar.gz
lz4-e3c71584ff3242ce0a42e1cdeb183756b2c47da4.tar.bz2
clarified documentation of streaming decompression functions
(synchronous bufferless mode) answering questions by @jtbandes (#394)
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/lz4.h b/lib/lz4.h
index 020a09d..3564a1d 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -280,32 +280,36 @@ LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dict
typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* incomplete type (defined later) */
/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
- * creation / destruction of streaming decompression tracking structure */
+ * creation / destruction of streaming decompression tracking structure.
+ * A tracking structure can be re-used multiple times sequentially. */
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
/*! LZ4_setStreamDecode() :
- * Use this function to instruct where to find the dictionary.
- * Setting a size of 0 is allowed (same effect as reset).
- * @return : 1 if OK, 0 if error
+ * Use this function to start decompression of a new stream of blocks.
+ * A dictionary can optionnally be set. Use NULL or size 0 for a simple reset order.
+ * @return : 1 if OK, 0 if error
*/
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
/*! LZ4_decompress_*_continue() :
- * These decoding functions allow decompression of multiple blocks in "streaming" mode.
- * Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB)
- * In the case of a ring buffers, decoding buffer must be either :
+ * These decoding functions allow decompression of consecutive blocks in "streaming" mode.
+ * A block is an unsplittable entity, it must be presented entirely to a decompression function.
+ * Decompression functions only accept one block at a time.
+ * Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB).
+ *
+ * Special : if application sets a ring buffer for decompression, it must respect one of the following conditions :
* - Exactly same size as encoding buffer, with same update rule (block boundaries at same positions)
* In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).
* - Larger than encoding buffer, by a minimum of maxBlockSize more bytes.
- * maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block.
+ * maxBlockSize is implementation dependent. It's the maximum size of any single block.
* In which case, encoding and decoding buffers do not need to be synchronized,
* and encoding ring buffer can have any size, including small ones ( < 64 KB).
* - _At least_ 64 KB + 8 bytes + maxBlockSize.
* In which case, encoding and decoding buffers do not need to be synchronized,
* and encoding ring buffer can have any size, including larger than decoding buffer.
* Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer,
- * and indicate where it is saved using LZ4_setStreamDecode()
+ * and indicate where it is saved using LZ4_setStreamDecode() before decompressin next block.
*/
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize);
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize);