diff options
author | Yann Collet <cyan@fb.com> | 2019-04-18 19:05:50 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2019-04-18 19:05:50 (GMT) |
commit | 4f6de46f60fc7b158e7fc5ce24eb06c39d8b6ce2 (patch) | |
tree | 2297bceac7efea6c8c1a9b29457a25f32dc5c608 /tests/frametest.c | |
parent | 3f558163ad74ee9553839aedb211c08a835f23a3 (diff) | |
download | lz4-4f6de46f60fc7b158e7fc5ce24eb06c39d8b6ce2.zip lz4-4f6de46f60fc7b158e7fc5ce24eb06c39d8b6ce2.tar.gz lz4-4f6de46f60fc7b158e7fc5ce24eb06c39d8b6ce2.tar.bz2 |
fix several minor static analyzer warnings
Diffstat (limited to 'tests/frametest.c')
-rw-r--r-- | tests/frametest.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/frametest.c b/tests/frametest.c index a5197ff..9f7cb8d 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -167,7 +167,7 @@ static unsigned FUZ_highbit(U32 v32) /*-******************************************************* * Tests *********************************************************/ -#define CHECK_V(v,f) v = f; if (LZ4F_isError(v)) { fprintf(stderr, "%s\n", LZ4F_getErrorName(v)); goto _output_error; } +#define CHECK_V(v,f) v = f; if (LZ4F_isError(v)) { fprintf(stderr, "%s \n", LZ4F_getErrorName(v)); goto _output_error; } #define CHECK(f) { LZ4F_errorCode_t const CHECK_V(err_ , f); } int basicTests(U32 seed, double compressibility) @@ -795,8 +795,9 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi clock_t const startClock = clock(); clock_t const clockDuration = duration_s * CLOCKS_PER_SEC; # undef CHECK -# define CHECK(cond, ...) if (cond) { DISPLAY("Error => "); DISPLAY(__VA_ARGS__); \ - DISPLAY(" (seed %u, test nb %u) \n", seed, testNb); goto _output_error; } +# define EXIT_MSG(...) { DISPLAY("Error => "); DISPLAY(__VA_ARGS__); \ + DISPLAY(" (seed %u, test nb %u) \n", seed, testNb); goto _output_error; } +# define CHECK(cond, ...) { if (cond) { EXIT_MSG(__VA_ARGS__); } } /* Create buffers */ { size_t const creationStatus = LZ4F_createDecompressionContext(&dCtx, LZ4F_VERSION); @@ -950,9 +951,10 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi CHECK(decSize != 0, "Frame decompression failed (error %i)", (int)decSize); if (totalOut) { /* otherwise, it's a skippable frame */ U64 const crcDecoded = XXH64_digest(&xxh64); - if (crcDecoded != crcOrig) locateBuffDiff(srcStart, decodedBuffer, srcSize, nonContiguousDst); - CHECK(crcDecoded != crcOrig, "Decompression corruption"); - } + if (crcDecoded != crcOrig) { + locateBuffDiff(srcStart, decodedBuffer, srcSize, nonContiguousDst); + EXIT_MSG("Decompression corruption"); + } } } } |