]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fixed logic for stdout output
authorsenhuang42 <senhuang96@fb.com>
Wed, 7 Oct 2020 17:43:27 +0000 (13:43 -0400)
committersenhuang42 <senhuang96@fb.com>
Wed, 7 Oct 2020 17:43:27 +0000 (13:43 -0400)
programs/fileio.c

index e20b9e28cf349e2eede8bab5b765e009d33351be..e02c3f83a633d3b9d3fb4959b09a0ffab45c3a07 100644 (file)
@@ -2124,19 +2124,21 @@ FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress, FILE* finput,
         /* Write block */
         storedSkips = FIO_fwriteSparse(ress->dstFile, ress->dstBuffer, outBuff.pos, prefs, storedSkips);
         frameSize += outBuff.pos;
-        if (fCtx->nbFilesTotal > 1) {
-            size_t srcFileNameSize = strlen(srcFileName);
-            if (srcFileNameSize > 18) {
-                const char* truncatedSrcFileName = srcFileName + srcFileNameSize - 15;
-                DISPLAYUPDATE(2, "\rDecompress: %2u/%2u files. Current: ...%s : %u MB...    ",
-                                fCtx->currFileIdx+1, fCtx->nbFilesTotal, truncatedSrcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) );
+        if (!fCtx->hasStdoutOutput) {
+            if (fCtx->nbFilesTotal > 1) {
+                size_t srcFileNameSize = strlen(srcFileName);
+                if (srcFileNameSize > 18) {
+                    const char* truncatedSrcFileName = srcFileName + srcFileNameSize - 15;
+                    DISPLAYUPDATE(2, "\rDecompress: %2u/%2u files. Current: ...%s : %u MB...    ",
+                                    fCtx->currFileIdx+1, fCtx->nbFilesTotal, truncatedSrcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) );
+                } else {
+                    DISPLAYUPDATE(2, "\rDecompress: %2u/%2u files. Current: %s : %u MB...    ",
+                                fCtx->currFileIdx+1, fCtx->nbFilesTotal, srcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) );
+                }
             } else {
-                DISPLAYUPDATE(2, "\rDecompress: %2u/%2u files. Current: %s : %u MB...    ",
-                            fCtx->currFileIdx+1, fCtx->nbFilesTotal, srcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) );
+                DISPLAYUPDATE(2, "\r%-20.20s : %u MB...     ",
+                                srcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) );
             }
-        } else {
-            DISPLAYUPDATE(2, "\r%-20.20s : %u MB...     ",
-                            srcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) );
         }
 
         if (inBuff.pos > 0) {