Decision for Whether to Attach Should be Based on CDict Config, not CCtx

This commit is contained in:
W. Felix Handte 2020-08-13 16:52:07 -04:00
parent a494111385
commit db2aa25252

View File

@ -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;