From: Yann Collet Date: Thu, 27 Jan 2022 02:04:52 +0000 (-0800) Subject: more usage of new error code stabilityCondition_notRespected X-Git-Tag: v1.5.4^2~259^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2d9652ad82c5ead0665bea428215eaf027de933;p=thirdparty%2Fzstd.git more usage of new error code stabilityCondition_notRespected as suggested by @terrelln --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 6a34beea9..4a073cf10 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -5558,13 +5558,13 @@ static size_t ZSTD_checkBufferStability(ZSTD_CCtx const* cctx, if (cctx->appliedParams.inBufferMode == ZSTD_bm_stable) { ZSTD_inBuffer const expect = cctx->expectedInBuffer; if (expect.src != input->src || expect.pos != input->pos) - RETURN_ERROR(srcBuffer_wrong, "ZSTD_c_stableInBuffer enabled but input differs!"); + RETURN_ERROR(stabilityCondition_notRespected, "ZSTD_c_stableInBuffer enabled but input differs!"); } (void)endOp; if (cctx->appliedParams.outBufferMode == ZSTD_bm_stable) { size_t const outBufferSize = output->size - output->pos; if (cctx->expectedOutBufferSize != outBufferSize) - RETURN_ERROR(dstBuffer_wrong, "ZSTD_c_stableOutBuffer enabled but output size differs!"); + RETURN_ERROR(stabilityCondition_notRespected, "ZSTD_c_stableOutBuffer enabled but output size differs!"); } return 0; } diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index dbe2b907a..20a05a75c 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -868,7 +868,7 @@ static int basicUnitTests(U32 seed, double compressibility) in.pos = 0; { size_t const ret = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end); CHECK(!ZSTD_isError(ret), "Must error"); - CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_srcBuffer_wrong), "Must be this error"); + CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_stabilityCondition_notRespected), "Must be this error"); } DISPLAYLEVEL(3, "OK \n"); @@ -963,7 +963,7 @@ static int basicUnitTests(U32 seed, double compressibility) in.pos = out.pos = 0; { size_t const ret = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue); CHECK(!ZSTD_isError(ret), "Must have errored"); - CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_dstBuffer_wrong), "Must be this error"); + CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_stabilityCondition_notRespected), "Must be this error"); } DISPLAYLEVEL(3, "OK \n");