]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Merge branch 'dev' into dubtlazy 970/head
authorYann Collet <cyan@fb.com>
Thu, 11 Jan 2018 21:25:08 +0000 (13:25 -0800)
committerYann Collet <cyan@fb.com>
Thu, 11 Jan 2018 21:25:08 +0000 (13:25 -0800)
and fixed conflicts

1  2 
lib/compress/zstd_compress.c
tests/fuzzer.c

Simple merge
diff --cc tests/fuzzer.c
index c599a15dee19b701a402246a7522f34546d99281,024a583ba405c30900df9c5721e93a53bd7c6acd..3206d6e1117bca3b8aab4da05a667e22ff931a8d
@@@ -63,13 -63,20 +63,20 @@@ static UTIL_time_t g_displayClock = UTI
  #define DISPLAYUPDATE(l, ...) if (g_displayLevel>=l) { \
              if ((UTIL_clockSpanMicro(g_displayClock) > g_refreshRate) || (g_displayLevel>=4)) \
              { g_displayClock = UTIL_getTime(); DISPLAY(__VA_ARGS__); \
 -            if (g_displayLevel>=4) fflush(stderr); } }
 +            if (g_displayLevel>=4) fflush(stdout); } }
  
- /*-*******************************************************
- *  Fuzzer functions
- *********************************************************/
  #undef MIN
  #undef MAX
+ void FUZ_bug976(void)
+ {   /* these constants shall not depend on MIN() macro */
+     assert(ZSTD_HASHLOG_MAX < 31);
+     assert(ZSTD_CHAINLOG_MAX < 31);
+ }
+ /*-*******************************************************
+ *  Internal functions
+ *********************************************************/
  #define MIN(a,b) ((a)<(b)?(a):(b))
  #define MAX(a,b) ((a)>(b)?(a):(b))
  
@@@ -672,19 -681,29 +680,29 @@@ static int basicUnitTests(U32 seed, dou
              goto _output_error;
          }
  
 -        DISPLAYLEVEL(4, "test%3i : dictBuilder on cyclic data : ", testNb++);
++        DISPLAYLEVEL(3, "test%3i : dictBuilder on cyclic data : ", testNb++);
+         assert(compressedBufferSize >= totalSampleSize);
+         { U32 u; for (u=0; u<totalSampleSize; u++) ((BYTE*)decodedBuffer)[u] = (BYTE)u; }
+         { U32 u; for (u=0; u<nbSamples; u++) samplesSizes[u] = sampleUnitSize; }
+         {   size_t const sDictSize = ZDICT_trainFromBuffer(dictBuffer, dictBufferCapacity,
+                                          decodedBuffer, samplesSizes, nbSamples);
+             if (ZDICT_isError(sDictSize)) goto _output_error;
 -            DISPLAYLEVEL(4, "OK, created dictionary of size %u \n", (U32)sDictSize);
++            DISPLAYLEVEL(3, "OK, created dictionary of size %u \n", (U32)sDictSize);
+         }
 -        DISPLAYLEVEL(4, "test%3i : dictBuilder : ", testNb++);
 +        DISPLAYLEVEL(3, "test%3i : dictBuilder : ", testNb++);
          { U32 u; for (u=0; u<nbSamples; u++) samplesSizes[u] = sampleUnitSize; }
-         dictSize = ZDICT_trainFromBuffer(dictBuffer, dictSize,
+         dictSize = ZDICT_trainFromBuffer(dictBuffer, dictBufferCapacity,
                                           CNBuffer, samplesSizes, nbSamples);
          if (ZDICT_isError(dictSize)) goto _output_error;
 -        DISPLAYLEVEL(4, "OK, created dictionary of size %u \n", (U32)dictSize);
 +        DISPLAYLEVEL(3, "OK, created dictionary of size %u \n", (U32)dictSize);
  
 -        DISPLAYLEVEL(4, "test%3i : check dictID : ", testNb++);
 +        DISPLAYLEVEL(3, "test%3i : check dictID : ", testNb++);
          dictID = ZDICT_getDictID(dictBuffer, dictSize);
          if (dictID==0) goto _output_error;
 -        DISPLAYLEVEL(4, "OK : %u \n", dictID);
 +        DISPLAYLEVEL(3, "OK : %u \n", dictID);
  
 -        DISPLAYLEVEL(4, "test%3i : compress with dictionary : ", testNb++);
 +        DISPLAYLEVEL(3, "test%3i : compress with dictionary : ", testNb++);
          cSize = ZSTD_compress_usingDict(cctx, compressedBuffer, compressedBufferSize,
                                          CNBuffer, CNBuffSize,
                                          dictBuffer, dictSize, 4);