#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))
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);