10 // notaz: something's missing this
\r
12 #define UINT32 unsigned int
\r
13 #define UINT16 unsigned short
\r
14 #define UINT8 unsigned char
\r
17 /***************************************************************************
\r
18 * Support for retrieving files from zipfiles
\r
19 ***************************************************************************/
\r
22 UINT32 cent_file_header_sig;
\r
23 UINT8 version_made_by;
\r
25 UINT8 version_needed_to_extract;
\r
26 UINT8 os_needed_to_extract;
\r
27 UINT16 general_purpose_bit_flag;
\r
28 UINT16 compression_method;
\r
29 UINT16 last_mod_file_time;
\r
30 UINT16 last_mod_file_date;
\r
32 UINT32 compressed_size;
\r
33 UINT32 uncompressed_size;
\r
34 UINT16 filename_length;
\r
35 UINT16 extra_field_length;
\r
36 UINT16 file_comment_length;
\r
37 UINT16 disk_number_start;
\r
38 UINT16 internal_file_attrib;
\r
39 UINT32 external_file_attrib;
\r
40 UINT32 offset_lcl_hdr_frm_frst_disk;
\r
41 char* name; /* 0 terminated */
\r
44 typedef struct _ZIP {
\r
45 char* zip; /* zip name */
\r
46 FILE* fp; /* zip handler */
\r
47 long length; /* length of zip file */
\r
49 char* ecd; /* end_of_cent_dir data */
\r
50 unsigned ecd_length; /* end_of_cent_dir length */
\r
52 char* cd; /* cent_dir data */
\r
54 unsigned cd_pos; /* position in cent_dir */
\r
56 struct zipent ent; /* buffer for readzip */
\r
58 /* end_of_cent_dir */
\r
59 UINT32 end_of_cent_dir_sig;
\r
60 UINT16 number_of_this_disk;
\r
61 UINT16 number_of_disk_start_cent_dir;
\r
62 UINT16 total_entries_cent_dir_this_disk;
\r
63 UINT16 total_entries_cent_dir;
\r
64 UINT32 size_of_cent_dir;
\r
65 UINT32 offset_to_start_of_cent_dir;
\r
66 UINT16 zipfile_comment_length;
\r
67 char* zipfile_comment; /* pointer in ecd */
\r
70 /* Opens a zip stream for reading
\r
72 !=0 success, zip stream
\r
75 ZIP* openzip(const char* path);
\r
77 /* Closes a zip stream */
\r
78 void closezip(ZIP* zip);
\r
80 /* Reads the current entry from a zip stream
\r
87 struct zipent* readzip(ZIP* zip);
\r
89 /* Suspend access to a zip file (release file handler)
\r
93 A suspended zip is automatically reopened at first call of
\r
94 readuncompressd() or readcompressed() functions
\r
96 void suspendzip(ZIP* zip);
\r
98 /* Resets a zip stream to the first entry
\r
102 ZIP file must be opened and not suspended
\r
104 void rewindzip(ZIP* zip);
\r
106 /* Read compressed data from a zip entry
\r
111 data buffer for data, ent.compressed_size UINT8s allocated by the caller
\r
116 int readcompresszip(ZIP* zip, struct zipent* ent, char* data);
\r
118 /* Read decompressed data from a zip entry
\r
120 zip zip stream open
\r
123 data buffer for data, ent.uncompressed_size UINT8s allocated by the caller
\r
128 int readuncompresszip(ZIP* zip, struct zipent* ent, char* data);
\r
130 int seekcompresszip(ZIP* zip, struct zipent* ent);
\r
132 /* public functions */
\r
133 int /* error */ load_zipped_file (const char *zipfile, const char *filename,
\r
134 unsigned char **buf, unsigned int *length);
\r
135 int /* error */ checksum_zipped_file (const char *zipfile, const char *filename, unsigned int *length, unsigned int *sum);
\r
137 void unzip_cache_clear(void);
\r
139 /* public globals */
\r
140 extern int gUnzipQuiet; /* flag controls error messages */
\r