From: W. Felix Handte Date: Thu, 13 Aug 2020 20:52:07 +0000 (-0400) Subject: Decision for Whether to Attach Should be Based on CDict Config, not CCtx X-Git-Tag: v1.4.7~81^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db2aa252523325dfba15ab8870cc3be29585dd10;p=thirdparty%2Fzstd.git Decision for Whether to Attach Should be Based on CDict Config, not CCtx --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index c3d317d25..fc1b42134 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1640,10 +1640,8 @@ static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict, U64 pledgedSrcSize) { size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy]; - int const useDedicatedDictSearch = - params->enableDedicatedDictSearch && - ZSTD_dedicatedDictSearch_isSupported(params->compressionLevel, cdict->dictContentSize); - return ( useDedicatedDictSearch + int const dedicatedDictSearch = cdict->matchState.dedicatedDictSearch; + return ( dedicatedDictSearch || pledgedSrcSize <= cutoff || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN || params->attachDictPref == ZSTD_dictForceAttach ) @@ -1709,6 +1707,8 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, { const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams; + assert(!cdict->matchState.dedicatedDictSearch); + DEBUGLOG(4, "copying dictionary into context"); { unsigned const windowLog = params.cParams.windowLog;