diff options
Diffstat (limited to '3rdparty/lzma/CPP/7zip/Common/ProgressUtils.cpp')
-rw-r--r-- | 3rdparty/lzma/CPP/7zip/Common/ProgressUtils.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/3rdparty/lzma/CPP/7zip/Common/ProgressUtils.cpp b/3rdparty/lzma/CPP/7zip/Common/ProgressUtils.cpp index f24ff6b6fb8..41385ccb1cc 100644 --- a/3rdparty/lzma/CPP/7zip/Common/ProgressUtils.cpp +++ b/3rdparty/lzma/CPP/7zip/Common/ProgressUtils.cpp @@ -1,14 +1,16 @@ -// ProgressUtils.h +// ProgressUtils.cpp #include "StdAfx.h" #include "ProgressUtils.h" -CLocalProgress::CLocalProgress() -{ - ProgressOffset = InSize = OutSize = 0; - SendRatio = SendProgress = true; -} +CLocalProgress::CLocalProgress(): + ProgressOffset(0), + InSize(0), + OutSize(0), + SendRatio(true), + SendProgress(true) + {} void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain) { @@ -20,19 +22,26 @@ void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain) STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) { - UInt64 inSizeNew = InSize, outSizeNew = OutSize; + UInt64 inSize2 = InSize; + UInt64 outSize2 = OutSize; + if (inSize) - inSizeNew += (*inSize); + inSize2 += (*inSize); if (outSize) - outSizeNew += (*outSize); + outSize2 += (*outSize); + if (SendRatio && _ratioProgress) { - RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew)); + RINOK(_ratioProgress->SetRatioInfo(&inSize2, &outSize2)); } - inSizeNew += ProgressOffset; - outSizeNew += ProgressOffset; + if (SendProgress) - return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew); + { + inSize2 += ProgressOffset; + outSize2 += ProgressOffset; + return _progress->SetCompleted(_inSizeIsMain ? &inSize2 : &outSize2); + } + return S_OK; } |