diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-01-20 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:49 +0300 |
commit | d9666cf046a8453b33b3e2fbf4d82295a9f87df3 (patch) | |
tree | c722ed19b844b53042aec0c1d7d2f8381140a5ed /CPP/7zip/Common/ProgressUtils.cpp | |
parent | 804edc5756fede54dbb1aefda6d39d306111938d (diff) |
4.44 beta
Diffstat (limited to 'CPP/7zip/Common/ProgressUtils.cpp')
-rwxr-xr-x | CPP/7zip/Common/ProgressUtils.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/CPP/7zip/Common/ProgressUtils.cpp b/CPP/7zip/Common/ProgressUtils.cpp new file mode 100755 index 00000000..40e13877 --- /dev/null +++ b/CPP/7zip/Common/ProgressUtils.cpp @@ -0,0 +1,55 @@ +// ProgressUtils.h + +#include "StdAfx.h" + +#include "ProgressUtils.h" + +void CLocalCompressProgressInfo::Init(ICompressProgressInfo *progress, + const UInt64 *inStartValue, const UInt64 *outStartValue) +{ + _progress = progress; + _inStartValueIsAssigned = (inStartValue != NULL); + if (_inStartValueIsAssigned) + _inStartValue = *inStartValue; + _outStartValueIsAssigned = (outStartValue != NULL); + if (_outStartValueIsAssigned) + _outStartValue = *outStartValue; +} + +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) +{ + _progress = progress; + _inSizeIsMain = inSizeIsMain; +} + +STDMETHODIMP CLocalProgress::SetRatioInfo( + const UInt64 *inSize, const UInt64 *outSize) +{ + return _progress->SetCompleted(_inSizeIsMain ? inSize : outSize); +} |