diff options
author | Yann Collet <cyan@fb.com> | 2019-06-30 22:36:32 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2019-06-30 22:36:32 (GMT) |
commit | 2cacdd21423010406dbafaad710dfa9c567f77c1 (patch) | |
tree | 10c5b739e9dec108ae0b2b68af6c6035d90c64cf | |
parent | 89e96e55ffab100f9893f2b6c12b4b1e26def17e (diff) | |
download | lz4-2cacdd21423010406dbafaad710dfa9c567f77c1.zip lz4-2cacdd21423010406dbafaad710dfa9c567f77c1.tar.gz lz4-2cacdd21423010406dbafaad710dfa9c567f77c1.tar.bz2 |
fix minor cppcheck warnings
-rw-r--r-- | tests/frametest.c | 2 | ||||
-rw-r--r-- | tests/fuzzer.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/frametest.c b/tests/frametest.c index 6d690f2..69dd5aa 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -1236,7 +1236,7 @@ int main(int argc, const char** argv) DISPLAY("Seed = %u\n", seed); if (proba!=FUZ_COMPRESSIBILITY_DEFAULT) DISPLAY("Compressibility : %i%%\n", proba); - if (nbTests<=0) nbTests=1; + nbTests += (nbTests==0); /* avoid zero */ if (testNb==0) result = basicTests(seed, ((double)proba) / 100); if (result) return 1; diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 74bc5a0..8a095c4 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -861,7 +861,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c FUZ_DISPLAYTEST("LZ4_decompress_safe_usingDict with a too small output buffer"); { U32 const missingBytes = (FUZ_rand(&randState) & 0xF) + 2; if ((U32)blockSize > missingBytes) { - decodedBuffer[blockSize-missingBytes] = 0; + decodedBuffer[(U32)blockSize-missingBytes] = 0; ret = LZ4_decompress_safe_usingDict(compressedBuffer, decodedBuffer, blockContinueCompressedSize, blockSize-missingBytes, dict, dictSize); FUZ_CHECKTEST(ret>=0, "LZ4_decompress_safe_usingDict should have failed : output buffer too small (-%u byte)", missingBytes); FUZ_CHECKTEST(decodedBuffer[blockSize-missingBytes], "LZ4_decompress_safe_usingDict overrun specified output buffer size (-%u byte) (blockSize=%i)", missingBytes, blockSize); @@ -1646,7 +1646,7 @@ int main(int argc, const char** argv) if ((seedset==0) && (testNb==0)) { FUZ_unitTests(LZ4HC_CLEVEL_DEFAULT); FUZ_unitTests(LZ4HC_CLEVEL_OPT_MIN); } - if (nbTests<=0) nbTests=1; + nbTests += (nbTests==0); /* avoid zero */ { int const result = FUZ_test(seed, nbTests, testNb, ((double)proba) / 100, duration); if (use_pause) { |