Debian Codegraph @

compat/unzip.c

raw symbols SCIP
1 /* zip.c -- Backwards compatible unzip interface
2 part of the minizip-ng project
3
4 Copyright (C) Nathan Moinvaziri
5 https://github.com/zlib-ng/minizip-ng
6 Copyright (C) 1998-2010 Gilles Vollant
7 https://www.winimage.com/zLibDll/minizip.html
8
9 This program is distributed under the terms of the same license as zlib.
10 See the accompanying LICENSE file for the full text of the license.
11 */
12
13 #include "mz.h"cxx . . $ `<file>/mz.h`/
14 #include "mz_os.h"cxx . . $ `<file>/mz_os.h`/
15 #include "mz_strm.h"cxx . . $ `<file>/mz_strm.h`/
16 #include "mz_strm_os.h"cxx . . $ `<file>/mz_strm_os.h`/
17 #include "mz_zip.h"cxx . . $ `<file>/mz_zip.h`/
18
19 #include <stdio.h> /* SEEK */
20
21 #include "unzip.h"cxx . . $ `<file>/compat/unzip.h`/
22
23 /***************************************************************************/
24
25 typedef struct mz_unzip_compat_scxx . . $ mz_unzip_compat_s# {
26 void *streamcxx . . $ mz_unzip_compat_s#stream.;
27 void *handlecxx . . $ mz_unzip_compat_s#handle.;
28 uint64_tcxx . . $ uint64_t# entry_indexcxx . . $ mz_unzip_compat_s#entry_index.;
29 int64_tcxx . . $ int64_t# entry_poscxx . . $ mz_unzip_compat_s#entry_pos.;
30 int64_tcxx . . $ int64_t# total_outcxx . . $ mz_unzip_compat_s#total_out.;
31 } mz_unzip_compatcxx . . $ mz_unzip_compat#;
32
33 /***************************************************************************/
34
35 unzFilecxx . . $ unzFile# unzOpencxx . . $ unzOpen(42228c1987407501).(const char *path) {
36 return unzOpen64cxx . . $ unzOpen64(3343d82129b43479).(path);
37 }
38
39 unzFilecxx . . $ unzFile# unzOpen64cxx . . $ unzOpen64(3343d82129b43479).(const void *path) {
40 return unzOpen2cxx . . $ unzOpen2(9ed7ea5cbd602b00).(path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
41 }
42
43 unzFilecxx . . $ unzFile# unzOpen2cxx . . $ unzOpen2(9ed7ea5cbd602b00).(const char *path, zlib_filefunc_defcxx . . $ zlib_filefunc_def# *pzlib_filefunc_def) {
44 unzFilecxx . . $ unzFile# unz = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
45 void *stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
46
47 if (pzlib_filefunc_def) {
48 if (pzlib_filefunc_def->zopen_filecxx . . $ zlib_filefunc_def_s#zopen_file.) {
49 stream = mz_stream_ioapi_createcxx . . $ mz_stream_ioapi_create(50c7df7de5344ebb).();
50 if (!stream)
51 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
52 mz_stream_ioapi_set_filefunccxx . . $ mz_stream_ioapi_set_filefunc(c7baa3b6b19787c2).(stream, pzlib_filefunc_def);
53 } else if (pzlib_filefunc_def->opaquecxx . . $ zlib_filefunc_def_s#opaque.) {
54 stream = mz_stream_createcxx . . $ mz_stream_create(f660b63577525b91).((mz_stream_vtblcxx . . $ mz_stream_vtbl# *)pzlib_filefunc_def->opaquecxx . . $ zlib_filefunc_def_s#opaque.);
55 if (!stream)
56 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
57 }
58 }
59
60 if (!stream) {
61 stream = mz_stream_os_createcxx . . $ mz_stream_os_create(50c7df7de5344ebb).();
62 if (!stream)
63 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
64 }
65
66 if (mz_stream_opencxx . . $ mz_stream_open(7083a8984c0735e8).(stream, path, MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`!) != MZ_OKcxx . . $ `mz.h:21:9`!) {
67 mz_stream_deletecxx . . $ mz_stream_delete(539e082cf00e1f43).(&stream);
68 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
69 }
70
71 unz = unzOpen_MZcxx . . $ unzOpen_MZ(9f162e79bfc6c74).(stream);
72 if (!unz) {
73 mz_stream_closecxx . . $ mz_stream_close(dedf1e9b1c614a07).(stream);
74 mz_stream_deletecxx . . $ mz_stream_delete(539e082cf00e1f43).(&stream);
75 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
76 }
77 return unz;
78 }
79
80 unzFilecxx . . $ unzFile# unzOpen2_64cxx . . $ unzOpen2_64(259836ebea66a013).(const void *path, zlib_filefunc64_defcxx . . $ zlib_filefunc64_def# *pzlib_filefunc_def) {
81 unzFilecxx . . $ unzFile# unz = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
82 void *stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
83
84 if (pzlib_filefunc_def) {
85 if (pzlib_filefunc_def->zopen64_filecxx . . $ zlib_filefunc64_def_s#zopen64_file.) {
86 stream = mz_stream_ioapi_createcxx . . $ mz_stream_ioapi_create(50c7df7de5344ebb).();
87 if (!stream)
88 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
89 mz_stream_ioapi_set_filefunc64cxx . . $ mz_stream_ioapi_set_filefunc64(ca0c56fe0832fb26).(stream, pzlib_filefunc_def);
90 } else if (pzlib_filefunc_def->opaquecxx . . $ zlib_filefunc64_def_s#opaque.) {
91 stream = mz_stream_createcxx . . $ mz_stream_create(f660b63577525b91).((mz_stream_vtblcxx . . $ mz_stream_vtbl# *)pzlib_filefunc_def->opaquecxx . . $ zlib_filefunc64_def_s#opaque.);
92 if (!stream)
93 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
94 }
95 }
96
97 if (!stream) {
98 stream = mz_stream_os_createcxx . . $ mz_stream_os_create(50c7df7de5344ebb).();
99 if (!stream)
100 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
101 }
102
103 if (mz_stream_opencxx . . $ mz_stream_open(7083a8984c0735e8).(stream, path, MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`!) != MZ_OKcxx . . $ `mz.h:21:9`!) {
104 mz_stream_deletecxx . . $ mz_stream_delete(539e082cf00e1f43).(&stream);
105 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
106 }
107
108 unz = unzOpen_MZcxx . . $ unzOpen_MZ(9f162e79bfc6c74).(stream);
109 if (!unz) {
110 mz_stream_closecxx . . $ mz_stream_close(dedf1e9b1c614a07).(stream);
111 mz_stream_deletecxx . . $ mz_stream_delete(539e082cf00e1f43).(&stream);
112 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
113 }
114 return unz;
115 }
116
117 void *unzGetHandle_MZcxx . . $ unzGetHandle_MZ(9f162e79bfc6c74).(unzFilecxx . . $ unzFile# file) {
118 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
119 if (!compat)
120 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
121 return compat->handlecxx . . $ mz_unzip_compat_s#handle.;
122 }
123
124 void *unzGetStream_MZcxx . . $ unzGetStream_MZ(9f162e79bfc6c74).(unzFilecxx . . $ unzFile# file) {
125 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
126 if (!compat)
127 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
128 return compat->streamcxx . . $ mz_unzip_compat_s#stream.;
129 }
130
131 unzFilecxx . . $ unzFile# unzOpen_MZcxx . . $ unzOpen_MZ(9f162e79bfc6c74).(void *stream) {
132 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
133 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
134 void *handle = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
135
136 handle = mz_zip_createcxx . . $ mz_zip_create(50c7df7de5344ebb).();
137 if (!handle)
138 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
139
140 mz_zip_set_recovercxx . . $ mz_zip_set_recover(5276b51c10b71c09).(handle, 1);
141
142 err = mz_zip_opencxx . . $ mz_zip_open(8bc41909eac9e5d8).(handle, stream, MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`!);
143 if (err != MZ_OKcxx . . $ `mz.h:21:9`!) {
144 mz_zip_deletecxx . . $ mz_zip_delete(539e082cf00e1f43).(&handle);
145 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
146 }
147
148 compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(mz_unzip_compatcxx . . $ mz_unzip_compat#));
149 if (compat) {
150 compat->handlecxx . . $ mz_unzip_compat_s#handle. = handle;
151 compat->streamcxx . . $ mz_unzip_compat_s#stream. = stream;
152
153 mz_zip_goto_first_entrycxx . . $ mz_zip_goto_first_entry(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
154 } else {
155 mz_zip_deletecxx . . $ mz_zip_delete(539e082cf00e1f43).(&handle);
156 }
157
158 return (unzFilecxx . . $ unzFile#)compat;
159 }
160
161 int unzClosecxx . . $ unzClose(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
162 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
163 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
164
165 if (!compat)
166 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
167
168 if (compat->handlecxx . . $ mz_unzip_compat_s#handle.)
169 err = unzClose_MZcxx . . $ unzClose_MZ(dedf1e9b1c614a07).(file);
170
171 if (compat->streamcxx . . $ mz_unzip_compat_s#stream.) {
172 mz_stream_closecxx . . $ mz_stream_close(dedf1e9b1c614a07).(compat->streamcxx . . $ mz_unzip_compat_s#stream.);
173 mz_stream_deletecxx . . $ mz_stream_delete(539e082cf00e1f43).(&compat->streamcxx . . $ mz_unzip_compat_s#stream.);
174 }
175
176 freecxx . . $ free(5d22bdacc48458e8).(compat);
177
178 return err;
179 }
180
181 /* Only closes the zip handle, does not close the stream */
182 int unzClose_MZcxx . . $ unzClose_MZ(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
183 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
184 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
185
186 if (!compat)
187 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
188
189 err = mz_zip_closecxx . . $ mz_zip_close(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
190 mz_zip_deletecxx . . $ mz_zip_delete(539e082cf00e1f43).(&compat->handlecxx . . $ mz_unzip_compat_s#handle.);
191
192 return err;
193 }
194
195 int unzGetGlobalInfocxx . . $ unzGetGlobalInfo(b3cbc121def653f6).(unzFilecxx . . $ unzFile# file, unz_global_infocxx . . $ unz_global_info# *pglobal_info32) {
196 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
197 unz_global_info64cxx . . $ unz_global_info64# global_info64;
198 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
199
200 memsetcxx . . $ memset(d1de1e4fb215f1c6).(pglobal_info32, 0, sizeof(unz_global_infocxx . . $ unz_global_info#));
201 if (!compat)
202 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
203
204 err = unzGetGlobalInfo64cxx . . $ unzGetGlobalInfo64(5b73c380ee4011c3).(file, &global_info64);
205 if (err == MZ_OKcxx . . $ `mz.h:21:9`!) {
206 pglobal_info32->number_entrycxx . . $ unz_global_info_s#number_entry. = (uint32_tcxx . . $ uint32_t#)global_info64.number_entrycxx . . $ unz_global_info64_s#number_entry.;
207 pglobal_info32->size_commentcxx . . $ unz_global_info_s#size_comment. = global_info64.size_commentcxx . . $ unz_global_info64_s#size_comment.;
208 pglobal_info32->number_disk_with_CDcxx . . $ unz_global_info_s#number_disk_with_CD. = global_info64.number_disk_with_CDcxx . . $ unz_global_info64_s#number_disk_with_CD.;
209 }
210 return err;
211 }
212
213 int unzGetGlobalInfo64cxx . . $ unzGetGlobalInfo64(5b73c380ee4011c3).(unzFilecxx . . $ unzFile# file, unz_global_info64cxx . . $ unz_global_info64# *pglobal_info) {
214 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
215 const char *comment_ptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
216 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
217
218 memsetcxx . . $ memset(d1de1e4fb215f1c6).(pglobal_info, 0, sizeof(unz_global_info64cxx . . $ unz_global_info64#));
219 if (!compat)
220 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
221 err = mz_zip_get_commentcxx . . $ mz_zip_get_comment(1160c33587cf46c5).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &comment_ptr);
222 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
223 pglobal_info->size_commentcxx . . $ unz_global_info64_s#size_comment. = (uint16_tcxx . . $ uint16_t#)strlencxx . . $ strlen(751346f8406fd082).(comment_ptr);
224 if ((err == MZ_OKcxx . . $ `mz.h:21:9`!) || (err == MZ_EXIST_ERRORcxx . . $ `mz.h:36:9`!))
225 err = mz_zip_get_number_entrycxx . . $ mz_zip_get_number_entry(17c9a57913c314f0).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &pglobal_info->number_entrycxx . . $ unz_global_info64_s#number_entry.);
226 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
227 err = mz_zip_get_disk_number_with_cdcxx . . $ mz_zip_get_disk_number_with_cd(3569d74970a1d1f9).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &pglobal_info->number_disk_with_CDcxx . . $ unz_global_info64_s#number_disk_with_CD.);
228 return err;
229 }
230
231 int unzGetGlobalCommentcxx . . $ unzGetGlobalComment(ca250401d2a07b03).(unzFilecxx . . $ unzFile# file, char *comment, unsigned long comment_size) {
232 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
233 const char *comment_ptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
234 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
235
236 if (!comment || !comment_size)
237 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
238 err = mz_zip_get_commentcxx . . $ mz_zip_get_comment(1160c33587cf46c5).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &comment_ptr);
239 if (err == MZ_OKcxx . . $ `mz.h:21:9`!) {
240 strncpycxx . . $ strncpy(255158a415b673b0).(comment, comment_ptr, comment_size - 1);
241 comment[comment_size - 1] = 0;
242 }
243 return err;
244 }
245
246 int unzOpenCurrentFile3cxx . . $ unzOpenCurrentFile3(6db33bb1c5970ef1).(unzFilecxx . . $ unzFile# file, int *method, int *level, int raw, const char *password) {
247 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
248 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
249 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
250 void *stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
251
252 if (!compat)
253 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
254 if (method)
255 *method = 0;
256 if (level)
257 *level = 0;
258
259 if (mz_zip_entry_is_opencxx . . $ mz_zip_entry_is_open(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.) == MZ_OKcxx . . $ `mz.h:21:9`!) {
260 /* zlib minizip does not error out here if close returns errors */
261 unzCloseCurrentFilecxx . . $ unzCloseCurrentFile(dedf1e9b1c614a07).(file);
262 }
263
264 compat->total_outcxx . . $ mz_unzip_compat_s#total_out. = 0;
265 err = mz_zip_entry_read_opencxx . . $ mz_zip_entry_read_open(5e2f72b4b9a4e6c4).(compat->handlecxx . . $ mz_unzip_compat_s#handle., (uint8_tcxx . . $ uint8_t#)raw, password);
266 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
267 err = mz_zip_entry_get_infocxx . . $ mz_zip_entry_get_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
268 if (err == MZ_OKcxx . . $ `mz.h:21:9`!) {
269 if (method) {
270 *method = file_info->compression_methodcxx . . $ mz_zip_file_s#compression_method.;
271 }
272
273 if (level) {
274 *level = 6;
275 switch (file_info->flagcxx . . $ mz_zip_file_s#flag. & 0x06) {
276 case MZ_ZIP_FLAG_DEFLATE_SUPER_FASTcxx . . $ `mz.h:82:9`!:
277 *level = 1;
278 break;
279 case MZ_ZIP_FLAG_DEFLATE_FASTcxx . . $ `mz.h:81:9`!:
280 *level = 2;
281 break;
282 case MZ_ZIP_FLAG_DEFLATE_MAXcxx . . $ `mz.h:79:9`!:
283 *level = 9;
284 break;
285 }
286 }
287 }
288 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
289 err = mz_zip_get_streamcxx . . $ mz_zip_get_stream(1843ed636859e0d0).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &stream);
290 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
291 compat->entry_poscxx . . $ mz_unzip_compat_s#entry_pos. = mz_stream_tellcxx . . $ mz_stream_tell(72c1818a5177f981).(stream);
292 return err;
293 }
294
295 int unzOpenCurrentFilecxx . . $ unzOpenCurrentFile(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
296 return unzOpenCurrentFile3cxx . . $ unzOpenCurrentFile3(6db33bb1c5970ef1).(file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
297 }
298
299 int unzOpenCurrentFilePasswordcxx . . $ unzOpenCurrentFilePassword(f53b6be6549e6d95).(unzFilecxx . . $ unzFile# file, const char *password) {
300 return unzOpenCurrentFile3cxx . . $ unzOpenCurrentFile3(6db33bb1c5970ef1).(file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, password);
301 }
302
303 int unzOpenCurrentFile2cxx . . $ unzOpenCurrentFile2(89ca22876955cdfe).(unzFilecxx . . $ unzFile# file, int *method, int *level, int raw) {
304 return unzOpenCurrentFile3cxx . . $ unzOpenCurrentFile3(6db33bb1c5970ef1).(file, method, level, raw, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
305 }
306
307 int unzReadCurrentFilecxx . . $ unzReadCurrentFile(42dc92c764946a43).(unzFilecxx . . $ unzFile# file, void *buf, uint32_tcxx . . $ uint32_t# len) {
308 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
309 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
310 if (!compat || len >= INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`!)
311 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
312 err = mz_zip_entry_readcxx . . $ mz_zip_entry_read(8bc41909eac9e5d8).(compat->handlecxx . . $ mz_unzip_compat_s#handle., buf, (int32_tcxx . . $ int32_t#)len);
313 if (err > 0)
314 compat->total_outcxx . . $ mz_unzip_compat_s#total_out. += (uint32_tcxx . . $ uint32_t#)err;
315 return err;
316 }
317
318 int unzCloseCurrentFilecxx . . $ unzCloseCurrentFile(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
319 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
320 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
321 if (!compat)
322 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
323 err = mz_zip_entry_closecxx . . $ mz_zip_entry_close(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
324 return err;
325 }
326
327 static void unzConvertTimeToUnzTimecxx . . $ unzConvertTimeToUnzTime(8a627fc615c879a0).(time_tcxx . . $ time_t# time, tm_unzcxx . . $ tm_unz# *tmu_date) {
328 struct tmcxx . . $ tm# tm_date;
329 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&tm_date, 0, sizeof(struct tmcxx . . $ tm#));
330 mz_zip_time_t_to_tmcxx . . $ mz_zip_time_t_to_tm(ec51dbf3953610a8).(time, &tm_date);
331 memcpycxx . . $ memcpy(cc817cb175f282d).(tmu_date, &tm_date, sizeof(tm_unzcxx . . $ tm_unz#));
332 tmu_date->tm_yearcxx . . $ tm_unz_s#tm_year. += 1900;
333 }
334
335 int unzGetCurrentFileInfocxx . . $ unzGetCurrentFileInfo(b19de73933e57c3d).(unzFilecxx . . $ unzFile# file, unz_file_infocxx . . $ unz_file_info# *pfile_info, char *filename, unsigned long filename_size,
336 void *extrafield, unsigned long extrafield_size, char *comment, unsigned long comment_size) {
337 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
338 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
339 uint16_tcxx . . $ uint16_t# bytes_to_copy = 0;
340 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
341
342 if (!compat)
343 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
344
345 err = mz_zip_entry_get_infocxx . . $ mz_zip_entry_get_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
346 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
347 return err;
348
349 if (pfile_info) {
350 pfile_info->versioncxx . . $ unz_file_info_s#version. = file_info->version_madebycxx . . $ mz_zip_file_s#version_madeby.;
351 pfile_info->version_neededcxx . . $ unz_file_info_s#version_needed. = file_info->version_neededcxx . . $ mz_zip_file_s#version_needed.;
352 pfile_info->flagcxx . . $ unz_file_info_s#flag. = file_info->flagcxx . . $ mz_zip_file_s#flag.;
353 pfile_info->compression_methodcxx . . $ unz_file_info_s#compression_method. = file_info->compression_methodcxx . . $ mz_zip_file_s#compression_method.;
354 pfile_info->mz_dos_datecxx . . $ `compat/unzip.h:73:11`! = mz_zip_time_t_to_dos_datecxx . . $ mz_zip_time_t_to_dos_date(bd267e0bd5a0c68b).(file_info->modified_datecxx . . $ mz_zip_file_s#modified_date.);
355 unzConvertTimeToUnzTimecxx . . $ unzConvertTimeToUnzTime(8a627fc615c879a0).(file_info->modified_datecxx . . $ mz_zip_file_s#modified_date., &pfile_info->tmu_datecxx . . $ unz_file_info_s#tmu_date.);
356 pfile_info->crccxx . . $ unz_file_info_s#crc. = file_info->crccxx . . $ mz_zip_file_s#crc.;
357
358 pfile_info->size_filenamecxx . . $ unz_file_info_s#size_filename. = file_info->filename_sizecxx . . $ mz_zip_file_s#filename_size.;
359 pfile_info->size_file_extracxx . . $ unz_file_info_s#size_file_extra. = file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.;
360 pfile_info->size_file_commentcxx . . $ unz_file_info_s#size_file_comment. = file_info->comment_sizecxx . . $ mz_zip_file_s#comment_size.;
361
362 pfile_info->disk_num_startcxx . . $ unz_file_info_s#disk_num_start. = (uint16_tcxx . . $ uint16_t#)file_info->disk_numbercxx . . $ mz_zip_file_s#disk_number.;
363 pfile_info->internal_facxx . . $ unz_file_info_s#internal_fa. = file_info->internal_facxx . . $ mz_zip_file_s#internal_fa.;
364 pfile_info->external_facxx . . $ unz_file_info_s#external_fa. = file_info->external_facxx . . $ mz_zip_file_s#external_fa.;
365
366 pfile_info->compressed_sizecxx . . $ unz_file_info_s#compressed_size. = (uint32_tcxx . . $ uint32_t#)file_info->compressed_sizecxx . . $ mz_zip_file_s#compressed_size.;
367 pfile_info->uncompressed_sizecxx . . $ unz_file_info_s#uncompressed_size. = (uint32_tcxx . . $ uint32_t#)file_info->uncompressed_sizecxx . . $ mz_zip_file_s#uncompressed_size.;
368 }
369 if (filename_size > 0 && filename && file_info->filenamecxx . . $ mz_zip_file_s#filename.) {
370 bytes_to_copy = (uint16_tcxx . . $ uint16_t#)filename_size;
371 if (bytes_to_copy > file_info->filename_sizecxx . . $ mz_zip_file_s#filename_size.)
372 bytes_to_copy = file_info->filename_sizecxx . . $ mz_zip_file_s#filename_size.;
373 memcpycxx . . $ memcpy(cc817cb175f282d).(filename, file_info->filenamecxx . . $ mz_zip_file_s#filename., bytes_to_copy);
374 if (bytes_to_copy < filename_size)
375 filename[bytes_to_copy] = 0;
376 }
377 if (extrafield_size > 0 && extrafield) {
378 bytes_to_copy = (uint16_tcxx . . $ uint16_t#)extrafield_size;
379 if (bytes_to_copy > file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.)
380 bytes_to_copy = file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.;
381 memcpycxx . . $ memcpy(cc817cb175f282d).(extrafield, file_info->extrafieldcxx . . $ mz_zip_file_s#extrafield., bytes_to_copy);
382 }
383 if (comment_size > 0 && comment && file_info->commentcxx . . $ mz_zip_file_s#comment.) {
384 bytes_to_copy = (uint16_tcxx . . $ uint16_t#)comment_size;
385 if (bytes_to_copy > file_info->comment_sizecxx . . $ mz_zip_file_s#comment_size.)
386 bytes_to_copy = file_info->comment_sizecxx . . $ mz_zip_file_s#comment_size.;
387 memcpycxx . . $ memcpy(cc817cb175f282d).(comment, file_info->commentcxx . . $ mz_zip_file_s#comment., bytes_to_copy);
388 if (bytes_to_copy < comment_size)
389 comment[bytes_to_copy] = 0;
390 }
391 return err;
392 }
393
394 int unzGetCurrentFileInfo64cxx . . $ unzGetCurrentFileInfo64(26688c4c454be285).(unzFilecxx . . $ unzFile# file, unz_file_info64cxx . . $ unz_file_info64# *pfile_info, char *filename, unsigned long filename_size,
395 void *extrafield, unsigned long extrafield_size, char *comment,
396 unsigned long comment_size) {
397 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
398 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
399 uint16_tcxx . . $ uint16_t# bytes_to_copy = 0;
400 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
401
402 if (!compat)
403 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
404
405 err = mz_zip_entry_get_infocxx . . $ mz_zip_entry_get_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
406 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
407 return err;
408
409 if (pfile_info) {
410 pfile_info->versioncxx . . $ unz_file_info64_s#version. = file_info->version_madebycxx . . $ mz_zip_file_s#version_madeby.;
411 pfile_info->version_neededcxx . . $ unz_file_info64_s#version_needed. = file_info->version_neededcxx . . $ mz_zip_file_s#version_needed.;
412 pfile_info->flagcxx . . $ unz_file_info64_s#flag. = file_info->flagcxx . . $ mz_zip_file_s#flag.;
413 pfile_info->compression_methodcxx . . $ unz_file_info64_s#compression_method. = file_info->compression_methodcxx . . $ mz_zip_file_s#compression_method.;
414 pfile_info->mz_dos_datecxx . . $ `compat/unzip.h:73:11`! = mz_zip_time_t_to_dos_datecxx . . $ mz_zip_time_t_to_dos_date(bd267e0bd5a0c68b).(file_info->modified_datecxx . . $ mz_zip_file_s#modified_date.);
415 unzConvertTimeToUnzTimecxx . . $ unzConvertTimeToUnzTime(8a627fc615c879a0).(file_info->modified_datecxx . . $ mz_zip_file_s#modified_date., &pfile_info->tmu_datecxx . . $ unz_file_info64_s#tmu_date.);
416 pfile_info->crccxx . . $ unz_file_info64_s#crc. = file_info->crccxx . . $ mz_zip_file_s#crc.;
417
418 pfile_info->size_filenamecxx . . $ unz_file_info64_s#size_filename. = file_info->filename_sizecxx . . $ mz_zip_file_s#filename_size.;
419 pfile_info->size_file_extracxx . . $ unz_file_info64_s#size_file_extra. = file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.;
420 pfile_info->size_file_commentcxx . . $ unz_file_info64_s#size_file_comment. = file_info->comment_sizecxx . . $ mz_zip_file_s#comment_size.;
421
422 pfile_info->disk_num_startcxx . . $ unz_file_info64_s#disk_num_start. = file_info->disk_numbercxx . . $ mz_zip_file_s#disk_number.;
423 pfile_info->internal_facxx . . $ unz_file_info64_s#internal_fa. = file_info->internal_facxx . . $ mz_zip_file_s#internal_fa.;
424 pfile_info->external_facxx . . $ unz_file_info64_s#external_fa. = file_info->external_facxx . . $ mz_zip_file_s#external_fa.;
425
426 pfile_info->compressed_sizecxx . . $ unz_file_info64_s#compressed_size. = (uint64_tcxx . . $ uint64_t#)file_info->compressed_sizecxx . . $ mz_zip_file_s#compressed_size.;
427 pfile_info->uncompressed_sizecxx . . $ unz_file_info64_s#uncompressed_size. = (uint64_tcxx . . $ uint64_t#)file_info->uncompressed_sizecxx . . $ mz_zip_file_s#uncompressed_size.;
428 }
429 if (filename_size > 0 && filename && file_info->filenamecxx . . $ mz_zip_file_s#filename.) {
430 bytes_to_copy = (uint16_tcxx . . $ uint16_t#)filename_size;
431 if (bytes_to_copy > file_info->filename_sizecxx . . $ mz_zip_file_s#filename_size.)
432 bytes_to_copy = file_info->filename_sizecxx . . $ mz_zip_file_s#filename_size.;
433 memcpycxx . . $ memcpy(cc817cb175f282d).(filename, file_info->filenamecxx . . $ mz_zip_file_s#filename., bytes_to_copy);
434 if (bytes_to_copy < filename_size)
435 filename[bytes_to_copy] = 0;
436 }
437 if (extrafield_size > 0 && extrafield) {
438 bytes_to_copy = (uint16_tcxx . . $ uint16_t#)extrafield_size;
439 if (bytes_to_copy > file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.)
440 bytes_to_copy = file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.;
441 memcpycxx . . $ memcpy(cc817cb175f282d).(extrafield, file_info->extrafieldcxx . . $ mz_zip_file_s#extrafield., bytes_to_copy);
442 }
443 if (comment_size > 0 && comment && file_info->commentcxx . . $ mz_zip_file_s#comment.) {
444 bytes_to_copy = (uint16_tcxx . . $ uint16_t#)comment_size;
445 if (bytes_to_copy > file_info->comment_sizecxx . . $ mz_zip_file_s#comment_size.)
446 bytes_to_copy = file_info->comment_sizecxx . . $ mz_zip_file_s#comment_size.;
447 memcpycxx . . $ memcpy(cc817cb175f282d).(comment, file_info->commentcxx . . $ mz_zip_file_s#comment., bytes_to_copy);
448 if (bytes_to_copy < comment_size)
449 comment[bytes_to_copy] = 0;
450 }
451 return err;
452 }
453
454 int unzGoToFirstFilecxx . . $ unzGoToFirstFile(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
455 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
456 if (!compat)
457 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
458 compat->entry_indexcxx . . $ mz_unzip_compat_s#entry_index. = 0;
459 return mz_zip_goto_first_entrycxx . . $ mz_zip_goto_first_entry(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
460 }
461
462 int unzGoToNextFilecxx . . $ unzGoToNextFile(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
463 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
464 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
465 if (!compat)
466 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
467 err = mz_zip_goto_next_entrycxx . . $ mz_zip_goto_next_entry(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
468 if (err != MZ_END_OF_LISTcxx . . $ `mz.h:28:9`!)
469 compat->entry_indexcxx . . $ mz_unzip_compat_s#entry_index. += 1;
470 return err;
471 }
472
473 #if !defined(MZ_COMPAT_VERSION) || MZ_COMPAT_VERSION < 110
474 # ifdef WIN32
475 # define UNZ_DEFAULT_IGNORE_CASE 1
476 # else
477 # define UNZ_DEFAULT_IGNORE_CASEcxx . . $ `compat/unzip.c:477:13`! 0
478 # endif
479
480 int unzLocateFilecxx . . $ unzLocateFile(7083a8984c0735e8).(unzFilecxx . . $ unzFile# file, const char *filename, unzFileNameCasecxx . . $ unzFileNameCase# filename_case) {
481 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
482 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
483 uint64_tcxx . . $ uint64_t# preserve_index = 0;
484 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
485 int32_tcxx . . $ int32_t# result = 0;
486 uint8_tcxx . . $ uint8_t# ignore_case = UNZ_DEFAULT_IGNORE_CASEcxx . . $ `compat/unzip.c:477:13`!;
487
488 if (!compat)
489 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
490
491 if (filename_case == 1) {
492 ignore_case = 0;
493 } else if (filename_case > 1) {
494 ignore_case = 1;
495 }
496
497 preserve_index = compat->entry_indexcxx . . $ mz_unzip_compat_s#entry_index.;
498
499 err = mz_zip_goto_first_entrycxx . . $ mz_zip_goto_first_entry(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
500 while (err == MZ_OKcxx . . $ `mz.h:21:9`!) {
501 err = mz_zip_entry_get_infocxx . . $ mz_zip_entry_get_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
502 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
503 break;
504
505 result = mz_path_compare_wccxx . . $ mz_path_compare_wc(6dbe66b8d729cbab).(filename, file_info->filenamecxx . . $ mz_zip_file_s#filename., !ignore_case);
506
507 if (result == 0)
508 return MZ_OKcxx . . $ `mz.h:21:9`!;
509
510 err = mz_zip_goto_next_entrycxx . . $ mz_zip_goto_next_entry(dedf1e9b1c614a07).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
511 }
512
513 compat->entry_indexcxx . . $ mz_unzip_compat_s#entry_index. = preserve_index;
514 return err;
515 }
516 #else
517 int unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func) {
518 mz_unzip_compat *compat = (mz_unzip_compat *)file;
519 mz_zip_file *file_info = NULL;
520 uint64_t preserve_index = 0;
521 int32_t err = MZ_OK;
522 int32_t result = 0;
523
524 if (!compat)
525 return UNZ_PARAMERROR;
526
527 preserve_index = compat->entry_index;
528
529 err = mz_zip_goto_first_entry(compat->handle);
530 while (err == MZ_OK) {
531 err = mz_zip_entry_get_info(compat->handle, &file_info);
532 if (err != MZ_OK)
533 break;
534
535 if ((intptr_t)filename_compare_func > 2) {
536 result = filename_compare_func(file, filename, file_info->filename);
537 } else {
538 int32_t case_sensitive = (int32_t)(intptr_t)filename_compare_func;
539 result = mz_path_compare_wc(filename, file_info->filename, !case_sensitive);
540 }
541
542 if (result == 0)
543 return MZ_OK;
544
545 err = mz_zip_goto_next_entry(compat->handle);
546 }
547
548 compat->entry_index = preserve_index;
549 return err;
550 }
551 #endif
552
553 /***************************************************************************/
554
555 int unzGetFilePoscxx . . $ unzGetFilePos(7e2c4081d2cf8a08).(unzFilecxx . . $ unzFile# file, unz_file_poscxx . . $ unz_file_pos# *file_pos) {
556 unz64_file_poscxx . . $ unz64_file_pos# file_pos64;
557 int32_tcxx . . $ int32_t# err = 0;
558
559 err = unzGetFilePos64cxx . . $ unzGetFilePos64(5d59764c884c9bea).(file, &file_pos64);
560 if (err < 0)
561 return err;
562
563 file_pos->pos_in_zip_directorycxx . . $ unz_file_pos_s#pos_in_zip_directory. = (uint32_tcxx . . $ uint32_t#)file_pos64.pos_in_zip_directorycxx . . $ unz64_file_pos_s#pos_in_zip_directory.;
564 file_pos->num_of_filecxx . . $ unz_file_pos_s#num_of_file. = (uint32_tcxx . . $ uint32_t#)file_pos64.num_of_filecxx . . $ unz64_file_pos_s#num_of_file.;
565 return err;
566 }
567
568 int unzGoToFilePoscxx . . $ unzGoToFilePos(7e2c4081d2cf8a08).(unzFilecxx . . $ unzFile# file, unz_file_poscxx . . $ unz_file_pos# *file_pos) {
569 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
570 unz64_file_poscxx . . $ unz64_file_pos# file_pos64;
571
572 if (!compat || !file_pos)
573 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
574
575 file_pos64.pos_in_zip_directorycxx . . $ unz64_file_pos_s#pos_in_zip_directory. = file_pos->pos_in_zip_directorycxx . . $ unz_file_pos_s#pos_in_zip_directory.;
576 file_pos64.num_of_filecxx . . $ unz64_file_pos_s#num_of_file. = file_pos->num_of_filecxx . . $ unz_file_pos_s#num_of_file.;
577
578 return unzGoToFilePos64cxx . . $ unzGoToFilePos64(38c571ddddfa45d3).(file, &file_pos64);
579 }
580
581 int unzGetFilePos64cxx . . $ unzGetFilePos64(5d59764c884c9bea).(unzFilecxx . . $ unzFile# file, unz64_file_poscxx . . $ unz64_file_pos# *file_pos) {
582 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
583 int64_tcxx . . $ int64_t# offset = 0;
584
585 if (!compat || !file_pos)
586 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
587
588 offset = unzGetOffset64cxx . . $ unzGetOffset64(72c1818a5177f981).(file);
589 if (offset < 0)
590 return (int)offset;
591
592 file_pos->pos_in_zip_directorycxx . . $ unz64_file_pos_s#pos_in_zip_directory. = offset;
593 file_pos->num_of_filecxx . . $ unz64_file_pos_s#num_of_file. = compat->entry_indexcxx . . $ mz_unzip_compat_s#entry_index.;
594 return UNZ_OKcxx . . $ `compat/unzip.h:49:9`!;
595 }
596
597 int unzGoToFilePos64cxx . . $ unzGoToFilePos64(38c571ddddfa45d3).(unzFilecxx . . $ unzFile# file, const unz64_file_poscxx . . $ unz64_file_pos# *file_pos) {
598 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
599 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
600
601 if (!compat || !file_pos)
602 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
603
604 err = mz_zip_goto_entrycxx . . $ mz_zip_goto_entry(6b20ed9d0f5b4b14).(compat->handlecxx . . $ mz_unzip_compat_s#handle., file_pos->pos_in_zip_directorycxx . . $ unz64_file_pos_s#pos_in_zip_directory.);
605 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
606 compat->entry_indexcxx . . $ mz_unzip_compat_s#entry_index. = file_pos->num_of_filecxx . . $ unz64_file_pos_s#num_of_file.;
607 return err;
608 }
609
610 unsigned long unzGetOffsetcxx . . $ unzGetOffset(751e5d26f8574c32).(unzFilecxx . . $ unzFile# file) {
611 return (uint32_tcxx . . $ uint32_t#)unzGetOffset64cxx . . $ unzGetOffset64(72c1818a5177f981).(file);
612 }
613
614 int64_tcxx . . $ int64_t# unzGetOffset64cxx . . $ unzGetOffset64(72c1818a5177f981).(unzFilecxx . . $ unzFile# file) {
615 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
616 if (!compat)
617 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
618 return mz_zip_get_entrycxx . . $ mz_zip_get_entry(72c1818a5177f981).(compat->handlecxx . . $ mz_unzip_compat_s#handle.);
619 }
620
621 int unzSetOffsetcxx . . $ unzSetOffset(c0a5f96701d3f89).(unzFilecxx . . $ unzFile# file, unsigned long pos) {
622 return unzSetOffset64cxx . . $ unzSetOffset64(6b20ed9d0f5b4b14).(file, pos);
623 }
624
625 int unzSetOffset64cxx . . $ unzSetOffset64(6b20ed9d0f5b4b14).(unzFilecxx . . $ unzFile# file, int64_tcxx . . $ int64_t# pos) {
626 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
627 if (!compat)
628 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
629 return (int)mz_zip_goto_entrycxx . . $ mz_zip_goto_entry(6b20ed9d0f5b4b14).(compat->handlecxx . . $ mz_unzip_compat_s#handle., pos);
630 }
631
632 int unzGetLocalExtrafieldcxx . . $ unzGetLocalExtrafield(42dc92c764946a43).(unzFilecxx . . $ unzFile# file, void *buf, unsigned int len) {
633 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
634 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
635 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
636 int32_tcxx . . $ int32_t# bytes_to_copy = 0;
637
638 if (!compat || !buf || len >= INT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:112:10`!)
639 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
640
641 err = mz_zip_entry_get_local_infocxx . . $ mz_zip_entry_get_local_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
642 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
643 return err;
644
645 bytes_to_copy = (int32_tcxx . . $ int32_t#)len;
646 if (bytes_to_copy > file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.)
647 bytes_to_copy = file_info->extrafield_sizecxx . . $ mz_zip_file_s#extrafield_size.;
648
649 memcpycxx . . $ memcpy(cc817cb175f282d).(buf, file_info->extrafieldcxx . . $ mz_zip_file_s#extrafield., bytes_to_copy);
650 return MZ_OKcxx . . $ `mz.h:21:9`!;
651 }
652
653 int32_tcxx . . $ int32_t# unzTellcxx . . $ unzTell(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
654 return unztellcxx . . $ unztell(dedf1e9b1c614a07).(file);
655 }
656
657 int32_tcxx . . $ int32_t# unztellcxx . . $ unztell(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
658 return (int32_tcxx . . $ int32_t#)unztell64cxx . . $ unztell64(751e5d26f8574c32).(file);
659 }
660
661 uint64_tcxx . . $ uint64_t# unzTell64cxx . . $ unzTell64(751e5d26f8574c32).(unzFilecxx . . $ unzFile# file) {
662 return unztell64cxx . . $ unztell64(751e5d26f8574c32).(file);
663 }
664
665 uint64_tcxx . . $ uint64_t# unztell64cxx . . $ unztell64(751e5d26f8574c32).(unzFilecxx . . $ unzFile# file) {
666 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
667 if (!compat)
668 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
669 return compat->total_outcxx . . $ mz_unzip_compat_s#total_out.;
670 }
671
672 int unzSeekcxx . . $ unzSeek(4d015e8c0eefb98e).(unzFilecxx . . $ unzFile# file, int32_tcxx . . $ int32_t# offset, int origin) {
673 return unzSeek64cxx . . $ unzSeek64(8bc0ff128761c75d).(file, offset, origin);
674 }
675
676 int unzSeek64cxx . . $ unzSeek64(8bc0ff128761c75d).(unzFilecxx . . $ unzFile# file, int64_tcxx . . $ int64_t# offset, int origin) {
677 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
678 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
679 int64_tcxx . . $ int64_t# position = 0;
680 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
681 void *stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
682
683 if (!compat)
684 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
685 err = mz_zip_entry_get_infocxx . . $ mz_zip_entry_get_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
686 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
687 return err;
688 if (file_info->compression_methodcxx . . $ mz_zip_file_s#compression_method. != MZ_COMPRESS_METHOD_STOREcxx . . $ `mz.h:63:9`!)
689 return UNZ_ERRNOcxx . . $ `compat/unzip.h:51:9`!;
690
691 if (origin == SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!)
692 position = offset;
693 else if (origin == SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!)
694 position = compat->total_outcxx . . $ mz_unzip_compat_s#total_out. + offset;
695 else if (origin == SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!)
696 position = (int64_tcxx . . $ int64_t#)file_info->compressed_sizecxx . . $ mz_zip_file_s#compressed_size. + offset;
697 else
698 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
699
700 if (position > (int64_tcxx . . $ int64_t#)file_info->compressed_sizecxx . . $ mz_zip_file_s#compressed_size.)
701 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
702
703 err = mz_zip_get_streamcxx . . $ mz_zip_get_stream(1843ed636859e0d0).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &stream);
704 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
705 err = mz_stream_seekcxx . . $ mz_stream_seek(8bc0ff128761c75d).(stream, compat->entry_poscxx . . $ mz_unzip_compat_s#entry_pos. + position, MZ_SEEK_SETcxx . . $ `mz.h:58:9`!);
706 if (err == MZ_OKcxx . . $ `mz.h:21:9`!)
707 compat->total_outcxx . . $ mz_unzip_compat_s#total_out. = position;
708 return err;
709 }
710
711 int unzEndOfFilecxx . . $ unzEndOfFile(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
712 return unzeofcxx . . $ unzeof(dedf1e9b1c614a07).(file);
713 }
714
715 int unzeofcxx . . $ unzeof(dedf1e9b1c614a07).(unzFilecxx . . $ unzFile# file) {
716 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
717 mz_zip_filecxx . . $ mz_zip_file# *file_info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
718 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
719
720 if (!compat)
721 return UNZ_PARAMERRORcxx . . $ `compat/unzip.h:53:9`!;
722 err = mz_zip_entry_get_infocxx . . $ mz_zip_entry_get_info(4dd5ee9bdbc1d978).(compat->handlecxx . . $ mz_unzip_compat_s#handle., &file_info);
723 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
724 return err;
725 if (compat->total_outcxx . . $ mz_unzip_compat_s#total_out. == (int64_tcxx . . $ int64_t#)file_info->uncompressed_sizecxx . . $ mz_zip_file_s#uncompressed_size.)
726 return 1;
727 return 0;
728 }
729
730 void *unzGetStreamcxx . . $ unzGetStream(9f162e79bfc6c74).(unzFilecxx . . $ unzFile# file) {
731 mz_unzip_compatcxx . . $ mz_unzip_compat# *compat = (mz_unzip_compatcxx . . $ mz_unzip_compat# *)file;
732 if (!compat)
733 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
734 return (void *)compat->streamcxx . . $ mz_unzip_compat_s#stream.;
735 }
736
737 /***************************************************************************/