]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Setting ZSTD_c_contentSizeFlag instead of UNKNOWN filesize 2032/head
authorBimba Shrestha <bimbashrestha@fb.com>
Mon, 9 Mar 2020 20:40:18 +0000 (15:40 -0500)
committerBimba Shrestha <bimbashrestha@fb.com>
Mon, 9 Mar 2020 20:40:18 +0000 (15:40 -0500)
programs/fileio.c

index 1a0bb97c0c09283dbb841c8b1282044e4ddfa464..c833336dc8a83d222bdf329f24295806371060f6 100644 (file)
@@ -823,6 +823,7 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs,
         CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_contentSizeFlag, 1) );  /* always enable content size when available (note: supposed to be default) */
         CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_dictIDFlag, prefs->dictIDFlag) );
         CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_checksumFlag, prefs->checksumFlag) );
+        CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_contentSizeFlag, prefs->contentSize) );
         /* compression level */
         CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, cLevel) );
         /* max compressed block size */
@@ -1342,7 +1343,7 @@ FIO_compressFilename_internal(FIO_prefs_t* const prefs,
     clock_t const cpuStart = clock();
     U64 readsize = 0;
     U64 compressedfilesize = 0;
-    U64 const fileSize = prefs->contentSize ? UTIL_getFileSize(srcFileName) : UTIL_FILESIZE_UNKNOWN;
+    U64 const fileSize = UTIL_getFileSize(srcFileName);
     DISPLAYLEVEL(5, "%s: %u bytes \n", srcFileName, (unsigned)fileSize);
 
     /* compression format selection */