zstd cli : displays total decoded size, even when a stream consists of multiple frames

This commit is contained in:
Yann Collet 2016-11-07 14:41:21 -08:00
parent fd3be6bc97
commit 0018ca28dc
2 changed files with 8 additions and 4 deletions

3
NEWS
View File

@ -1,3 +1,6 @@
v1.1.2
New : cli : status displays total amount decoded when stream/file consists of multiple appended frames (like pzstd)
v1.1.1 v1.1.1
New : command -M#, --memory=, --memlimit=, --memlimit-decompress= to limit allowed memory consumption New : command -M#, --memory=, --memlimit=, --memlimit-decompress= to limit allowed memory consumption
New : doc/zstd_manual.html, by Przemyslaw Skibinski New : doc/zstd_manual.html, by Przemyslaw Skibinski

View File

@ -580,7 +580,8 @@ static void FIO_fwriteSparseEnd(FILE* file, unsigned storedSkips)
@return : size of decoded frame @return : size of decoded frame
*/ */
unsigned long long FIO_decompressFrame(dRess_t ress, unsigned long long FIO_decompressFrame(dRess_t ress,
FILE* foutput, FILE* finput, size_t alreadyLoaded) FILE* foutput, FILE* finput, size_t alreadyLoaded,
U64 alreadyDecoded)
{ {
U64 frameSize = 0; U64 frameSize = 0;
size_t readSize; size_t readSize;
@ -604,7 +605,7 @@ unsigned long long FIO_decompressFrame(dRess_t ress,
/* Write block */ /* Write block */
storedSkips = FIO_fwriteSparse(foutput, ress.dstBuffer, outBuff.pos, storedSkips); storedSkips = FIO_fwriteSparse(foutput, ress.dstBuffer, outBuff.pos, storedSkips);
frameSize += outBuff.pos; frameSize += outBuff.pos;
DISPLAYUPDATE(2, "\rDecoded : %u MB... ", (U32)(frameSize>>20) ); DISPLAYUPDATE(2, "\rDecoded : %u MB... ", (U32)((alreadyDecoded+frameSize)>>20) );
if (readSizeHint == 0) break; /* end of frame */ if (readSizeHint == 0) break; /* end of frame */
if (inBuff.size != inBuff.pos) EXM_THROW(37, "Decoding error : should consume entire input"); if (inBuff.size != inBuff.pos) EXM_THROW(37, "Decoding error : should consume entire input");
@ -683,7 +684,7 @@ static int FIO_decompressSrcFile(dRess_t ress, const char* srcFileName)
fclose(srcFile); fclose(srcFile);
return 1; return 1;
} } } }
filesize += FIO_decompressFrame(ress, dstFile, srcFile, toRead); filesize += FIO_decompressFrame(ress, dstFile, srcFile, toRead, filesize);
} }
/* Final Status */ /* Final Status */