From d23eb9a098ce99ae0fe039496385687c0e574c60 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 13 Dec 2017 15:35:49 -0800 Subject: [PATCH] zstreamtest : added missing CHECK_Z() --- lib/compress/zstd_compress.c | 2 +- tests/zstreamtest.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 7586c3a0c..34bfb737c 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -2566,7 +2566,7 @@ size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs, if (zcs->cdictLocal == NULL) return ERROR(memory_allocation); } else { if (cdict) { - params.cParams = ZSTD_getCParamsFromCDict(cdict); /* cParams are enforced from cdict; this includes windowLog (should it be enforced from `params` instead ?) */ + params.cParams = ZSTD_getCParamsFromCDict(cdict); /* cParams are enforced from cdict; it includes windowLog */ } ZSTD_freeCDict(zcs->cdictLocal); zcs->cdictLocal = NULL; diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index 67ef6ce80..70922e2e0 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -710,9 +710,9 @@ static int basicUnitTests(U32 seed, double compressibility) const BYTE* const srcToCopy = (const BYTE*)CNBuffer + start; BYTE* const dst = (BYTE*)CNBuffer + start - offset; DISPLAYLEVEL(3, "test%3i : compress %u bytes with multiple threads + dictionary : ", testNb++, (U32)srcSize); - ZSTD_CCtx_setParameter(zc, ZSTD_p_compressionLevel, 3); - ZSTD_CCtx_setParameter(zc, ZSTD_p_nbThreads, 2); - ZSTD_CCtx_setParameter(zc, ZSTD_p_jobSize, jobSize); + CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_compressionLevel, 3) ); + CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_nbThreads, 2) ); + CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_jobSize, jobSize) ); assert(start > offset); assert(start + segLength < COMPRESSIBLE_NOISE_LENGTH); memcpy(dst, srcToCopy, segLength); /* create a long repetition at long distance for job 2 */ @@ -726,9 +726,9 @@ static int basicUnitTests(U32 seed, double compressibility) { ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, 4 KB, dictionary.filled); /* intentionnally lies on estimatedSrcSize, to push cdict into targeting a small window size */ ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictionary.start, dictionary.filled, ZSTD_dlm_byRef, ZSTD_dm_fullDict, cParams, ZSTD_defaultCMem); DISPLAYLEVEL(5, "cParams.windowLog = %u : ", cParams.windowLog); - ZSTD_CCtx_refCDict(zc, cdict); + CHECK_Z( ZSTD_CCtx_refCDict(zc, cdict) ); CHECK_Z( ZSTD_compress_generic(zc, &outBuff, &inBuff, ZSTD_e_end) ); - ZSTD_CCtx_refCDict(zc, NULL); /* do not keep a reference to cdict, as its lifetime ends */ + CHECK_Z( ZSTD_CCtx_refCDict(zc, NULL) ); /* do not keep a reference to cdict, as its lifetime ends */ ZSTD_freeCDict(cdict); } if (inBuff.pos != inBuff.size) goto _output_error; /* entire input should be consumed */ -- 2.47.2