]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Merge pull request #1200 from felixhandte/zstd-attach-dict-pref
authorYann Collet <Cyan4973@users.noreply.github.com>
Mon, 25 Jun 2018 19:42:31 +0000 (12:42 -0700)
committerGitHub <noreply@github.com>
Mon, 25 Jun 2018 19:42:31 +0000 (12:42 -0700)
Add CCtx Param Controlling Dict Attachment Behavior

1  2 
lib/compress/zstd_compress.c

index 0e05e488fad642183f2155a36a572e02fdea33d2,d7bcffdf27e4aff484139fb10928f794ec596c99..96ffe244ad2a20320c76cb196e339dd367701e3f
@@@ -1239,13 -1251,16 +1252,15 @@@ static size_t ZSTD_resetCCtx_usingCDict
          32 KB, /* ZSTD_lazy */
          32 KB, /* ZSTD_lazy2 */
          32 KB, /* ZSTD_btlazy2 */
 -        256 KB, /* ZSTD_btopt */
 -        256 KB /* ZSTD_btultra */
 +        32 KB, /* ZSTD_btopt */
 +        8 KB /* ZSTD_btultra */
      };
      const int attachDict = ( pledgedSrcSize <= attachDictSizeCutoffs[cdict->cParams.strategy]
-                           || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN )
+                           || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
+                           || params.attachDictPref == ZSTD_dictForceAttach )
+                         && params.attachDictPref != ZSTD_dictForceCopy
                          && !params.forceWindow /* dictMatchState isn't correctly
                                                  * handled in _enforceMaxDist */
 -                        && cdict->cParams.strategy <= ZSTD_btlazy2
                          && ZSTD_equivalentCParams(cctx->appliedParams.cParams,
                                                    cdict->cParams);