]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Inverting content size prefs bool
authorBimba Shrestha <bimbashrestha@fb.com>
Mon, 9 Mar 2020 19:12:52 +0000 (14:12 -0500)
committerBimba Shrestha <bimbashrestha@fb.com>
Mon, 9 Mar 2020 19:16:10 +0000 (14:16 -0500)
programs/fileio.c
programs/fileio.h
programs/zstdcli.c

index 288a73d327cd4dffd0a6d2d05ad48341c6a73514..1a0bb97c0c09283dbb841c8b1282044e4ddfa464 100644 (file)
@@ -323,7 +323,7 @@ struct FIO_prefs_s {
 
     int excludeCompressedFiles;
     int patchFromMode;
-    int noContentSize;
+    int contentSize;
 };
 
 
@@ -495,9 +495,9 @@ void FIO_setPatchFromMode(FIO_prefs_t* const prefs, int value)
     prefs->patchFromMode = value != 0;
 }
 
-void FIO_setNoContentSize(FIO_prefs_t* const prefs, int value)
+void FIO_setContentSize(FIO_prefs_t* const prefs, int value)
 {
-    prefs->noContentSize = value != 0;
+    prefs->contentSize = value != 0;
 }
 
 /*-*************************************
@@ -1342,7 +1342,7 @@ FIO_compressFilename_internal(FIO_prefs_t* const prefs,
     clock_t const cpuStart = clock();
     U64 readsize = 0;
     U64 compressedfilesize = 0;
-    U64 const fileSize = !prefs->noContentSize ? UTIL_getFileSize(srcFileName) : UTIL_FILESIZE_UNKNOWN;
+    U64 const fileSize = prefs->contentSize ? UTIL_getFileSize(srcFileName) : UTIL_FILESIZE_UNKNOWN;
     DISPLAYLEVEL(5, "%s: %u bytes \n", srcFileName, (unsigned)fileSize);
 
     /* compression format selection */
index ec2f28dc5f7758ec4109bd3ea41f39be1c191814..64a7035b183aebf3fdb3ed55423f925d44116bee 100644 (file)
@@ -95,7 +95,7 @@ void FIO_setNoProgress(unsigned noProgress);
 void FIO_setNotificationLevel(int level);
 void FIO_setExcludeCompressedFile(FIO_prefs_t* const prefs, int excludeCompressedFiles);
 void FIO_setPatchFromMode(FIO_prefs_t* const prefs, int value);
-void FIO_setNoContentSize(FIO_prefs_t* const prefs, int value);
+void FIO_setContentSize(FIO_prefs_t* const prefs, int value);
 
 /*-*************************************
 *  Single File functions
index 319c661258ca74cc31addc94ee0fb5b2f36d462e..ebdfca75c85c88686707bf675af3caf9a7b437da 100644 (file)
@@ -635,7 +635,7 @@ int main(int const argCount, const char* argv[])
         singleThread = 0,
         showDefaultCParams = 0,
         ultra=0,
-        noContentSize=0;
+        contentSize=1;
     double compressibility = 0.5;
     unsigned bench_nbSeconds = 3;   /* would be better if this value was synchronized from bench */
     size_t blockSize = 0;
@@ -749,7 +749,7 @@ int main(int const argCount, const char* argv[])
                 if (!strcmp(argument, "--priority=rt")) { setRealTimePrio = 1; continue; }
                 if (!strcmp(argument, "--output-dir-flat")) {nextArgumentIsOutDirName=1; lastCommand=1; continue; }
                 if (!strcmp(argument, "--show-default-cparams")) { showDefaultCParams = 1; continue; }
-                if (!strcmp(argument, "--no-content-size")) { noContentSize = 1; continue; }
+                if (!strcmp(argument, "--no-content-size")) { contentSize = 0; continue; }
                 if (!strcmp(argument, "--adapt")) { adapt = 1; continue; }
                 if (longCommandWArg(&argument, "--adapt=")) { adapt = 1; if (!parseAdaptParameters(argument, &adaptMin, &adaptMax)) { badusage(programName); CLEAN_RETURN(1); } continue; }
                 if (!strcmp(argument, "--single-thread")) { nbWorkers = 0; singleThread = 1; continue; }
@@ -1258,7 +1258,7 @@ int main(int const argCount, const char* argv[])
     FIO_setMemLimit(prefs, memLimit);
     if (operation==zom_compress) {
 #ifndef ZSTD_NOCOMPRESS
-        FIO_setNoContentSize(prefs, noContentSize);
+        FIO_setContentSize(prefs, contentSize);
         FIO_setNbWorkers(prefs, nbWorkers);
         FIO_setBlockSize(prefs, (int)blockSize);
         if (g_overlapLog!=OVERLAP_LOG_DEFAULT) FIO_setOverlapLog(prefs, (int)g_overlapLog);
@@ -1306,7 +1306,7 @@ int main(int const argCount, const char* argv[])
         else
           operationResult = FIO_compressMultipleFilenames(prefs, filenames->fileNames, (unsigned)filenames->tableSize, outDirName, outFileName, suffix, dictFileName, cLevel, compressionParams);
 #else
-        (void)noContentSize; (void)suffix; (void)adapt; (void)rsyncable; (void)ultra; (void)cLevel; (void)ldmFlag; (void)literalCompressionMode; (void)targetCBlockSize; (void)streamSrcSize; (void)srcSizeHint; (void)ZSTD_strategyMap; /* not used when ZSTD_NOCOMPRESS set */
+        (void)contentSize; (void)suffix; (void)adapt; (void)rsyncable; (void)ultra; (void)cLevel; (void)ldmFlag; (void)literalCompressionMode; (void)targetCBlockSize; (void)streamSrcSize; (void)srcSizeHint; (void)ZSTD_strategyMap; /* not used when ZSTD_NOCOMPRESS set */
         DISPLAY("Compression not supported \n");
 #endif
     } else {  /* decompression or test */