merge dedicated dParam setters
This commit is contained in:
@@ -1241,19 +1241,24 @@ size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ZSTD_DCtx_setMaxWindowSize() :
|
||||||
|
* note : no direct equivalence in ZSTD_DCtx_setParameter,
|
||||||
|
* since this version sets windowSize, and the other sets windowLog */
|
||||||
size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize)
|
size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize)
|
||||||
{
|
{
|
||||||
|
ZSTD_bounds const bounds = ZSTD_dParam_getBounds(ZSTD_d_windowLogMax);
|
||||||
|
size_t const min = (size_t)1 << bounds.lowerBound;
|
||||||
|
size_t const max = (size_t)1 << bounds.upperBound;
|
||||||
if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
|
if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
|
||||||
|
if (maxWindowSize < min) return ERROR(parameter_outOfBound);
|
||||||
|
if (maxWindowSize > max) return ERROR(parameter_outOfBound);
|
||||||
dctx->maxWindowSize = maxWindowSize;
|
dctx->maxWindowSize = maxWindowSize;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format)
|
size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format)
|
||||||
{
|
{
|
||||||
DEBUGLOG(4, "ZSTD_DCtx_setFormat : %u", (unsigned)format);
|
return ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, format);
|
||||||
if (dctx->streamStage != zdss_init) return ERROR(stage_wrong);
|
|
||||||
dctx->format = format;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam)
|
||||||
|
|||||||
+1
-1
@@ -1393,7 +1393,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
|
|
||||||
DISPLAYLEVEL(3, "test%3i : decompress of magic-less frame : ", testNb++);
|
DISPLAYLEVEL(3, "test%3i : decompress of magic-less frame : ", testNb++);
|
||||||
ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters);
|
ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters);
|
||||||
CHECK( ZSTD_DCtx_setFormat(dctx, ZSTD_f_zstd1_magicless) );
|
CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) );
|
||||||
{ ZSTD_frameHeader zfh;
|
{ ZSTD_frameHeader zfh;
|
||||||
size_t const zfhrt = ZSTD_getFrameHeader_advanced(&zfh, compressedBuffer, cSize, ZSTD_f_zstd1_magicless);
|
size_t const zfhrt = ZSTD_getFrameHeader_advanced(&zfh, compressedBuffer, cSize, ZSTD_f_zstd1_magicless);
|
||||||
if (zfhrt != 0) goto _output_error;
|
if (zfhrt != 0) goto _output_error;
|
||||||
|
|||||||
Reference in New Issue
Block a user