From: Jennifer Liu Date: Sat, 14 Jul 2018 00:38:53 +0000 (-0700) Subject: Remove clevel and update documentation X-Git-Tag: v0.0.29~62^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31731df4dab0df7b465de2de5641b2e3416c9086;p=thirdparty%2Fzstd.git Remove clevel and update documentation --- diff --git a/contrib/randomDictBuilder/README.md b/contrib/randomDictBuilder/README.md index cadffdf27..de2c7ff6c 100644 --- a/contrib/randomDictBuilder/README.md +++ b/contrib/randomDictBuilder/README.md @@ -1,12 +1,17 @@ Random Dictionary Builder ### Permitted Arguments: -Input Files (in=fileName): files used to build dictionary, can include multiple files, each following "in=", required +Input File/Directory (in=fileName): required; file/directory used to build dictionary; if directory, will operate recursively for files inside directory; can include multiple files/directories, each following "in=" Output Dictionary (out=dictName): if not provided, default to defaultDict -Dictionary ID (dictID=#): positive number, if not provided, default to 0 -Maximum Dictionary Size (maxdict=#): positive number, in bytes, if not provided, default to 110KB -Size of Randomly Selected Segment (k=#): positive number, in bytes, if not provided, default to 200 -Compression Level (c=#): positive number, if not provided, default to 3 +Dictionary ID (dictID=#): nonnegative number; if not provided, default to 0 +Maximum Dictionary Size (maxdict=#): positive number; in bytes, if not provided, default to 110KB +Size of Randomly Selected Segment (k=#): positive number; in bytes; if not provided, default to 200 +Compression Level (c=#): positive number; if not provided, default to 3 + + +###Usage: +To build a random dictionary with the provided arguments: make run ARG= followed by arguments + ### Examples: make run ARG="in=../../lib/dictBuilder out=dict100 dictID=520" diff --git a/contrib/randomDictBuilder/main.c b/contrib/randomDictBuilder/main.c index 15eb5c440..cf0b94769 100644 --- a/contrib/randomDictBuilder/main.c +++ b/contrib/randomDictBuilder/main.c @@ -63,7 +63,7 @@ int main(int argCount, const char* argv[]) const char* programName = argv[0]; int operationResult = 0; - unsigned cLevel = DEFAULT_CLEVEL; + /* Initialize parameters with default value */ char* inputFile = DEFAULT_INPUTFILE; unsigned k = DEFAULT_k; char* outputFile = DEFAULT_OUTPUTFILE; @@ -76,10 +76,10 @@ int main(int argCount, const char* argv[]) for (int i = 1; i < argCount; i++) { const char* argument = argv[i]; if (longCommandWArg(&argument, "k=")) { k = readU32FromChar(&argument); continue; } - if (longCommandWArg(&argument, "c=")) { cLevel = readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "dictID=")) { dictID = readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "maxdict=")) { maxDictSize = readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "in=")) { + /* Allow multiple input files */ inputFile = malloc(strlen(argument) + 1); strcpy(inputFile, argument); filenameTable[filenameIdx] = inputFile; @@ -96,6 +96,11 @@ int main(int argCount, const char* argv[]) return operationResult; } + if (maxDictSize == 0) { + DISPLAYLEVEL(1, "maxDictSize should not be 0.\n"); + operationResult = 1; + return operationResult; + } char* fileNamesBuf = NULL; unsigned fileNamesNb = filenameIdx; @@ -114,7 +119,7 @@ int main(int argCount, const char* argv[]) ZDICT_random_params_t params; ZDICT_params_t zParams; - zParams.compressionLevel = cLevel; + zParams.compressionLevel = DEFAULT_CLEVEL; zParams.notificationLevel = displayLevel; zParams.dictID = dictID; params.zParams = zParams; diff --git a/contrib/randomDictBuilder/test.sh b/contrib/randomDictBuilder/test.sh index 552650ee4..497820f88 100644 --- a/contrib/randomDictBuilder/test.sh +++ b/contrib/randomDictBuilder/test.sh @@ -1,8 +1,8 @@ -echo "Building random dictionary with c=5 in=../../lib/common k=200 out=dict1" -./main c=5 in=../../lib/common k=200 out=dict1 +echo "Building random dictionary with in=../../lib/common k=200 out=dict1" +./main in=../../lib/common k=200 out=dict1 zstd -be3 -D dict1 -r ../../lib/common -q -echo "Building random dictionary with c=9 in=../../lib/common k=500 out=dict2 dictID=100 maxdict=140000" -./main c=9 in=../../lib/common k=500 out=dict2 dictID=100 maxdict=140000 +echo "Building random dictionary with in=../../lib/common k=500 out=dict2 dictID=100 maxdict=140000" +./main in=../../lib/common k=500 out=dict2 dictID=100 maxdict=140000 zstd -be3 -D dict2 -r ../../lib/common -q echo "Building random dictionary with 2 sample sources" ./main in=../../lib/common in=../../lib/compress out=dict3