11 /***************************************************************************
12 * Support for retrieving files from zipfiles
13 ***************************************************************************/
17 UINT32 cent_file_header_sig;
18 UINT8 version_made_by;
20 UINT8 version_needed_to_extract;
21 UINT8 os_needed_to_extract;
22 UINT16 general_purpose_bit_flag;
23 UINT16 compression_method;
24 UINT16 last_mod_file_time;
25 UINT16 last_mod_file_date;
27 UINT32 compressed_size;
28 UINT32 uncompressed_size;
29 UINT16 filename_length;
30 UINT16 extra_field_length;
31 UINT16 file_comment_length;
32 UINT16 disk_number_start;
33 UINT16 internal_file_attrib;
34 UINT32 external_file_attrib;
35 UINT32 offset_lcl_hdr_frm_frst_disk;
36 char * name; /* 0 terminated */
41 char * zip; /* zip name */
42 FILE * fp; /* zip handler */
43 int pathtype, pathindex; /* additional path info */
44 long length; /* length of zip file */
45 char * ecd; /* end_of_cent_dir data */
46 unsigned ecd_length; /* end_of_cent_dir length */
47 char * cd; /* cent_dir data */
48 unsigned cd_pos; /* position in cent_dir */
49 struct zipent ent; /* buffer for readzip */
51 UINT32 end_of_cent_dir_sig;
52 UINT16 number_of_this_disk;
53 UINT16 number_of_disk_start_cent_dir;
54 UINT16 total_entries_cent_dir_this_disk;
55 UINT16 total_entries_cent_dir;
56 UINT32 size_of_cent_dir;
57 UINT32 offset_to_start_of_cent_dir;
58 UINT16 zipfile_comment_length;
59 char * zipfile_comment; /* pointer in ecd */
62 /* Opens a zip stream for reading
64 !=0 success, zip stream
67 ZIP * openzip(int pathtype, int pathindex, const char * path);
69 /* Closes a zip stream */
70 void closezip(ZIP * zip);
72 /* Reads the current entry from a zip stream
79 struct zipent * readzip(ZIP * zip);
81 /* Suspend access to a zip file (release file handler)
85 A suspended zip is automatically reopened at first call of
86 readuncompressd() or readcompressed() functions
88 void suspendzip(ZIP * zip);
90 /* Resets a zip stream to the first entry
94 ZIP file must be opened and not suspended
96 void rewindzip(ZIP * zip);
98 /* Read compressed data from a zip entry
103 data buffer for data, ent.compressed_size UINT8s allocated by the caller
108 int readcompresszip(ZIP * zip, struct zipent * ent, char * data);
110 /* Read decompressed data from a zip entry
115 data buffer for data, ent.uncompressed_size UINT8s allocated by the caller
120 int readuncompresszip(ZIP * zip, struct zipent * ent, char * data);
122 /* public functions */
123 int /* error */ load_zipped_file(int pathtype, int pathindex, const char * zipfile, const char * filename,
124 unsigned char ** buf, uint32 * length);
126 void unzip_cache_clear(void);
129 extern int gUnzipQuiet; /* flag controls error messages */
135 #endif // __UNZIP_H__