Rename applyCCtxParams()
This commit is contained in:
@@ -465,7 +465,8 @@ size_t ZSTD_CCtxParam_setParameter(
|
|||||||
*
|
*
|
||||||
* Pledged srcSize is treated as unknown.
|
* Pledged srcSize is treated as unknown.
|
||||||
*/
|
*/
|
||||||
size_t ZSTD_CCtx_applyCCtxParams(ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params)
|
size_t ZSTD_CCtx_setParametersUsingCCtxParams(
|
||||||
|
ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params)
|
||||||
{
|
{
|
||||||
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
||||||
if (cctx->cdict) return ERROR(stage_wrong);
|
if (cctx->cdict) return ERROR(stage_wrong);
|
||||||
|
|||||||
+5
-4
@@ -1109,7 +1109,7 @@ size_t ZSTD_compress_generic_simpleArgs (
|
|||||||
* - ZSTD_CCtxParam_setParameter() : Push parameters one by one into an
|
* - ZSTD_CCtxParam_setParameter() : Push parameters one by one into an
|
||||||
* existing ZSTD_CCtx_params structure. This is similar to
|
* existing ZSTD_CCtx_params structure. This is similar to
|
||||||
* ZSTD_CCtx_setParameter().
|
* ZSTD_CCtx_setParameter().
|
||||||
* - ZSTD_CCtx_applyCCtxParams() : Apply parameters to an existing CCtx. These
|
* - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to an existing CCtx. These
|
||||||
* parameters will be applied to all subsequent compression jobs.
|
* parameters will be applied to all subsequent compression jobs.
|
||||||
* - ZSTD_compress_generic() : Do compression using the CCtx.
|
* - ZSTD_compress_generic() : Do compression using the CCtx.
|
||||||
* - ZSTD_freeCCtxParams() : Free the memory.
|
* - ZSTD_freeCCtxParams() : Free the memory.
|
||||||
@@ -1141,19 +1141,20 @@ ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
|
|||||||
/*! ZSTD_CCtxParam_setParameter() :
|
/*! ZSTD_CCtxParam_setParameter() :
|
||||||
* Similar to ZSTD_CCtx_setParameter.
|
* Similar to ZSTD_CCtx_setParameter.
|
||||||
* Set one compression parameter, selected by enum ZSTD_cParameter.
|
* Set one compression parameter, selected by enum ZSTD_cParameter.
|
||||||
* Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_applyCCtxParams().
|
* Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_setParametersUsingCCtxParams().
|
||||||
* Note : when `value` is an enum, cast it to unsigned for proper type checking.
|
* Note : when `value` is an enum, cast it to unsigned for proper type checking.
|
||||||
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||||||
*/
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, unsigned value);
|
ZSTDLIB_API size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, unsigned value);
|
||||||
|
|
||||||
/*! ZSTD_CCtx_applyCCtxParams() :
|
/*! ZSTD_CCtx_setParametersUsingCCtxParams() :
|
||||||
* Apply a set of ZSTD_CCtx_params to the compression context.
|
* Apply a set of ZSTD_CCtx_params to the compression context.
|
||||||
* This must be done before the dictionary is loaded.
|
* This must be done before the dictionary is loaded.
|
||||||
* The pledgedSrcSize is treated as unknown.
|
* The pledgedSrcSize is treated as unknown.
|
||||||
* Multithreading parameters are applied only if nbThreads > 1.
|
* Multithreading parameters are applied only if nbThreads > 1.
|
||||||
*/
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_CCtx_applyCCtxParams(ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
|
ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
|
||||||
|
ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Block functions
|
Block functions
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ static size_t cctxParamRoundTripTest(void* resultBuff, size_t resultBuffCapacity
|
|||||||
|
|
||||||
|
|
||||||
/* Apply parameters */
|
/* Apply parameters */
|
||||||
CHECK_Z( ZSTD_CCtx_applyCCtxParams(cctx, cctxParams) );
|
CHECK_Z( ZSTD_CCtx_setParametersUsingCCtxParams(cctx, cctxParams) );
|
||||||
|
|
||||||
CHECK_Z (ZSTD_compress_generic(cctx, &outBuffer, &inBuffer, ZSTD_e_end) );
|
CHECK_Z (ZSTD_compress_generic(cctx, &outBuffer, &inBuffer, ZSTD_e_end) );
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1381,7 +1381,7 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest, double
|
|||||||
|
|
||||||
/* Apply parameters */
|
/* Apply parameters */
|
||||||
if (useOpaqueAPI) {
|
if (useOpaqueAPI) {
|
||||||
CHECK_Z (ZSTD_CCtx_applyCCtxParams(zc, cctxParams) );
|
CHECK_Z (ZSTD_CCtx_setParametersUsingCCtxParams(zc, cctxParams) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FUZ_rand(&lseed) & 1) {
|
if (FUZ_rand(&lseed) & 1) {
|
||||||
@@ -1393,8 +1393,8 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest, double
|
|||||||
if (dict && dictSize) {
|
if (dict && dictSize) {
|
||||||
/* test that compression parameters are rejected (correctly) after loading a non-NULL dictionary */
|
/* test that compression parameters are rejected (correctly) after loading a non-NULL dictionary */
|
||||||
if (useOpaqueAPI) {
|
if (useOpaqueAPI) {
|
||||||
size_t const setError = ZSTD_CCtx_applyCCtxParams(zc, cctxParams);
|
size_t const setError = ZSTD_CCtx_setParametersUsingCCtxParams(zc, cctxParams);
|
||||||
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_applyCCtxParams should have failed");
|
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParametersUsingCCtxParams should have failed");
|
||||||
} else {
|
} else {
|
||||||
size_t const setError = ZSTD_CCtx_setParameter(zc, ZSTD_p_windowLog, cParams.windowLog-1);
|
size_t const setError = ZSTD_CCtx_setParameter(zc, ZSTD_p_windowLog, cParams.windowLog-1);
|
||||||
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParameter should have failed");
|
CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParameter should have failed");
|
||||||
|
|||||||
Reference in New Issue
Block a user