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