Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: third_party/lzma_sdk/7z.h

Issue 1700453002: Update lzma_sdk sources to 15.14. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium modifications Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/util/lzma_util.cc ('k') | third_party/lzma_sdk/7zAlloc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 7z.h -- 7z interface 1 /* 7z.h -- 7z interface
2 2010-03-11 : Igor Pavlov : Public domain */ 2 2015-11-18 : Igor Pavlov : Public domain */
3 3
4 #ifndef __7Z_H 4 #ifndef __7Z_H
5 #define __7Z_H 5 #define __7Z_H
6 6
7 #include "7zBuf.h" 7 #include "7zTypes.h"
8 8
9 EXTERN_C_BEGIN 9 EXTERN_C_BEGIN
10 10
11 #define k7zStartHeaderSize 0x20 11 #define k7zStartHeaderSize 0x20
12 #define k7zSignatureSize 6 12 #define k7zSignatureSize 6
13 extern Byte k7zSignature[k7zSignatureSize];
14 #define k7zMajorVersion 0
15 13
16 enum EIdEnum 14 extern const Byte k7zSignature[k7zSignatureSize];
17 {
18 k7zIdEnd,
19 k7zIdHeader,
20 k7zIdArchiveProperties,
21 k7zIdAdditionalStreamsInfo,
22 k7zIdMainStreamsInfo,
23 k7zIdFilesInfo,
24 k7zIdPackInfo,
25 k7zIdUnpackInfo,
26 k7zIdSubStreamsInfo,
27 k7zIdSize,
28 k7zIdCRC,
29 k7zIdFolder,
30 k7zIdCodersUnpackSize,
31 k7zIdNumUnpackStream,
32 k7zIdEmptyStream,
33 k7zIdEmptyFile,
34 k7zIdAnti,
35 k7zIdName,
36 k7zIdCTime,
37 k7zIdATime,
38 k7zIdMTime,
39 k7zIdWinAttributes,
40 k7zIdComment,
41 k7zIdEncodedHeader,
42 k7zIdStartPos,
43 k7zIdDummy
44 };
45 15
46 typedef struct 16 typedef struct
47 { 17 {
48 UInt32 NumInStreams; 18 const Byte *Data;
49 UInt32 NumOutStreams; 19 size_t Size;
50 UInt64 MethodID; 20 } CSzData;
51 CBuf Props; 21
22 /* CSzCoderInfo & CSzFolder support only default methods */
23
24 typedef struct
25 {
26 size_t PropsOffset;
27 UInt32 MethodID;
28 Byte NumStreams;
29 Byte PropsSize;
52 } CSzCoderInfo; 30 } CSzCoderInfo;
53 31
54 void SzCoderInfo_Init(CSzCoderInfo *p);
55 void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc);
56
57 typedef struct 32 typedef struct
58 { 33 {
59 UInt32 InIndex; 34 UInt32 InIndex;
60 UInt32 OutIndex; 35 UInt32 OutIndex;
61 } CSzBindPair; 36 } CSzBond;
37
38 #define SZ_NUM_CODERS_IN_FOLDER_MAX 4
39 #define SZ_NUM_BONDS_IN_FOLDER_MAX 3
40 #define SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX 4
62 41
63 typedef struct 42 typedef struct
64 { 43 {
65 CSzCoderInfo *Coders;
66 CSzBindPair *BindPairs;
67 UInt32 *PackStreams;
68 UInt64 *UnpackSizes;
69 UInt32 NumCoders; 44 UInt32 NumCoders;
70 UInt32 NumBindPairs; 45 UInt32 NumBonds;
71 UInt32 NumPackStreams; 46 UInt32 NumPackStreams;
72 int UnpackCRCDefined; 47 UInt32 UnpackStream;
73 UInt32 UnpackCRC; 48 UInt32 PackStreams[SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX];
74 49 CSzBond Bonds[SZ_NUM_BONDS_IN_FOLDER_MAX];
75 UInt32 NumUnpackStreams; 50 CSzCoderInfo Coders[SZ_NUM_CODERS_IN_FOLDER_MAX];
76 } CSzFolder; 51 } CSzFolder;
77 52
78 void SzFolder_Init(CSzFolder *p);
79 UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
80 int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex);
81 UInt32 SzFolder_GetNumOutStreams(CSzFolder *p);
82 UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
83 53
84 SRes SzFolder_Decode(const CSzFolder *folder, const UInt64 *packSizes, 54 SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd);
85 ILookInStream *stream, UInt64 startPos,
86 Byte *outBuffer, size_t outSize, ISzAlloc *allocMain);
87 55
88 typedef struct 56 typedef struct
89 { 57 {
90 UInt32 Low; 58 UInt32 Low;
91 UInt32 High; 59 UInt32 High;
92 } CNtfsFileTime; 60 } CNtfsFileTime;
93 61
94 typedef struct 62 typedef struct
95 { 63 {
96 CNtfsFileTime MTime; 64 Byte *Defs; /* MSB 0 bit numbering */
97 UInt64 Size; 65 UInt32 *Vals;
98 UInt32 Crc; 66 } CSzBitUi32s;
99 UInt32 Attrib;
100 Byte HasStream;
101 Byte IsDir;
102 Byte IsAnti;
103 Byte CrcDefined;
104 Byte MTimeDefined;
105 Byte AttribDefined;
106 } CSzFileItem;
107
108 void SzFile_Init(CSzFileItem *p);
109 67
110 typedef struct 68 typedef struct
111 { 69 {
112 UInt64 *PackSizes; 70 Byte *Defs; /* MSB 0 bit numbering */
113 Byte *PackCRCsDefined; 71 // UInt64 *Vals;
114 UInt32 *PackCRCs; 72 CNtfsFileTime *Vals;
115 CSzFolder *Folders; 73 } CSzBitUi64s;
116 CSzFileItem *Files; 74
75 #define SzBitArray_Check(p, i) (((p)[(i) >> 3] & (0x80 >> ((i) & 7))) != 0)
76
77 #define SzBitWithVals_Check(p, i) ((p)->Defs && ((p)->Defs[(i) >> 3] & (0x80 >> ((i) & 7))) != 0)
78
79 typedef struct
80 {
117 UInt32 NumPackStreams; 81 UInt32 NumPackStreams;
118 UInt32 NumFolders; 82 UInt32 NumFolders;
119 UInt32 NumFiles; 83
84 UInt64 *PackPositions; // NumPackStreams + 1
85 CSzBitUi32s FolderCRCs; // NumFolders
86
87 size_t *FoCodersOffsets; // NumFolders + 1
88 UInt32 *FoStartPackStreamIndex; // NumFolders + 1
89 UInt32 *FoToCoderUnpackSizes; // NumFolders + 1
90 Byte *FoToMainUnpackSizeIndex; // NumFolders
91 UInt64 *CoderUnpackSizes; // for all coders in all folders
92
93 Byte *CodersData;
120 } CSzAr; 94 } CSzAr;
121 95
122 void SzAr_Init(CSzAr *p); 96 UInt64 SzAr_GetFolderUnpackSize(const CSzAr *p, UInt32 folderIndex);
123 void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
124 97
125 98 SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex,
126 /* 99 ILookInStream *stream, UInt64 startPos,
127 SzExtract extracts file from archive 100 Byte *outBuffer, size_t outSize,
128 101 ISzAlloc *allocMain);
129 *outBuffer must be 0 before first call for each new archive.
130
131 Extracting cache:
132 If you need to decompress more than one file, you can send
133 these values from previous call:
134 *blockIndex,
135 *outBuffer,
136 *outBufferSize
137 You can consider "*outBuffer" as cache of solid block. If your archive is so lid,
138 it will increase decompression speed.
139
140 If you use external function, you can declare these 3 cache variables
141 (blockIndex, outBuffer, outBufferSize) as static in that external function.
142
143 Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
144 */
145 102
146 typedef struct 103 typedef struct
147 { 104 {
148 CSzAr db; 105 CSzAr db;
149 106
150 UInt64 startPosAfterHeader; 107 UInt64 startPosAfterHeader;
151 UInt64 dataPos; 108 UInt64 dataPos;
109
110 UInt32 NumFiles;
152 111
153 UInt32 *FolderStartPackStreamIndex; 112 UInt64 *UnpackPositions; // NumFiles + 1
154 UInt64 *PackStreamStartPositions; 113 // Byte *IsEmptyFiles;
155 UInt32 *FolderStartFileIndex; 114 Byte *IsDirs;
156 UInt32 *FileIndexToFolderIndexMap; 115 CSzBitUi32s CRCs;
116
117 CSzBitUi32s Attribs;
118 // CSzBitUi32s Parents;
119 CSzBitUi64s MTime;
120 CSzBitUi64s CTime;
121
122 UInt32 *FolderToFile; // NumFolders + 1
123 UInt32 *FileToFolder; // NumFiles
157 124
158 size_t *FileNameOffsets; /* in 2-byte steps */ 125 size_t *FileNameOffsets; /* in 2-byte steps */
159 CBuf FileNames; /* UTF-16-LE */ 126 Byte *FileNames; /* UTF-16-LE */
160 } CSzArEx; 127 } CSzArEx;
161 128
129 #define SzArEx_IsDir(p, i) (SzBitArray_Check((p)->IsDirs, i))
130
131 #define SzArEx_GetFileSize(p, i) ((p)->UnpackPositions[(i) + 1] - (p)->UnpackPos itions[i])
132
162 void SzArEx_Init(CSzArEx *p); 133 void SzArEx_Init(CSzArEx *p);
163 void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc); 134 void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc);
164 UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 in dexInFolder); 135 UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 in dexInFolder);
165 int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *r esSize); 136 int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *r esSize);
166 137
167 /* 138 /*
168 if dest == NULL, the return value specifies the required size of the buffer, 139 if dest == NULL, the return value specifies the required size of the buffer,
169 in 16-bit characters, including the null-terminating character. 140 in 16-bit characters, including the null-terminating character.
170 if dest != NULL, the return value specifies the number of 16-bit characters that 141 if dest != NULL, the return value specifies the number of 16-bit characters that
171 are written to the dest, including the null-terminating character. */ 142 are written to the dest, including the null-terminating character. */
172 143
173 size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest) ; 144 size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest) ;
174 145
146 /*
147 size_t SzArEx_GetFullNameLen(const CSzArEx *p, size_t fileIndex);
148 UInt16 *SzArEx_GetFullNameUtf16_Back(const CSzArEx *p, size_t fileIndex, UInt16 *dest);
149 */
150
151
152
153 /*
154 SzArEx_Extract extracts file from archive
155
156 *outBuffer must be 0 before first call for each new archive.
157
158 Extracting cache:
159 If you need to decompress more than one file, you can send
160 these values from previous call:
161 *blockIndex,
162 *outBuffer,
163 *outBufferSize
164 You can consider "*outBuffer" as cache of solid block. If your archive is so lid,
165 it will increase decompression speed.
166
167 If you use external function, you can declare these 3 cache variables
168 (blockIndex, outBuffer, outBufferSize) as static in that external function.
169
170 Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
171 */
172
175 SRes SzArEx_Extract( 173 SRes SzArEx_Extract(
176 const CSzArEx *db, 174 const CSzArEx *db,
177 ILookInStream *inStream, 175 ILookInStream *inStream,
178 UInt32 fileIndex, /* index of file */ 176 UInt32 fileIndex, /* index of file */
179 UInt32 *blockIndex, /* index of solid block */ 177 UInt32 *blockIndex, /* index of solid block */
180 Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */ 178 Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
181 size_t *outBufferSize, /* buffer size for output buffer */ 179 size_t *outBufferSize, /* buffer size for output buffer */
182 size_t *offset, /* offset of stream for required file in *outBuffe r */ 180 size_t *offset, /* offset of stream for required file in *outBuffe r */
183 size_t *outSizeProcessed, /* size of file in *outBuffer */ 181 size_t *outSizeProcessed, /* size of file in *outBuffer */
184 ISzAlloc *allocMain, 182 ISzAlloc *allocMain,
185 ISzAlloc *allocTemp); 183 ISzAlloc *allocTemp);
186 184
187 185
188 /* 186 /*
189 SzArEx_Open Errors: 187 SzArEx_Open Errors:
190 SZ_ERROR_NO_ARCHIVE 188 SZ_ERROR_NO_ARCHIVE
191 SZ_ERROR_ARCHIVE 189 SZ_ERROR_ARCHIVE
192 SZ_ERROR_UNSUPPORTED 190 SZ_ERROR_UNSUPPORTED
193 SZ_ERROR_MEM 191 SZ_ERROR_MEM
194 SZ_ERROR_CRC 192 SZ_ERROR_CRC
195 SZ_ERROR_INPUT_EOF 193 SZ_ERROR_INPUT_EOF
196 SZ_ERROR_FAIL 194 SZ_ERROR_FAIL
197 */ 195 */
198 196
199 SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAl loc *allocTemp); 197 SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream,
198 ISzAlloc *allocMain, ISzAlloc *allocTemp);
200 199
201 EXTERN_C_END 200 EXTERN_C_END
202 201
203 #endif 202 #endif
OLDNEW
« no previous file with comments | « chrome/installer/util/lzma_util.cc ('k') | third_party/lzma_sdk/7zAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698