diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-06-15 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:54 +0300 |
commit | 54490d51d5c6b0d794dcbad2d634d4c95fc25b6c (patch) | |
tree | c3c413656432c0ef87b2841c80e42b55ad17d4e8 /CPP/7zip/Common/ProgressUtils.cpp | |
parent | 0713a3ab803e57401f18432148b4139e5fe6e5dd (diff) |
15.0515.05
Diffstat (limited to 'CPP/7zip/Common/ProgressUtils.cpp')
-rw-r--r-- | CPP/7zip/Common/ProgressUtils.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/CPP/7zip/Common/ProgressUtils.cpp b/CPP/7zip/Common/ProgressUtils.cpp index bac45c1c..41385ccb 100644 --- a/CPP/7zip/Common/ProgressUtils.cpp +++ b/CPP/7zip/Common/ProgressUtils.cpp @@ -4,11 +4,13 @@ #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; } |