aboutsummaryrefslogtreecommitdiff
path: root/src/common/unzip.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/unzip.h')
-rw-r--r--src/common/unzip.h137
1 files changed, 69 insertions, 68 deletions
diff --git a/src/common/unzip.h b/src/common/unzip.h
index 55e7bb6..9812ad8 100644
--- a/src/common/unzip.h
+++ b/src/common/unzip.h
@@ -21,7 +21,7 @@
21 * @file common/unzip.h 21 * @file common/unzip.h
22 * @brief API to access ZIP archives 22 * @brief API to access ZIP archives
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * 24 *
25 * This code is based in part on 25 * This code is based in part on
26 * unzip 1.00 Copyright 1998-2003 Gilles Vollant 26 * unzip 1.00 Copyright 1998-2003 Gilles Vollant
27 * http://www.winimage.com/zLibDll" 27 * http://www.winimage.com/zLibDll"
@@ -83,112 +83,112 @@ struct EXTRACTOR_UnzipFile;
83struct EXTRACTOR_UnzipDateTimeInfo 83struct EXTRACTOR_UnzipDateTimeInfo
84{ 84{
85 /** 85 /**
86 * seconds after the minute - [0,59] 86 * seconds after the minute - [0,59]
87 */ 87 */
88 uInt tm_sec; 88 uInt tm_sec;
89 89
90 /** 90 /**
91 * minutes after the hour - [0,59] 91 * minutes after the hour - [0,59]
92 */ 92 */
93 uInt tm_min; 93 uInt tm_min;
94 94
95 /** 95 /**
96 * hours since midnight - [0,23] 96 * hours since midnight - [0,23]
97 */ 97 */
98 uInt tm_hour; 98 uInt tm_hour;
99 99
100 /** 100 /**
101 * day of the month - [1,31] 101 * day of the month - [1,31]
102 */ 102 */
103 uInt tm_mday; 103 uInt tm_mday;
104 104
105 /** 105 /**
106 * months since January - [0,11] 106 * months since January - [0,11]
107 */ 107 */
108 uInt tm_mon; 108 uInt tm_mon;
109 109
110 /** 110 /**
111 * years - [1980..2044] 111 * years - [1980..2044]
112 */ 112 */
113 uInt tm_year; 113 uInt tm_year;
114}; 114};
115 115
116 116
117/** 117/**
118 * Information about a file in the zipfile 118 * Information about a file in the zipfile
119 */ 119 */
120struct EXTRACTOR_UnzipFileInfo 120struct EXTRACTOR_UnzipFileInfo
121{ 121{
122 /** 122 /**
123 * version made by 2 bytes 123 * version made by 2 bytes
124 */ 124 */
125 uLong version; 125 uLong version;
126 126
127 /** 127 /**
128 * version needed to extract 2 bytes 128 * version needed to extract 2 bytes
129 */ 129 */
130 uLong version_needed; 130 uLong version_needed;
131 131
132 /** 132 /**
133 * general purpose bit flag 2 bytes 133 * general purpose bit flag 2 bytes
134 */ 134 */
135 uLong flag; 135 uLong flag;
136 136
137 /** 137 /**
138 * compression method 2 bytes 138 * compression method 2 bytes
139 */ 139 */
140 uLong compression_method; 140 uLong compression_method;
141 141
142 /** 142 /**
143 * last mod file date in Dos fmt 4 bytes 143 * last mod file date in Dos fmt 4 bytes
144 */ 144 */
145 uLong dosDate; 145 uLong dosDate;
146 146
147 /** 147 /**
148 * crc-32 4 bytes 148 * crc-32 4 bytes
149 */ 149 */
150 uLong crc; 150 uLong crc;
151 151
152 /** 152 /**
153 * compressed size 4 bytes 153 * compressed size 4 bytes
154 */ 154 */
155 uLong compressed_size; 155 uLong compressed_size;
156 156
157 /** 157 /**
158 * uncompressed size 4 bytes 158 * uncompressed size 4 bytes
159 */ 159 */
160 uLong uncompressed_size; 160 uLong uncompressed_size;
161 161
162 /** 162 /**
163 * filename length 2 bytes 163 * filename length 2 bytes
164 */ 164 */
165 uLong size_filename; 165 uLong size_filename;
166 166
167 /** 167 /**
168 * extra field length 2 bytes 168 * extra field length 2 bytes
169 */ 169 */
170 uLong size_file_extra; 170 uLong size_file_extra;
171 171
172 /** 172 /**
173 * file comment length 2 bytes 173 * file comment length 2 bytes
174 */ 174 */
175 uLong size_file_comment; 175 uLong size_file_comment;
176 176
177 /** 177 /**
178 * disk number start 2 bytes 178 * disk number start 2 bytes
179 */ 179 */
180 uLong disk_num_start; 180 uLong disk_num_start;
181 181
182 /** 182 /**
183 * internal file attributes 2 bytes 183 * internal file attributes 2 bytes
184 */ 184 */
185 uLong internal_fa; 185 uLong internal_fa;
186 186
187 /** 187 /**
188 * external file attributes 4 bytes 188 * external file attributes 4 bytes
189 */ 189 */
190 uLong external_fa; 190 uLong external_fa;
191 191
192 /** 192 /**
193 * Time and date of last modification. 193 * Time and date of last modification.
194 */ 194 */
@@ -203,7 +203,7 @@ struct EXTRACTOR_UnzipFileInfo
203 * @param ec extract context to use 203 * @param ec extract context to use
204 * @return handle to zip data, NULL on error 204 * @return handle to zip data, NULL on error
205 */ 205 */
206struct EXTRACTOR_UnzipFile * 206struct EXTRACTOR_UnzipFile *
207EXTRACTOR_common_unzip_open (struct EXTRACTOR_ExtractContext *ec); 207EXTRACTOR_common_unzip_open (struct EXTRACTOR_ExtractContext *ec);
208 208
209 209
@@ -217,15 +217,15 @@ EXTRACTOR_common_unzip_open (struct EXTRACTOR_ExtractContext *ec);
217 */ 217 */
218int 218int
219EXTRACTOR_common_unzip_get_global_comment (struct EXTRACTOR_UnzipFile *file, 219EXTRACTOR_common_unzip_get_global_comment (struct EXTRACTOR_UnzipFile *file,
220 char *comment, 220 char *comment,
221 size_t comment_len); 221 size_t comment_len);
222 222
223 223
224/** 224/**
225 * Close a ZipFile. 225 * Close a ZipFile.
226 * 226 *
227 * @param file zip file to close 227 * @param file zip file to close
228 * @return EXTRACTOR_UNZIP_OK if there is no problem. 228 * @return EXTRACTOR_UNZIP_OK if there is no problem.
229 */ 229 */
230int 230int
231EXTRACTOR_common_unzip_close (struct EXTRACTOR_UnzipFile *file); 231EXTRACTOR_common_unzip_close (struct EXTRACTOR_UnzipFile *file);
@@ -237,7 +237,7 @@ EXTRACTOR_common_unzip_close (struct EXTRACTOR_UnzipFile *file);
237 * @param file zipfile to manipulate 237 * @param file zipfile to manipulate
238 * @return UNZ_OK if there is no problem 238 * @return UNZ_OK if there is no problem
239 */ 239 */
240int 240int
241EXTRACTOR_common_unzip_go_to_first_file (struct EXTRACTOR_UnzipFile *file); 241EXTRACTOR_common_unzip_go_to_first_file (struct EXTRACTOR_UnzipFile *file);
242 242
243 243
@@ -254,7 +254,7 @@ EXTRACTOR_common_unzip_go_to_next_file (struct EXTRACTOR_UnzipFile *file);
254 254
255/** 255/**
256 * Try locate the file szFileName in the zipfile. 256 * Try locate the file szFileName in the zipfile.
257 * 257 *
258 * @param file zipfile to manipulate 258 * @param file zipfile to manipulate
259 * @param szFileName name to find 259 * @param szFileName name to find
260 * @param iCaseSensitivity, use 1 for case sensitivity (like strcmp); 260 * @param iCaseSensitivity, use 1 for case sensitivity (like strcmp);
@@ -264,9 +264,9 @@ EXTRACTOR_common_unzip_go_to_next_file (struct EXTRACTOR_UnzipFile *file);
264 * EXTRACTOR_UNZIP_END_OF_LIST_OF_FILE if the file is not found 264 * EXTRACTOR_UNZIP_END_OF_LIST_OF_FILE if the file is not found
265 */ 265 */
266int 266int
267EXTRACTOR_common_unzip_go_find_local_file (struct EXTRACTOR_UnzipFile *file, 267EXTRACTOR_common_unzip_go_find_local_file (struct EXTRACTOR_UnzipFile *file,
268 const char *szFileName, 268 const char *szFileName,
269 int iCaseSensitivity); 269 int iCaseSensitivity);
270 270
271 271
272/** 272/**
@@ -278,20 +278,21 @@ EXTRACTOR_common_unzip_go_find_local_file (struct EXTRACTOR_UnzipFile *file,
278 * @param szFileName where to write the name of the current file 278 * @param szFileName where to write the name of the current file
279 * @param fileNameBufferSize number of bytes available in szFileName 279 * @param fileNameBufferSize number of bytes available in szFileName
280 * @param extraField where to write extra data 280 * @param extraField where to write extra data
281 * @param extraFieldBufferSize number of bytes available in extraField 281 * @param extraFieldBufferSize number of bytes available in extraField
282 * @param szComment where to write the comment on the current file 282 * @param szComment where to write the comment on the current file
283 * @param commentBufferSize number of bytes available in szComment 283 * @param commentBufferSize number of bytes available in szComment
284 * @return EXTRACTOR_UNZIP_OK if there is no problem. 284 * @return EXTRACTOR_UNZIP_OK if there is no problem.
285 */ 285 */
286int 286int
287EXTRACTOR_common_unzip_get_current_file_info (struct EXTRACTOR_UnzipFile *file, 287EXTRACTOR_common_unzip_get_current_file_info (struct EXTRACTOR_UnzipFile *file,
288 struct EXTRACTOR_UnzipFileInfo *pfile_info, 288 struct EXTRACTOR_UnzipFileInfo *
289 char *szFileName, 289 pfile_info,
290 uLong fileNameBufferSize, 290 char *szFileName,
291 void *extraField, 291 uLong fileNameBufferSize,
292 uLong extraFieldBufferSize, 292 void *extraField,
293 char *szComment, 293 uLong extraFieldBufferSize,
294 uLong commentBufferSize); 294 char *szComment,
295 uLong commentBufferSize);
295 296
296 297
297/** 298/**
@@ -314,10 +315,10 @@ EXTRACTOR_common_unzip_open_current_file (struct EXTRACTOR_UnzipFile *file);
314 * <0 with error code if there is an error 315 * <0 with error code if there is an error
315 * (EXTRACTOR_UNZIP_ERRNO for IO error, or zLib error for uncompress error) 316 * (EXTRACTOR_UNZIP_ERRNO for IO error, or zLib error for uncompress error)
316 */ 317 */
317ssize_t 318ssize_t
318EXTRACTOR_common_unzip_read_current_file (struct EXTRACTOR_UnzipFile *file, 319EXTRACTOR_common_unzip_read_current_file (struct EXTRACTOR_UnzipFile *file,
319 void *buf, 320 void *buf,
320 size_t len); 321 size_t len);
321 322
322 323
323/** 324/**
@@ -325,9 +326,9 @@ EXTRACTOR_common_unzip_read_current_file (struct EXTRACTOR_UnzipFile *file,
325 * 326 *
326 * @return EXTRACTOR_UNZIP_CRCERROR if all the file was read but the CRC is not good 327 * @return EXTRACTOR_UNZIP_CRCERROR if all the file was read but the CRC is not good
327 */ 328 */
328int 329int
329EXTRACTOR_common_unzip_close_current_file (struct EXTRACTOR_UnzipFile *file); 330EXTRACTOR_common_unzip_close_current_file (struct EXTRACTOR_UnzipFile *file);
330 331
331 332
332#endif 333#endif
333/* LE_COMMON_UNZIP_H */ 334/* LE_COMMON_UNZIP_H */