blob: b2bc59a5fa7637721bcd6d3857328b351341843a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// UpdateProduce.cpp
#include "StdAfx.h"
#include "UpdateProduce.h"
using namespace NUpdateArchive;
static const char *kUpdateActionSetCollision = "Internal collision in update action set";
void UpdateProduce(
const CRecordVector<CUpdatePair> &updatePairs,
const NUpdateArchive::CActionSet &actionSet,
CRecordVector<CUpdatePair2> &operationChain)
{
for (int i = 0; i < updatePairs.Size(); i++)
{
const CUpdatePair &pair = updatePairs[i];
CUpdatePair2 up2;
up2.IsAnti = false;
up2.DirIndex = pair.DirIndex;
up2.ArcIndex = pair.ArcIndex;
up2.NewData = up2.NewProps = true;
switch(actionSet.StateActions[pair.State])
{
case NPairAction::kIgnore:
/*
if (pair.State != NPairState::kOnlyOnDisk)
IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]);
// cout << "deleting";
*/
continue;
case NPairAction::kCopy:
if (pair.State == NPairState::kOnlyOnDisk)
throw kUpdateActionSetCollision;
up2.NewData = up2.NewProps = false;
break;
case NPairAction::kCompress:
if (pair.State == NPairState::kOnlyInArchive ||
pair.State == NPairState::kNotMasked)
throw kUpdateActionSetCollision;
break;
case NPairAction::kCompressAsAnti:
up2.IsAnti = true;
break;
}
operationChain.Add(up2);
}
operationChain.ReserveDown();
}
|