Fix #1412: Perform Signed Comparison When Setting Attach Dict Param

dev
W. Felix Handte 2018-11-12 12:07:57 -08:00
parent 7b0c551bff
commit 596f7d1256
1 changed files with 6 additions and 3 deletions

View File

@ -412,11 +412,14 @@ 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) :
case ZSTD_p_forceAttachDict : {
int signed_val = (int)value;
CCtxParams->attachDictPref = signed_val ?
(signed_val > 0 ? ZSTD_dictForceAttach :
ZSTD_dictForceCopy) :
ZSTD_dictDefaultAttach;
return CCtxParams->attachDictPref;
}
case ZSTD_p_nbWorkers :
#ifndef ZSTD_MULTITHREAD