Merge pull request #1413 from felixhandte/attach-dict-fix-unsigned-compare

Fix #1412: Perform Signed Comparison When Setting Attach Dict Param
This commit is contained in:
Yann Collet
2018-11-12 17:53:11 -08:00
committed by GitHub
4 changed files with 44 additions and 32 deletions
+5 -4
View File
@@ -412,11 +412,12 @@ size_t ZSTD_CCtxParam_setParameter(
CCtxParams->forceWindow = (value > 0);
return CCtxParams->forceWindow;
case ZSTD_p_forceAttachDict :
CCtxParams->attachDictPref = value ?
(value > 0 ? ZSTD_dictForceAttach : ZSTD_dictForceCopy) :
ZSTD_dictDefaultAttach;
case ZSTD_p_forceAttachDict : {
const ZSTD_dictAttachPref_e pref = (ZSTD_dictAttachPref_e)value;
CLAMPCHECK(pref, ZSTD_dictDefaultAttach, ZSTD_dictForceCopy);
CCtxParams->attachDictPref = pref;
return CCtxParams->attachDictPref;
}
case ZSTD_p_nbWorkers :
#ifndef ZSTD_MULTITHREAD
-6
View File
@@ -48,12 +48,6 @@ extern "C" {
typedef enum { ZSTDcs_created=0, ZSTDcs_init, ZSTDcs_ongoing, ZSTDcs_ending } ZSTD_compressionStage_e;
typedef enum { zcss_init=0, zcss_load, zcss_flush } ZSTD_cStreamStage;
typedef enum {
ZSTD_dictDefaultAttach = 0,
ZSTD_dictForceAttach = 1,
ZSTD_dictForceCopy = -1,
} ZSTD_dictAttachPref_e;
typedef struct ZSTD_prefixDict_s {
const void* dict;
size_t dictSize;