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

This commit is contained in:
W. Felix Handte
2020-09-10 18:51:52 -04:00
parent a494111385
commit db2aa25252
+4 -4
View File
@@ -1640,10 +1640,8 @@ static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict,
U64 pledgedSrcSize) U64 pledgedSrcSize)
{ {
size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy]; size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy];
int const useDedicatedDictSearch = int const dedicatedDictSearch = cdict->matchState.dedicatedDictSearch;
params->enableDedicatedDictSearch && return ( dedicatedDictSearch
ZSTD_dedicatedDictSearch_isSupported(params->compressionLevel, cdict->dictContentSize);
return ( useDedicatedDictSearch
|| pledgedSrcSize <= cutoff || pledgedSrcSize <= cutoff
|| pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
|| params->attachDictPref == ZSTD_dictForceAttach ) || 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; const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams;
assert(!cdict->matchState.dedicatedDictSearch);
DEBUGLOG(4, "copying dictionary into context"); DEBUGLOG(4, "copying dictionary into context");
{ unsigned const windowLog = params.cParams.windowLog; { unsigned const windowLog = params.cParams.windowLog;