mirror of
https://github.com/lz4/lz4.git
synced 2024-11-28 12:25:20 +08:00
fix minor "divide by zero" risk
This commit is contained in:
parent
633c1ca810
commit
2ed9dcc900
@ -487,7 +487,8 @@ static int LZ4IO_compressFilename_extRess(cRess_t ress, const char* srcFileName,
|
||||
size_t cSize = LZ4F_compressFrame(dstBuffer, dstBufferSize, srcBuffer, readSize, &prefs);
|
||||
if (LZ4F_isError(cSize)) EXM_THROW(34, "Compression failed : %s", LZ4F_getErrorName(cSize));
|
||||
compressedfilesize += cSize;
|
||||
DISPLAYUPDATE(2, "\rRead : %u MB ==> %.2f%% ", (unsigned)(filesize>>20), (double)compressedfilesize/filesize*100);
|
||||
DISPLAYUPDATE(2, "\rRead : %u MB ==> %.2f%% ",
|
||||
(unsigned)(filesize>>20), (double)compressedfilesize/(filesize+!filesize)*100); /* avoid division by zero */
|
||||
|
||||
/* Write Block */
|
||||
sizeCheck = fwrite(dstBuffer, 1, cSize, dstFile);
|
||||
|
Loading…
Reference in New Issue
Block a user