xref: /aosp_15_r20/external/lzma/CPP/7zip/Archive/Zip/ZipUpdate.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // ZipUpdate.h
2 
3 #ifndef ZIP7_INC_ZIP_UPDATE_H
4 #define ZIP7_INC_ZIP_UPDATE_H
5 
6 #include "../../ICoder.h"
7 #include "../IArchive.h"
8 
9 #include "../../Common/CreateCoder.h"
10 
11 #include "ZipCompressionMode.h"
12 #include "ZipIn.h"
13 
14 namespace NArchive {
15 namespace NZip {
16 
17 /*
18 struct CUpdateRange
19 {
20   UInt64 Position;
21   UInt64 Size;
22 
23   // CUpdateRange() {}
24   CUpdateRange(UInt64 position, UInt64 size): Position(position), Size(size) {}
25 };
26 */
27 
28 struct CUpdateItem
29 {
30   bool NewData;
31   bool NewProps;
32   bool IsDir;
33   bool Write_NtfsTime;
34   bool Write_UnixTime;
35   // bool Write_UnixTime_ATime;
36   bool IsUtf8;
37   bool Size_WasSetFromStream;
38   // bool IsAltStream;
39   int IndexInArc;
40   unsigned IndexInClient;
41   UInt32 Attrib;
42   UInt32 Time;
43   UInt64 Size;
44   AString Name;
45   CByteBuffer Name_Utf;    // for Info-Zip (kIzUnicodeName) Extra
46   CByteBuffer Comment;
47   // bool Commented;
48   // CUpdateRange CommentRange;
49   FILETIME Ntfs_MTime;
50   FILETIME Ntfs_ATime;
51   FILETIME Ntfs_CTime;
52 
ClearCUpdateItem53   void Clear()
54   {
55     IsDir = false;
56 
57     Write_NtfsTime = false;
58     Write_UnixTime = false;
59 
60     IsUtf8 = false;
61     Size_WasSetFromStream = false;
62     // IsAltStream = false;
63     Time = 0;
64     Size = 0;
65     Name.Empty();
66     Name_Utf.Free();
67     Comment.Free();
68 
69     FILETIME_Clear(Ntfs_MTime);
70     FILETIME_Clear(Ntfs_ATime);
71     FILETIME_Clear(Ntfs_CTime);
72   }
73 
CUpdateItemCUpdateItem74   CUpdateItem():
75     IsDir(false),
76     Write_NtfsTime(false),
77     Write_UnixTime(false),
78     IsUtf8(false),
79     Size_WasSetFromStream(false),
80     // IsAltStream(false),
81     Time(0),
82     Size(0)
83     {}
84 };
85 
86 
87 struct CUpdateOptions
88 {
89   bool Write_MTime;
90   bool Write_ATime;
91   bool Write_CTime;
92 };
93 
94 
95 HRESULT Update(
96     DECL_EXTERNAL_CODECS_LOC_VARS
97     const CObjectVector<CItemEx> &inputItems,
98     CObjectVector<CUpdateItem> &updateItems,
99     ISequentialOutStream *seqOutStream,
100     CInArchive *inArchive, bool removeSfx,
101     const CUpdateOptions &updateOptions,
102     const CCompressionMethodMode &compressionMethodMode,
103     IArchiveUpdateCallback *updateCallback);
104 
105 }}
106 
107 #endif
108