]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed fuzzer test
authorYann Collet <yann.collet.73@gmail.com>
Tue, 6 Dec 2016 05:11:46 +0000 (06:11 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Tue, 6 Dec 2016 05:11:46 +0000 (06:11 +0100)
tests/fuzzer.c

index 1c1ae470ae07432f915020d2b222a4baa82bd2fa..86d4c6bebb359f04b8e45a4978fc7d248d3c8952 100644 (file)
@@ -246,6 +246,7 @@ static int basicUnitTests(U32 seed, double compressibility)
         size_t const sampleUnitSize = 8 KB;
         U32 const nbSamples = (U32)(totalSampleSize / sampleUnitSize);
         size_t* const samplesSizes = (size_t*) malloc(nbSamples * sizeof(size_t));
+        U32 dictID;
 
         if (dictBuffer==NULL || samplesSizes==NULL) {
             free(dictBuffer);
@@ -261,10 +262,9 @@ static int basicUnitTests(U32 seed, double compressibility)
         DISPLAYLEVEL(4, "OK, created dictionary of size %u \n", (U32)dictSize);
 
         DISPLAYLEVEL(4, "test%3i : check dictID : ", testNb++);
-        {   U32 const dictID = ZDICT_getDictID(dictBuffer, dictSize);
-            if (dictID==0) goto _output_error;
-            DISPLAYLEVEL(4, "OK : %u \n", dictID);
-        }
+        dictID = ZDICT_getDictID(dictBuffer, dictSize);
+        if (dictID==0) goto _output_error;
+        DISPLAYLEVEL(4, "OK : %u \n", dictID);
 
         DISPLAYLEVEL(4, "test%3i : compress with dictionary : ", testNb++);
         cSize = ZSTD_compress_usingDict(cctx, compressedBuffer, ZSTD_compressBound(CNBuffSize),
@@ -274,14 +274,14 @@ static int basicUnitTests(U32 seed, double compressibility)
         DISPLAYLEVEL(4, "OK (%u bytes : %.2f%%)\n", (U32)cSize, (double)cSize/CNBuffSize*100);
 
         DISPLAYLEVEL(4, "test%3i : retrieve dictID from dictionary : ", testNb++);
-        {   U32 const dictID = ZSTD_getDictID_fromDict(dictBuffer, dictSize);
-            if (dictID != 0) goto _output_error;   /* non-conformant (content-only) dictionary */
+        {   U32 const did = ZSTD_getDictID_fromDict(dictBuffer, dictSize);
+            if (did != dictID) goto _output_error;   /* non-conformant (content-only) dictionary */
         }
         DISPLAYLEVEL(4, "OK \n");
 
         DISPLAYLEVEL(4, "test%3i : retrieve dictID from frame : ", testNb++);
-        {   U32 const dictID = ZSTD_getDictID_fromFrame(compressedBuffer, cSize);
-            if (dictID != 0) goto _output_error;   /* non-conformant (content-only) dictionary */
+        {   U32 const did = ZSTD_getDictID_fromFrame(compressedBuffer, cSize);
+            if (did != dictID) goto _output_error;   /* non-conformant (content-only) dictionary */
         }
         DISPLAYLEVEL(4, "OK \n");