From 3ab916c6a258434987b41ffbb58f792545415d8e Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 15 Apr 2019 10:14:36 -0700 Subject: frametest: removed uninitialized warning was a false positive, but better remove it anyway --- tests/frametest.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/frametest.c b/tests/frametest.c index b1c7c02..1bf74ba 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -783,7 +783,7 @@ static void locateBuffDiff(const void* buff1, const void* buff2, size_t size, un int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressibility, U32 duration_s) { - unsigned testResult = 0; + int testResult = 0; unsigned testNb = 0; size_t const srcDataLength = 9 MB; /* needs to be > 2x4MB to test large blocks */ void* srcBuffer = NULL; @@ -793,7 +793,6 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi U32 coreRand = seed; LZ4F_decompressionContext_t dCtx = NULL; LZ4F_compressionContext_t cCtx = NULL; - size_t result; clock_t const startClock = clock(); clock_t const clockDuration = duration_s * CLOCKS_PER_SEC; # undef CHECK @@ -857,23 +856,27 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi BYTE* op = (BYTE*)compressedBuffer; BYTE* const oend = op + (neverFlush ? LZ4F_compressFrameBound(srcSize, prefsPtr) : compressedBufferSize); /* when flushes are possible, can't guarantee a max compressed size */ unsigned const maxBits = FUZ_highbit((U32)srcSize); + size_t cSegmentSize; LZ4F_compressOptions_t cOptions; memset(&cOptions, 0, sizeof(cOptions)); - result = LZ4F_compressBegin(cCtx, op, (size_t)(oend-op), prefsPtr); - CHECK(LZ4F_isError(result), "Compression header failed (error %i)", (int)result); - op += result; + cSegmentSize = LZ4F_compressBegin(cCtx, op, (size_t)(oend-op), prefsPtr); + CHECK(LZ4F_isError(cSegmentSize), "Compression header failed (error %i)", + (int)cSegmentSize); + op += cSegmentSize; while (ip < iend) { unsigned const nbBitsSeg = FUZ_rand(&randState) % maxBits; size_t const sampleMax = (FUZ_rand(&randState) & ((1<