ZSTD_CCtx_setParameter() only works during initialization stage

and generate a stage_wrong error otherwise.
This commit is contained in:
Yann Collet 2017-05-19 11:04:41 -07:00
parent 48855fa0d2
commit 334a288d0d

View File

@ -223,7 +223,14 @@ static void ZSTD_cLevelToCParams(ZSTD_CCtx* cctx)
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value)
{
# define CLAMPCHECK(val,min,max) { if ((val<min) | (val>max)) return ERROR(compressionParameter_unsupported); }
# define CLAMPCHECK(val,min,max) { \
if ((val<min) | (val>max)) { \
return ERROR(compressionParameter_unsupported); \
} }
if (cctx->streamStage != zcss_init) {
return ERROR(stage_wrong);
}
switch(param)
{