Mercurial > vba-linux
comparison src/win32/7zip/7z/CPP/7zip/Common/ProgressMt.cpp @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // ProgressMt.h | |
2 | |
3 #include "StdAfx.h" | |
4 | |
5 #include "ProgressMt.h" | |
6 | |
7 void CMtCompressProgressMixer::Init(int numItems, ICompressProgressInfo *progress) | |
8 { | |
9 NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); | |
10 InSizes.Clear(); | |
11 OutSizes.Clear(); | |
12 for (int i = 0; i < numItems; i++) | |
13 { | |
14 InSizes.Add(0); | |
15 OutSizes.Add(0); | |
16 } | |
17 TotalInSize = 0; | |
18 TotalOutSize = 0; | |
19 _progress = progress; | |
20 } | |
21 | |
22 void CMtCompressProgressMixer::Reinit(int index) | |
23 { | |
24 NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); | |
25 InSizes[index] = 0; | |
26 OutSizes[index] = 0; | |
27 } | |
28 | |
29 HRESULT CMtCompressProgressMixer::SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize) | |
30 { | |
31 NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection); | |
32 if (inSize != 0) | |
33 { | |
34 UInt64 diff = *inSize - InSizes[index]; | |
35 InSizes[index] = *inSize; | |
36 TotalInSize += diff; | |
37 } | |
38 if (outSize != 0) | |
39 { | |
40 UInt64 diff = *outSize - OutSizes[index]; | |
41 OutSizes[index] = *outSize; | |
42 TotalOutSize += diff; | |
43 } | |
44 if (_progress) | |
45 return _progress->SetRatioInfo(&TotalInSize, &TotalOutSize); | |
46 return S_OK; | |
47 } | |
48 | |
49 | |
50 STDMETHODIMP CMtCompressProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) | |
51 { | |
52 return _progress->SetRatioInfo(_index, inSize, outSize); | |
53 } |