attempt at silencing cppcheck
authorYann Collet <yann.collet.73@gmail.com>
Mon, 9 Nov 2020 03:48:47 +0000 (19:48 -0800)
committerYann Collet <yann.collet.73@gmail.com>
Mon, 9 Nov 2020 03:48:47 +0000 (19:48 -0800)
tests/fuzzer.c

index 99361dd92989d0907445f038611a7c6372abe7ac..ba36621c06b30a2a46efc663178a8fca6a6b57e6 100644 (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);
-                FUZ_CHECKTEST(crcOrig!=crcNew, "LZ4_decompress_safe() decompression corruption");
+        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 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)  );