From: Yann Collet Date: Fri, 20 Feb 2015 17:52:24 +0000 (+0100) Subject: Some comments to explain streaming decompression API X-Git-Tag: v0.1.0~4^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=852cd3d8dcdea032cb857ac4b288d058768ea42f;p=thirdparty%2Fzstd.git Some comments to explain streaming decompression API --- diff --git a/lib/zstd_static.h b/lib/zstd_static.h index 59d3b02ad..b63fbba06 100644 --- a/lib/zstd_static.h +++ b/lib/zstd_static.h @@ -57,9 +57,16 @@ typedef void* ZSTD_dctx_t; ZSTD_dctx_t ZSTD_createDCtx(void); size_t ZSTD_freeDCtx(ZSTD_dctx_t dctx); -size_t ZSTD_getNextcBlockSize(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 @@ -77,4 +84,4 @@ typedef enum { ZSTD_LIST_ERRORS(ZSTD_GENERATE_ENUM) } ZSTD_errorCodes; /* expo #if defined (__cplusplus) } -#endif \ No newline at end of file +#endif