Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-08-27 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:54 +0300
commit051769bbc577aeede90558b6ab5c9be187940ca0 (patch)
treee6330cb80f2d4a526d8aa27812528e053b0cda90 /CPP/7zip/Common/ProgressUtils.cpp
parent33ccab7e728a996800e166d849fe1e92a17e1afe (diff)
4.53 beta
Diffstat (limited to 'CPP/7zip/Common/ProgressUtils.cpp')
-rwxr-xr-xCPP/7zip/Common/ProgressUtils.cpp61
1 files changed, 23 insertions, 38 deletions
diff --git a/CPP/7zip/Common/ProgressUtils.cpp b/CPP/7zip/Common/ProgressUtils.cpp
index 40e13877..22dc60d1 100755
--- a/CPP/7zip/Common/ProgressUtils.cpp
+++ b/CPP/7zip/Common/ProgressUtils.cpp
@@ -4,52 +4,37 @@
#include "ProgressUtils.h"
-void CLocalCompressProgressInfo::Init(ICompressProgressInfo *progress,
- const UInt64 *inStartValue, const UInt64 *outStartValue)
+CLocalProgress::CLocalProgress()
{
- _progress = progress;
- _inStartValueIsAssigned = (inStartValue != NULL);
- if (_inStartValueIsAssigned)
- _inStartValue = *inStartValue;
- _outStartValueIsAssigned = (outStartValue != NULL);
- if (_outStartValueIsAssigned)
- _outStartValue = *outStartValue;
+ ProgressOffset = InSize = OutSize = 0;
+ SendRatio = true;
}
-STDMETHODIMP CLocalCompressProgressInfo::SetRatioInfo(
- const UInt64 *inSize, const UInt64 *outSize)
-{
- UInt64 inSizeNew, outSizeNew;
- const UInt64 *inSizeNewPointer;
- const UInt64 *outSizeNewPointer;
- if (_inStartValueIsAssigned && inSize != NULL)
- {
- inSizeNew = _inStartValue + (*inSize);
- inSizeNewPointer = &inSizeNew;
- }
- else
- inSizeNewPointer = NULL;
-
- if (_outStartValueIsAssigned && outSize != NULL)
- {
- outSizeNew = _outStartValue + (*outSize);
- outSizeNewPointer = &outSizeNew;
- }
- else
- outSizeNewPointer = NULL;
- return _progress->SetRatioInfo(inSizeNewPointer, outSizeNewPointer);
-}
-
-///////////////////////////////////
-
void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)
{
+ _ratioProgress.Release();
_progress = progress;
+ _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress);
_inSizeIsMain = inSizeIsMain;
}
-STDMETHODIMP CLocalProgress::SetRatioInfo(
- const UInt64 *inSize, const UInt64 *outSize)
+STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
+{
+ UInt64 inSizeNew = InSize, outSizeNew = OutSize;
+ if (inSize)
+ inSizeNew += (*inSize);
+ if (outSize)
+ outSizeNew += (*outSize);
+ if (SendRatio && _ratioProgress)
+ {
+ RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew));
+ }
+ inSizeNew += ProgressOffset;
+ outSizeNew += ProgressOffset;
+ return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew);
+}
+
+HRESULT CLocalProgress::SetCur()
{
- return _progress->SetCompleted(_inSizeIsMain ? inSize : outSize);
+ return SetRatioInfo(NULL, NULL);
}