]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add enum to decision process
authorSen Huang <senhuang96@fb.com>
Sun, 20 Oct 2019 23:02:47 +0000 (19:02 -0400)
committerSen Huang <senhuang96@fb.com>
Mon, 21 Oct 2019 19:36:12 +0000 (15:36 -0400)
lib/compress/zstd_compress.c
lib/zstd.h

index ab5b13d019ac8c3c287bf6a74e31cd520b67ac70..84af6feeae7ef8f158a7cc417b8b5cd10eb43b22 100644 (file)
@@ -2909,7 +2909,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
     if ( (cdict)
       && (cdict->dictContentSize > 0)
       && (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF || cdict->compressionLevel == 0)
-      && (params->attachDictPref != ZSTD_dictForceInputParams) ) {
+      && (params->attachDictPref != ZSTD_dictForceSource) ) {
         return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);
     }
 
@@ -3357,7 +3357,8 @@ size_t ZSTD_compressBegin_usingCDict_advanced(
     DEBUGLOG(4, "ZSTD_compressBegin_usingCDict_advanced");
     RETURN_ERROR_IF(cdict==NULL, dictionary_wrong);
     {   ZSTD_CCtx_params params = cctx->requestedParams;
-        params.cParams = (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF) || (cdict->compressionLevel == 0) ?
+        params.cParams = ( (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF) || (cdict->compressionLevel == 0) )
+                      && (params->attachDictPref != ZSTD_dictForceSource) ?
                 ZSTD_getCParamsFromCDict(cdict)
               : ZSTD_getCParams(cdict->compressionLevel,
                                 pledgedSrcSize,
index 4859733bbe384b3bfef96b4392fa344fc98e4271..c0521c1b8fa0393dacc61ab3f70e8092c96a1fae 100644 (file)
@@ -1177,7 +1177,7 @@ typedef enum {
     ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
     ZSTD_dictForceAttach   = 1, /* Never copy the dictionary. */
     ZSTD_dictForceCopy     = 2, /* Always copy the dictionary. */
-    ZSTD_dictForceInputParams = 3, /* Always use input to determine tables */
+    ZSTD_dictForceSource = 3, /* Always use src input to determine tables */
 } ZSTD_dictAttachPref_e;
 
 typedef enum {