• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 7zUpdate.h
2 
3 #ifndef ZIP7_INC_7Z_UPDATE_H
4 #define ZIP7_INC_7Z_UPDATE_H
5 
6 #include "../IArchive.h"
7 
8 // #include "../../Common/UniqBlocks.h"
9 
10 #include "7zCompressionMode.h"
11 #include "7zIn.h"
12 
13 namespace NArchive {
14 namespace N7z {
15 
16 /*
17 struct CTreeFolder
18 {
19   UString Name;
20   int Parent;
21   CIntVector SubFolders;
22   int UpdateItemIndex;
23   int SortIndex;
24   int SortIndexEnd;
25 
26   CTreeFolder(): UpdateItemIndex(-1) {}
27 };
28 */
29 
30 struct CUpdateItem
31 {
32   int IndexInArchive;
33   unsigned IndexInClient;
34 
35   UInt64 CTime;
36   UInt64 ATime;
37   UInt64 MTime;
38 
39   UInt64 Size;
40   UString Name;
41   /*
42   bool IsAltStream;
43   int ParentFolderIndex;
44   int TreeFolderIndex;
45   */
46 
47   // that code is not used in 9.26
48   // int ParentSortIndex;
49   // int ParentSortIndexEnd;
50 
51   UInt32 Attrib;
52 
53   bool NewData;
54   bool NewProps;
55 
56   bool IsAnti;
57   bool IsDir;
58 
59   bool AttribDefined;
60   bool CTimeDefined;
61   bool ATimeDefined;
62   bool MTimeDefined;
63 
64   // bool ATime_WasReadByAnalysis;
65 
66   // int SecureIndex; // 0 means (no_security)
67 
HasStreamCUpdateItem68   bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
69   // bool HasStream() const { return !IsDir && !IsAnti /* && Size != 0 */; } // for test purposes
70 
CUpdateItemCUpdateItem71   CUpdateItem():
72       // ParentSortIndex(-1),
73       // IsAltStream(false),
74       IsAnti(false),
75       IsDir(false),
76       AttribDefined(false),
77       CTimeDefined(false),
78       ATimeDefined(false),
79       MTimeDefined(false)
80       // , ATime_WasReadByAnalysis(false)
81       // SecureIndex(0)
82       {}
SetDirStatusFromAttribCUpdateItem83   void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); }
84 
85   // unsigned GetExtensionPos() const;
86   // UString GetExtension() const;
87 };
88 
89 struct CUpdateOptions
90 {
91   const CCompressionMethodMode *Method;
92   const CCompressionMethodMode *HeaderMethod;
93   bool UseFilters; // use additional filters for some files
94   bool MaxFilter;  // use BCJ2 filter instead of BCJ
95   int AnalysisLevel;
96 
97   UInt64 NumSolidFiles;
98   UInt64 NumSolidBytes;
99   bool SolidExtension;
100 
101   bool UseTypeSorting;
102 
103   bool RemoveSfxBlock;
104   bool MultiThreadMixer;
105 
106   bool Need_CTime;
107   bool Need_ATime;
108   bool Need_MTime;
109   bool Need_Attrib;
110   // bool Need_Crc;
111 
112   CHeaderOptions HeaderOptions;
113 
CUpdateOptionsCUpdateOptions114   CUpdateOptions():
115       Method(NULL),
116       HeaderMethod(NULL),
117       UseFilters(false),
118       MaxFilter(false),
119       AnalysisLevel(-1),
120       NumSolidFiles((UInt64)(Int64)(-1)),
121       NumSolidBytes((UInt64)(Int64)(-1)),
122       SolidExtension(false),
123       UseTypeSorting(true),
124       RemoveSfxBlock(false),
125       MultiThreadMixer(true),
126       Need_CTime(false),
127       Need_ATime(false),
128       Need_MTime(false),
129       Need_Attrib(false)
130       // , Need_Crc(true)
131     {}
132 };
133 
134 HRESULT Update(
135     DECL_EXTERNAL_CODECS_LOC_VARS
136     IInStream *inStream,
137     const CDbEx *db,
138     CObjectVector<CUpdateItem> &updateItems,
139     // const CObjectVector<CTreeFolder> &treeFolders, // treeFolders[0] is root
140     // const CUniqBlocks &secureBlocks,
141     ISequentialOutStream *seqOutStream,
142     IArchiveUpdateCallback *updateCallback,
143     const CUpdateOptions &options);
144 }}
145 
146 #endif
147