attempt at silencing cppcheck

This commit is contained in:
Yann Collet 2020-11-08 19:48:47 -08:00
parent 2a2b10f192
commit c76564b944

View File

@ -341,7 +341,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
exit(1); \
}
# define FUZ_CHECKTEST(cond, ...) { if (cond) { EXIT_MSG(__VA_ARGS__) } }
# define FUZ_CHECKTEST(cond, ...) if (cond) { EXIT_MSG(__VA_ARGS__) }
# define FUZ_DISPLAYTEST(...) { \
testNb++; \
@ -1135,7 +1135,7 @@ static void FUZ_unitTests(int compressionLevel)
shct* const shc = (shct*)malloc(sizeof(*shc));
assert(shc != NULL);
memset(shc, 0, sizeof(*shc));
DISPLAYLEVEL(3, "state1(%p) state2(%p) state3(%p) LZ4_stream_t size(0x%x): ",
DISPLAYLEVEL(4, "state1(%p) state2(%p) state3(%p) LZ4_stream_t size(0x%x): ",
&(shc->state1), &(shc->state2), &(shc->state3), (unsigned)sizeof(LZ4_stream_t));
FUZ_CHECKTEST( LZ4_initStream(&(shc->state1), sizeof(shc->state1)) == NULL, "state1 (%p) failed init", &(shc->state1) );
FUZ_CHECKTEST( LZ4_initStream(&(shc->state2), sizeof(shc->state2)) == NULL, "state2 (%p) failed init", &(shc->state2) );
@ -1156,16 +1156,16 @@ static void FUZ_unitTests(int compressionLevel)
{ LZ4_stream_t streamingState;
/* simple compression test */
{ U64 const crcOrig = XXH64(testInput, testCompressedSize, 0);
LZ4_initStream(&streamingState, sizeof(streamingState));
{ int const cs = LZ4_compress_fast_continue(&streamingState, testInput, testCompressed, testCompressedSize, testCompressedSize-1, 1);
FUZ_CHECKTEST(cs==0, "LZ4_compress_fast_continue() compression failed!");
{ int const r = LZ4_decompress_safe(testCompressed, testVerify, cs, testCompressedSize);
FUZ_CHECKTEST(r!=(int)testCompressedSize, "LZ4_decompress_safe() decompression failed");
} }
{ U64 const crcNew = XXH64(testVerify, testCompressedSize, 0);
{ U64 const crcOrig = XXH64(testInput, testCompressedSize, 0);
U64 const crcNew = XXH64(testVerify, testCompressedSize, 0);
FUZ_CHECKTEST(crcOrig!=crcNew, "LZ4_decompress_safe() decompression corruption");
} }
}
/* early saveDict */
DISPLAYLEVEL(3, "saveDict (right after init) : ");
@ -1245,7 +1245,7 @@ static void FUZ_unitTests(int compressionLevel)
shct* const shc = (shct*)malloc(sizeof(*shc));
assert(shc != NULL);
memset(shc, 0, sizeof(*shc));
DISPLAYLEVEL(3, "hc1(%p) hc2(%p) hc3(%p) size(0x%x): ",
DISPLAYLEVEL(4, "hc1(%p) hc2(%p) hc3(%p) size(0x%x): ",
&(shc->hc1), &(shc->hc2), &(shc->hc3), (unsigned)sizeof(LZ4_streamHC_t));
FUZ_CHECKTEST( LZ4_initStreamHC(&(shc->hc1), sizeof(shc->hc1)) == NULL, "hc1 (%p) failed init", &(shc->hc1) );
FUZ_CHECKTEST( LZ4_initStreamHC(&(shc->hc2), sizeof(shc->hc2)) == NULL, "hc2 (%p) failed init", &(shc->hc2) );