Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // ProgressUtils.h
3 #include "StdAfx.h"
5 #include "ProgressUtils.h"
7 void CLocalCompressProgressInfo::Init(ICompressProgressInfo *progress,
8 const UInt64 *inStartValue, const UInt64 *outStartValue)
9 {
10 _progress = progress;
11 _inStartValueIsAssigned = (inStartValue != NULL);
12 if (_inStartValueIsAssigned)
13 _inStartValue = *inStartValue;
14 _outStartValueIsAssigned = (outStartValue != NULL);
15 if (_outStartValueIsAssigned)
16 _outStartValue = *outStartValue;
17 }
19 STDMETHODIMP CLocalCompressProgressInfo::SetRatioInfo(
20 const UInt64 *inSize, const UInt64 *outSize)
21 {
22 UInt64 inSizeNew, outSizeNew;
23 const UInt64 *inSizeNewPointer;
24 const UInt64 *outSizeNewPointer;
25 if (_inStartValueIsAssigned && inSize != NULL)
26 {
27 inSizeNew = _inStartValue + (*inSize);
28 inSizeNewPointer = &inSizeNew;
29 }
30 else
31 inSizeNewPointer = NULL;
33 if (_outStartValueIsAssigned && outSize != NULL)
34 {
35 outSizeNew = _outStartValue + (*outSize);
36 outSizeNewPointer = &outSizeNew;
37 }
38 else
39 outSizeNewPointer = NULL;
40 return _progress->SetRatioInfo(inSizeNewPointer, outSizeNewPointer);
41 }
44 ///////////////////////////////////
45 //
47 void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)
48 {
49 _progress = progress;
50 _inSizeIsMain = inSizeIsMain;
51 }
53 STDMETHODIMP CLocalProgress::SetRatioInfo(
54 const UInt64 *inSize, const UInt64 *outSize)
55 {
56 return _progress->SetCompleted(_inSizeIsMain ? inSize : outSize);
57 }