From 00be3437a8ac37ba868b534e6f0a42e450e042dd Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 20 Feb 2015 18:53:31 +0100 Subject: [PATCH] Some comments, to explain streaming decompression API --- lib/zstd_static.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/zstd_static.h b/lib/zstd_static.h index 9222a8c86..b63fbba06 100644 --- a/lib/zstd_static.h +++ b/lib/zstd_static.h @@ -59,7 +59,14 @@ size_t ZSTD_freeDCtx(ZSTD_dctx_t dctx); size_t ZSTD_nextSrcSizeToDecompress(ZSTD_dctx_t dctx); size_t ZSTD_decompressContinue(ZSTD_dctx_t dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); - +/* + Use above functions alternatively. + ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as input to ZSTD_decompressContinue(). + This value is expected to be provided, precisely, as 'srcSize'. + Otherwise, compression will fail (result is an error code, which can be tested using ZSTD_isError() ) + ZSTD_decompressContinue() result is the number of bytes regenerated within 'dst'. + It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header. +*/ /************************************** * Error management