From: Paul Cruz Date: Wed, 14 Jun 2017 23:42:51 +0000 (-0700) Subject: changed randomly generated samples to randomly selected from the dictionary content X-Git-Tag: v1.3.0~1^2~15^2~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=664ed05ff6af2190c3c65e80458343484e12bbec;p=thirdparty%2Fzstd.git changed randomly generated samples to randomly selected from the dictionary content --- diff --git a/tests/decodecorpus.c b/tests/decodecorpus.c index 9bd6506e2..19cf6127b 100644 --- a/tests/decodecorpus.c +++ b/tests/decodecorpus.c @@ -1352,7 +1352,22 @@ static int generateCorpusWithDict(U32 seed, unsigned numFiles, const char* const curr++; } samples = malloc(totalSize); - RAND_buffer(&seed, samples, totalSize); + + /* reset pointer and counter */ + curr = sampleSizes; + i = 0; + + { + /* take substring from dictionary content */ + size_t pos = 0; + const BYTE* endDict = dictContent + dictSize - 400; + while(i++ < numSamples){ + size_t currSize = *(curr++); + BYTE* startSubstring = endDict - currSize; + memcpy(samples + pos, (void*)startSubstring, currSize); + pos += currSize; + } + } } {