]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed minor conversion warning in datagen
authorYann Collet <cyan@fb.com>
Fri, 2 Aug 2019 16:02:54 +0000 (18:02 +0200)
committerYann Collet <cyan@fb.com>
Fri, 2 Aug 2019 16:02:54 +0000 (18:02 +0200)
programs/datagen.c
tests/fuzzer.c

index 88f48731b91d31d25f49219f3a589e07e075b7f5..ead9b2d2415a5dafcda805100cd707f0ab0a894c 100644 (file)
@@ -64,7 +64,7 @@ static void RDG_fillLiteralDistrib(BYTE* ldt, fixedPoint_24_8 ld)
     BYTE character = (ld<=0.0) ? 0 : '0';
     U32 u;
 
-    if (ld<=0.0) ld = 0.0;
+    if (ld<=0) ld = 0;
     for (u=0; u<LTSIZE; ) {
         U32 const weight = (((LTSIZE - u) * ld) >> 8) + 1;
         U32 const end = MIN ( u + weight , LTSIZE);
index e23bdec9029a38a836baf5c94c8349dab717cf9e..fd39875677bc408cf80859b02ae50a98b5bc91d5 100644 (file)
@@ -123,7 +123,7 @@ static U32 FUZ_highbit32(U32 v32)
         exit(1);                                   \
 }   }
 
-#define CHECK_VAR(var, fn)  var = fn; if (ZSTD_isError(var)) goto _output_error
+#define CHECK_VAR(var, fn)  var = fn; if (ZSTD_isError(var)) { DISPLAYLEVEL(1, "%s : fails : %s \n", #fn, ZSTD_getErrorName(var)); goto _output_error; }
 #define CHECK_NEWV(var, fn)  size_t const CHECK_VAR(var, fn)
 #define CHECK(fn)  { CHECK_NEWV(err, fn); }
 #define CHECKPLUS(var, fn, more)  { CHECK_NEWV(var, fn); more; }
@@ -1920,11 +1920,17 @@ static int basicUnitTests(U32 const seed, double compressibility)
 
         DISPLAYLEVEL(3, "test%3i : Dictionary Block decompression test : ", testNb++);
         CHECK( ZSTD_decompressBegin_usingDict(dctx, CNBuffer, dictSize) );
-        { CHECK_NEWV( r, ZSTD_decompressBlock(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) );
-          if (r != blockSize) goto _output_error; }
+        {   CHECK_NEWV( r, ZSTD_decompressBlock(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) );
+            if (r != blockSize) {
+                DISPLAYLEVEL(1, "ZSTD_decompressBlock() with _usingDict() fails : %s \n", ZSTD_getErrorName(r));
+                goto _output_error;
+        }   }
         ZSTD_insertBlock(dctx, (char*)decodedBuffer+blockSize, blockSize);   /* insert non-compressed block into dctx history */
-        { CHECK_NEWV( r, ZSTD_decompressBlock(dctx, (char*)decodedBuffer+2*blockSize, CNBuffSize, (char*)compressedBuffer+cSize+blockSize, cSize2) );
-          if (r != blockSize) goto _output_error; }
+        {   CHECK_NEWV( r, ZSTD_decompressBlock(dctx, (char*)decodedBuffer+2*blockSize, CNBuffSize, (char*)compressedBuffer+cSize+blockSize, cSize2) );
+            if (r != blockSize) {
+                DISPLAYLEVEL(1, "ZSTD_decompressBlock() with _usingDict() and after insertBlock() fails : %s \n", ZSTD_getErrorName(r));
+                goto _output_error;
+        }   }
         DISPLAYLEVEL(3, "OK \n");
 
         DISPLAYLEVEL(3, "test%3i : Block compression with CDict : ", testNb++);