fixing general style

This commit is contained in:
Paul Cruz
2017-06-15 18:06:32 -07:00
parent 623b8fce85
commit 2f30433cd7
+7 -9
View File
@@ -1324,13 +1324,13 @@ static int generateCorpusWithDict(U32 seed, unsigned numFiles, const char* const
const size_t headerSize = dictSize/4; const size_t headerSize = dictSize/4;
const size_t dictContentSize = dictSize - dictSize/4; const size_t dictContentSize = dictSize - dictSize/4;
ZSTD_DCtx* dctx = ZSTD_createDCtx(); ZSTD_DCtx* dctx = ZSTD_createDCtx();
if(snprintf(outPath, MAX_PATH, "%s/dictionary", path) + 1 > MAX_PATH) { if (snprintf(outPath, MAX_PATH, "%s/dictionary", path) + 1 > MAX_PATH) {
DISPLAY("Error: path too long\n"); DISPLAY("Error: path too long\n");
return 1; return 1;
} }
{ {
/* use 3/4 of dictionary for content, save rest for header/entropy tables */ /* use 3/4 of dictionary for content, save rest for header/entropy tables */
if(dictContentSize < 128 || dictSize < 256){ if (dictContentSize < 128 || dictSize < 256) {
DISPLAY("Error: dictionary size is too small\n"); DISPLAY("Error: dictionary size is too small\n");
return 1; return 1;
} }
@@ -1352,7 +1352,7 @@ static int generateCorpusWithDict(U32 seed, unsigned numFiles, const char* const
size_t* curr = sampleSizes; size_t* curr = sampleSizes;
size_t totalSize = 0; size_t totalSize = 0;
unsigned numReps = 1; unsigned numReps = 1;
while(numSamples < 200){ while (numSamples < 200) {
size_t randSize = RAND(&seed) % dictContentSize; size_t randSize = RAND(&seed) % dictContentSize;
unsigned counter = numReps; unsigned counter = numReps;
numSamples += numReps; numSamples += numReps;
@@ -1568,7 +1568,7 @@ int main(int argc, char** argv)
argument++; argument++;
if (strcmp(argument, "content-size") == 0) { if (strcmp(argument, "content-size") == 0) {
opts.contentSize = 1; opts.contentSize = 1;
} else if(strcmp(argument, "train-dict") == 0){ } else if (strcmp(argument, "train-dict") == 0) {
argument += 11; argument += 11;
dictSize = readInt(&argument); dictSize = readInt(&argument);
genDict = 1; genDict = 1;
@@ -1607,11 +1607,9 @@ int main(int argc, char** argv)
return generateFile(seed, path, origPath); return generateFile(seed, path, origPath);
} else if (genDict == 0){ } else if (genDict == 0){
return generateCorpus(seed, numFiles, path, origPath); return generateCorpus(seed, numFiles, path, origPath);
} else if (numFiles == 0){ } else {
/* should generate a single file with a dictionary */ /* should generate files with a dictionary */
return generateCorpusWithDict(seed, 1, path, origPath, dictSize); numFiles = (numFiles == 0) ? 1 : numFiles;
} else{
/* should generate multiple files with a dictionary */
return generateCorpusWithDict(seed, numFiles, path, origPath, dictSize); return generateCorpusWithDict(seed, numFiles, path, origPath, dictSize);
} }