From: Yann Collet Date: Fri, 26 Oct 2018 22:21:52 +0000 (-0700) Subject: added a few comments for clarifications X-Git-Tag: v1.3.8~58^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d56f4baee9ebf13d630c998b3ba765f771c242e;p=thirdparty%2Fzstd.git added a few comments for clarifications --- diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index 43f7c1486..ec38e5d4b 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -139,7 +139,7 @@ struct ZSTD_matchState_t { U32* hashTable3; U32* chainTable; optState_t opt; /* optimal parser state */ - const ZSTD_matchState_t *dictMatchState; + const ZSTD_matchState_t * dictMatchState; ZSTD_compressionParameters cParams; }; diff --git a/lib/decompress/zstd_decompress_block.c b/lib/decompress/zstd_decompress_block.c index abfb82119..652ddd194 100644 --- a/lib/decompress/zstd_decompress_block.c +++ b/lib/decompress/zstd_decompress_block.c @@ -323,7 +323,9 @@ static void ZSTD_buildSeqTable_rle(ZSTD_seqSymbol* dt, U32 baseValue, U32 nbAddB /* ZSTD_buildFSETable() : - * generate FSE decoding table for one symbol (ll, ml or off) */ + * generate FSE decoding table for one symbol (ll, ml or off) + * cannot fail if input is valid => + * all inputs are presumed validated at this stage */ void ZSTD_buildFSETable(ZSTD_seqSymbol* dt, const short* normalizedCounter, unsigned maxSymbolValue, diff --git a/lib/decompress/zstd_decompress_block.h b/lib/decompress/zstd_decompress_block.h index 4b1cf2371..7e9296041 100644 --- a/lib/decompress/zstd_decompress_block.h +++ b/lib/decompress/zstd_decompress_block.h @@ -18,6 +18,7 @@ #include /* size_t */ #include "zstd.h" /* DCtx, and some public functions */ #include "zstd_internal.h" /* blockProperties_t, and some public functions */ +#include "zstd_decompress_internal.h" /* ZSTD_seqSymbol */ /* === Prototypes === */ @@ -44,7 +45,10 @@ size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, /* ZSTD_buildFSETable() : * generate FSE decoding table for one symbol (ll, ml or off) - * this function cannot fail + * this function must be called with valid parameters only + * (dt is large enough, normalizedCounter distribution total is a power of 2, max is within range, etc.) + * in which case it cannot fail. + * Internal use only. */ void ZSTD_buildFSETable(ZSTD_seqSymbol* dt, const short* normalizedCounter, unsigned maxSymbolValue,