Debian Codegraph @

mz_strm_zlib.c

raw symbols SCIP
1 /* mz_strm_zlib.c -- Stream for zlib inflate/deflate
2 part of the minizip-ng project
3
4 Copyright (C) Nathan Moinvaziri
5 https://github.com/zlib-ng/minizip-ng
6
7 This program is distributed under the terms of the same license as zlib.
8 See the accompanying LICENSE file for the full text of the license.
9 */
10
11 #include "mz.h"cxx . . $ `<file>/mz.h`/
12 #include "mz_strm.h"cxx . . $ `<file>/mz_strm.h`/
13 #include "mz_strm_zlib.h"cxx . . $ `<file>/mz_strm_zlib.h`/
14
15 #if !defined(ZLIB_COMPATcxx . . $ `<built-in>:418:9`!)
16 # include "zlib-ng.h"
17 #else
18 # include "zlib.h"
19 #endif
20
21 /***************************************************************************/
22
23 #if !defined(ZLIB_COMPATcxx . . $ `<built-in>:418:9`!)
24 # define ZLIB_PREFIX(x) zng_##x
25 typedef zng_stream zlib_stream;
26 #else
27 # define ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(x) x
28 typedef z_streamcxx . . $ z_stream# zlib_streamcxx . . $ zlib_stream#;
29 #endif
30
31 #if !defined(DEF_MEM_LEVEL)
32 # if MAX_MEM_LEVELcxx . . $ `<external>/116306602880328527/zconf.h:277:13`! >= 8
33 # define DEF_MEM_LEVELcxx . . $ `mz_strm_zlib.c:33:13`! 8
34 # else
35 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
36 # endif
37 #endif
38
39 /***************************************************************************/
40
41 static mz_stream_vtblcxx . . $ mz_stream_vtbl# mz_stream_zlib_vtblcxx . . $ mz_stream_zlib_vtbl. = {
42 mz_stream_zlib_opencxx . . $ mz_stream_zlib_open(7083a8984c0735e8)., mz_stream_zlib_is_opencxx . . $ mz_stream_zlib_is_open(dedf1e9b1c614a07)., mz_stream_zlib_readcxx . . $ mz_stream_zlib_read(8bc41909eac9e5d8)., mz_stream_zlib_writecxx . . $ mz_stream_zlib_write(91e54fd90adbb21).,
43 mz_stream_zlib_tellcxx . . $ mz_stream_zlib_tell(72c1818a5177f981)., mz_stream_zlib_seekcxx . . $ mz_stream_zlib_seek(8bc0ff128761c75d)., mz_stream_zlib_closecxx . . $ mz_stream_zlib_close(dedf1e9b1c614a07)., mz_stream_zlib_errorcxx . . $ mz_stream_zlib_error(dedf1e9b1c614a07).,
44 mz_stream_zlib_createcxx . . $ mz_stream_zlib_create(50c7df7de5344ebb)., mz_stream_zlib_deletecxx . . $ mz_stream_zlib_delete(539e082cf00e1f43)., mz_stream_zlib_get_prop_int64cxx . . $ mz_stream_zlib_get_prop_int64(280df70541557ec8)., mz_stream_zlib_set_prop_int64cxx . . $ mz_stream_zlib_set_prop_int64(5f4b2ff0df22ef2b).};
45
46 /***************************************************************************/
47
48 typedef struct mz_stream_zlib_scxx . . $ mz_stream_zlib_s# {
49 mz_streamcxx . . $ mz_stream# streamcxx . . $ mz_stream_zlib_s#stream.;
50 zlib_streamcxx . . $ zlib_stream# zstreamcxx . . $ mz_stream_zlib_s#zstream.;
51 uint8_tcxx . . $ uint8_t# buffercxx . . $ mz_stream_zlib_s#buffer.[INT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:111:10`!];
52 int32_tcxx . . $ int32_t# buffer_lencxx . . $ mz_stream_zlib_s#buffer_len.;
53 int64_tcxx . . $ int64_t# total_incxx . . $ mz_stream_zlib_s#total_in.;
54 int64_tcxx . . $ int64_t# total_outcxx . . $ mz_stream_zlib_s#total_out.;
55 int64_tcxx . . $ int64_t# max_total_incxx . . $ mz_stream_zlib_s#max_total_in.;
56 int8_tcxx . . $ int8_t# initializedcxx . . $ mz_stream_zlib_s#initialized.;
57 int16_tcxx . . $ int16_t# levelcxx . . $ mz_stream_zlib_s#level.;
58 int32_tcxx . . $ int32_t# window_bitscxx . . $ mz_stream_zlib_s#window_bits.;
59 int32_tcxx . . $ int32_t# modecxx . . $ mz_stream_zlib_s#mode.;
60 int32_tcxx . . $ int32_t# errorcxx . . $ mz_stream_zlib_s#error.;
61 } mz_stream_zlibcxx . . $ mz_stream_zlib#;
62
63 /***************************************************************************/
64
65 int32_tcxx . . $ int32_t# mz_stream_zlib_opencxx . . $ mz_stream_zlib_open(7083a8984c0735e8).(void *stream, const char *path, int32_tcxx . . $ int32_t# mode) {
66 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
67
68 MZ_UNUSEDcxx . . $ `mz.h:147:9`!(path);
69
70 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..data_typecxx . . $ z_stream_s#data_type. = Z_BINARYcxx . . $ `<external>/8929586433573063152/zlib.h:207:9`!;
71 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..zalloccxx . . $ z_stream_s#zalloc. = Z_NULLcxx . . $ `<external>/8929586433573063152/zlib.h:216:9`!;
72 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..zfreecxx . . $ z_stream_s#zfree. = Z_NULLcxx . . $ `<external>/8929586433573063152/zlib.h:216:9`!;
73 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..opaquecxx . . $ z_stream_s#opaque. = Z_NULLcxx . . $ `<external>/8929586433573063152/zlib.h:216:9`!;
74 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..total_incxx . . $ z_stream_s#total_in. = 0;
75 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..total_outcxx . . $ z_stream_s#total_out. = 0;
76
77 zlib->total_incxx . . $ mz_stream_zlib_s#total_in. = 0;
78 zlib->total_outcxx . . $ mz_stream_zlib_s#total_out. = 0;
79
80 if (mode & MZ_OPEN_MODE_WRITEcxx . . $ `mz.h:51:9`!) {
81 #ifdef MZ_ZIP_NO_COMPRESSION
82 return MZ_SUPPORT_ERROR;
83 #else
84 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..next_outcxx . . $ z_stream_s#next_out. = zlib->buffercxx . . $ mz_stream_zlib_s#buffer.;
85 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_outcxx . . $ z_stream_s#avail_out. = sizeof(zlib->buffercxx . . $ mz_stream_zlib_s#buffer.);
86
87 zlib->errorcxx . . $ mz_stream_zlib_s#error. = ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(deflateInit2cxx . . $ `<external>/8929586433573063152/zlib.h:1936:11`!)(&zlib->zstream, (int8_t)zlib->level, Z_DEFLATEDcxx . . $ `<external>/8929586433573063152/zlib.h:213:9`!, zlib->window_bits,
88 DEF_MEM_LEVELcxx . . $ `mz_strm_zlib.c:33:13`!, Z_DEFAULT_STRATEGYcxx . . $ `<external>/8929586433573063152/zlib.h:204:9`!);
89 #endif
90 } else if (mode & MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`!) {
91 #ifdef MZ_ZIP_NO_DECOMPRESSION
92 return MZ_SUPPORT_ERROR;
93 #else
94 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..next_incxx . . $ z_stream_s#next_in. = zlib->buffercxx . . $ mz_stream_zlib_s#buffer.;
95 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in. = 0;
96
97 zlib->errorcxx . . $ mz_stream_zlib_s#error. = ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(inflateInit2cxx . . $ `<external>/8929586433573063152/zlib.h:1939:11`!)(&zlib->zstream, zlib->window_bits);
98 #endif
99 }
100
101 if (zlib->errorcxx . . $ mz_stream_zlib_s#error. != Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!)
102 return MZ_OPEN_ERRORcxx . . $ `mz.h:40:9`!;
103
104 zlib->initializedcxx . . $ mz_stream_zlib_s#initialized. = 1;
105 zlib->modecxx . . $ mz_stream_zlib_s#mode. = mode;
106 return MZ_OKcxx . . $ `mz.h:21:9`!;
107 }
108
109 int32_tcxx . . $ int32_t# mz_stream_zlib_is_opencxx . . $ mz_stream_zlib_is_open(dedf1e9b1c614a07).(void *stream) {
110 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
111 if (zlib->initializedcxx . . $ mz_stream_zlib_s#initialized. != 1)
112 return MZ_OPEN_ERRORcxx . . $ `mz.h:40:9`!;
113 return MZ_OKcxx . . $ `mz.h:21:9`!;
114 }
115
116 int32_tcxx . . $ int32_t# mz_stream_zlib_readcxx . . $ mz_stream_zlib_read(8bc41909eac9e5d8).(void *stream, void *buf, int32_tcxx . . $ int32_t# size) {
117 #ifdef MZ_ZIP_NO_DECOMPRESSION
118 MZ_UNUSED(stream);
119 MZ_UNUSED(buf);
120 MZ_UNUSED(size);
121 return MZ_SUPPORT_ERROR;
122 #else
123 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
124 uint64_tcxx . . $ uint64_t# total_in_before = 0;
125 uint64_tcxx . . $ uint64_t# total_in_after = 0;
126 uint64_tcxx . . $ uint64_t# total_out_before = 0;
127 uint64_tcxx . . $ uint64_t# total_out_after = 0;
128 uint32_tcxx . . $ uint32_t# total_in = 0;
129 uint32_tcxx . . $ uint32_t# total_out = 0;
130 uint32_tcxx . . $ uint32_t# in_bytes = 0;
131 uint32_tcxx . . $ uint32_t# out_bytes = 0;
132 int32_tcxx . . $ int32_t# bytes_to_read = sizeof(zlib->buffercxx . . $ mz_stream_zlib_s#buffer.);
133 int32_tcxx . . $ int32_t# read = 0;
134 int32_tcxx . . $ int32_t# err = Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!;
135
136 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..next_outcxx . . $ z_stream_s#next_out. = (Bytefcxx . . $ Bytef# *)buf;
137 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_outcxx . . $ z_stream_s#avail_out. = (uIntcxx . . $ uInt#)size;
138
139 do {
140 if (zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in. == 0) {
141 if (zlib->max_total_incxx . . $ mz_stream_zlib_s#max_total_in. > 0) {
142 if ((int64_tcxx . . $ int64_t#)bytes_to_read > (zlib->max_total_incxx . . $ mz_stream_zlib_s#max_total_in. - zlib->total_incxx . . $ mz_stream_zlib_s#total_in.))
143 bytes_to_read = (int32_tcxx . . $ int32_t#)(zlib->max_total_incxx . . $ mz_stream_zlib_s#max_total_in. - zlib->total_incxx . . $ mz_stream_zlib_s#total_in.);
144 }
145
146 read = mz_stream_readcxx . . $ mz_stream_read(8bc41909eac9e5d8).(zlib->streamcxx . . $ mz_stream_zlib_s#stream..basecxx . . $ mz_stream_s#base., zlib->buffercxx . . $ mz_stream_zlib_s#buffer., bytes_to_read);
147
148 if (read < 0)
149 return read;
150
151 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..next_incxx . . $ z_stream_s#next_in. = zlib->buffercxx . . $ mz_stream_zlib_s#buffer.;
152 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in. = read;
153 }
154
155 total_in_before = zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in.;
156 total_out_before = zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..total_outcxx . . $ z_stream_s#total_out.;
157
158 err = ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(inflate)(&zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream., Z_SYNC_FLUSHcxx . . $ `<external>/8929586433573063152/zlib.h:174:9`!);
159 if ((err >= Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!) && (zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..msgcxx . . $ z_stream_s#msg.)) {
160 zlib->errorcxx . . $ mz_stream_zlib_s#error. = Z_DATA_ERRORcxx . . $ `<external>/8929586433573063152/zlib.h:186:9`!;
161 break;
162 }
163
164 total_in_after = zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in.;
165 total_out_after = zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..total_outcxx . . $ z_stream_s#total_out.;
166
167 in_bytes = (uint32_tcxx . . $ uint32_t#)(total_in_before - total_in_after);
168 out_bytes = (uint32_tcxx . . $ uint32_t#)(total_out_after - total_out_before);
169
170 total_in += in_bytes;
171 total_out += out_bytes;
172
173 zlib->total_incxx . . $ mz_stream_zlib_s#total_in. += in_bytes;
174 zlib->total_outcxx . . $ mz_stream_zlib_s#total_out. += out_bytes;
175
176 if (err == Z_STREAM_ENDcxx . . $ `<external>/8929586433573063152/zlib.h:182:9`!)
177 break;
178 if (err != Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!) {
179 zlib->errorcxx . . $ mz_stream_zlib_s#error. = err;
180 break;
181 }
182 } while (zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_outcxx . . $ z_stream_s#avail_out. > 0);
183
184 MZ_UNUSEDcxx . . $ `mz.h:147:9`!(total_in);
185
186 if (zlib->errorcxx . . $ mz_stream_zlib_s#error. != 0) {
187 /* Zlib errors are compatible with MZ */
188 return zlib->errorcxx . . $ mz_stream_zlib_s#error.;
189 }
190
191 return total_out;
192 #endif
193 }
194
195 #ifndef MZ_ZIP_NO_COMPRESSION
196 static int32_tcxx . . $ int32_t# mz_stream_zlib_flushcxx . . $ mz_stream_zlib_flush(dedf1e9b1c614a07).(void *stream) {
197 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
198 if (mz_stream_writecxx . . $ mz_stream_write(91e54fd90adbb21).(zlib->streamcxx . . $ mz_stream_zlib_s#stream..basecxx . . $ mz_stream_s#base., zlib->buffercxx . . $ mz_stream_zlib_s#buffer., zlib->buffer_lencxx . . $ mz_stream_zlib_s#buffer_len.) != zlib->buffer_lencxx . . $ mz_stream_zlib_s#buffer_len.)
199 return MZ_WRITE_ERRORcxx . . $ `mz.h:45:9`!;
200 return MZ_OKcxx . . $ `mz.h:21:9`!;
201 }
202
203 static int32_tcxx . . $ int32_t# mz_stream_zlib_deflatecxx . . $ mz_stream_zlib_deflate(7fb3b8e28157cebd).(void *stream, int flush) {
204 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
205 uint64_tcxx . . $ uint64_t# total_out_before = 0;
206 uint64_tcxx . . $ uint64_t# total_out_after = 0;
207 int32_tcxx . . $ int32_t# out_bytes = 0;
208 int32_tcxx . . $ int32_t# err = Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!;
209
210 do {
211 if (zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_outcxx . . $ z_stream_s#avail_out. == 0) {
212 err = mz_stream_zlib_flushcxx . . $ mz_stream_zlib_flush(dedf1e9b1c614a07).(zlib);
213 if (err != MZ_OKcxx . . $ `mz.h:21:9`!)
214 return err;
215
216 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_outcxx . . $ z_stream_s#avail_out. = sizeof(zlib->buffercxx . . $ mz_stream_zlib_s#buffer.);
217 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..next_outcxx . . $ z_stream_s#next_out. = zlib->buffercxx . . $ mz_stream_zlib_s#buffer.;
218
219 zlib->buffer_lencxx . . $ mz_stream_zlib_s#buffer_len. = 0;
220 }
221
222 total_out_before = zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..total_outcxx . . $ z_stream_s#total_out.;
223 err = ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(deflate)(&zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream., flush);
224 total_out_after = zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..total_outcxx . . $ z_stream_s#total_out.;
225
226 out_bytes = (uint32_tcxx . . $ uint32_t#)(total_out_after - total_out_before);
227
228 zlib->buffer_lencxx . . $ mz_stream_zlib_s#buffer_len. += out_bytes;
229 zlib->total_outcxx . . $ mz_stream_zlib_s#total_out. += out_bytes;
230
231 if (err == Z_STREAM_ENDcxx . . $ `<external>/8929586433573063152/zlib.h:182:9`!)
232 break;
233 if (err != Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!) {
234 zlib->errorcxx . . $ mz_stream_zlib_s#error. = err;
235 return MZ_DATA_ERRORcxx . . $ `mz.h:23:9`!;
236 }
237 } while ((zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in. > 0) || (flush == Z_FINISHcxx . . $ `<external>/8929586433573063152/zlib.h:176:9`! && err == Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!));
238
239 return MZ_OKcxx . . $ `mz.h:21:9`!;
240 }
241 #endif
242
243 int32_tcxx . . $ int32_t# mz_stream_zlib_writecxx . . $ mz_stream_zlib_write(91e54fd90adbb21).(void *stream, const void *buf, int32_tcxx . . $ int32_t# size) {
244 #ifdef MZ_ZIP_NO_COMPRESSION
245 MZ_UNUSED(stream);
246 MZ_UNUSED(buf);
247 MZ_UNUSED(size);
248 return MZ_SUPPORT_ERROR;
249 #else
250 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
251 int32_tcxx . . $ int32_t# err = MZ_OKcxx . . $ `mz.h:21:9`!;
252
253 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..next_incxx . . $ z_stream_s#next_in. = (Bytefcxx . . $ Bytef# *)(intptr_tcxx . . $ intptr_t#)buf;
254 zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream..avail_incxx . . $ z_stream_s#avail_in. = (uIntcxx . . $ uInt#)size;
255
256 err = mz_stream_zlib_deflatecxx . . $ mz_stream_zlib_deflate(7fb3b8e28157cebd).(stream, Z_NO_FLUSHcxx . . $ `<external>/8929586433573063152/zlib.h:172:9`!);
257 if (err != MZ_OKcxx . . $ `mz.h:21:9`!) {
258 return err;
259 }
260
261 zlib->total_incxx . . $ mz_stream_zlib_s#total_in. += size;
262 return size;
263 #endif
264 }
265
266 int64_tcxx . . $ int64_t# mz_stream_zlib_tellcxx . . $ mz_stream_zlib_tell(72c1818a5177f981).(void *stream) {
267 MZ_UNUSEDcxx . . $ `mz.h:147:9`!(stream);
268
269 return MZ_TELL_ERRORcxx . . $ `mz.h:43:9`!;
270 }
271
272 int32_tcxx . . $ int32_t# mz_stream_zlib_seekcxx . . $ mz_stream_zlib_seek(8bc0ff128761c75d).(void *stream, int64_tcxx . . $ int64_t# offset, int32_tcxx . . $ int32_t# origin) {
273 MZ_UNUSEDcxx . . $ `mz.h:147:9`!(stream);
274 MZ_UNUSEDcxx . . $ `mz.h:147:9`!(offset);
275 MZ_UNUSEDcxx . . $ `mz.h:147:9`!(origin);
276
277 return MZ_SEEK_ERRORcxx . . $ `mz.h:42:9`!;
278 }
279
280 int32_tcxx . . $ int32_t# mz_stream_zlib_closecxx . . $ mz_stream_zlib_close(dedf1e9b1c614a07).(void *stream) {
281 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
282
283 if (zlib->modecxx . . $ mz_stream_zlib_s#mode. & MZ_OPEN_MODE_WRITEcxx . . $ `mz.h:51:9`!) {
284 #ifdef MZ_ZIP_NO_COMPRESSION
285 return MZ_SUPPORT_ERROR;
286 #else
287 mz_stream_zlib_deflatecxx . . $ mz_stream_zlib_deflate(7fb3b8e28157cebd).(stream, Z_FINISHcxx . . $ `<external>/8929586433573063152/zlib.h:176:9`!);
288 mz_stream_zlib_flushcxx . . $ mz_stream_zlib_flush(dedf1e9b1c614a07).(stream);
289
290 ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(deflateEnd)(&zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream.);
291 #endif
292 } else if (zlib->modecxx . . $ mz_stream_zlib_s#mode. & MZ_OPEN_MODE_READcxx . . $ `mz.h:50:9`!) {
293 #ifdef MZ_ZIP_NO_DECOMPRESSION
294 return MZ_SUPPORT_ERROR;
295 #else
296 ZLIB_PREFIXcxx . . $ `mz_strm_zlib.c:27:11`!(inflateEnd)(&zlib->zstreamcxx . . $ mz_stream_zlib_s#zstream.);
297 #endif
298 }
299
300 zlib->initializedcxx . . $ mz_stream_zlib_s#initialized. = 0;
301
302 if (zlib->errorcxx . . $ mz_stream_zlib_s#error. != Z_OKcxx . . $ `<external>/8929586433573063152/zlib.h:181:9`!)
303 return MZ_CLOSE_ERRORcxx . . $ `mz.h:41:9`!;
304 return MZ_OKcxx . . $ `mz.h:21:9`!;
305 }
306
307 int32_tcxx . . $ int32_t# mz_stream_zlib_errorcxx . . $ mz_stream_zlib_error(dedf1e9b1c614a07).(void *stream) {
308 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
309 return zlib->errorcxx . . $ mz_stream_zlib_s#error.;
310 }
311
312 int32_tcxx . . $ int32_t# mz_stream_zlib_get_prop_int64cxx . . $ mz_stream_zlib_get_prop_int64(280df70541557ec8).(void *stream, int32_tcxx . . $ int32_t# prop, int64_tcxx . . $ int64_t# *value) {
313 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
314 switch (prop) {
315 case MZ_STREAM_PROP_TOTAL_INcxx . . $ `mz_strm.h:20:9`!:
316 *value = zlib->total_incxx . . $ mz_stream_zlib_s#total_in.;
317 break;
318 case MZ_STREAM_PROP_TOTAL_IN_MAXcxx . . $ `mz_strm.h:21:9`!:
319 *value = zlib->max_total_incxx . . $ mz_stream_zlib_s#max_total_in.;
320 break;
321 case MZ_STREAM_PROP_TOTAL_OUTcxx . . $ `mz_strm.h:22:9`!:
322 *value = zlib->total_outcxx . . $ mz_stream_zlib_s#total_out.;
323 break;
324 case MZ_STREAM_PROP_HEADER_SIZEcxx . . $ `mz_strm.h:24:9`!:
325 *value = 0;
326 break;
327 case MZ_STREAM_PROP_COMPRESS_WINDOWcxx . . $ `mz_strm.h:30:9`!:
328 *value = zlib->window_bitscxx . . $ mz_stream_zlib_s#window_bits.;
329 break;
330 default:
331 return MZ_EXIST_ERRORcxx . . $ `mz.h:36:9`!;
332 }
333 return MZ_OKcxx . . $ `mz.h:21:9`!;
334 }
335
336 int32_tcxx . . $ int32_t# mz_stream_zlib_set_prop_int64cxx . . $ mz_stream_zlib_set_prop_int64(5f4b2ff0df22ef2b).(void *stream, int32_tcxx . . $ int32_t# prop, int64_tcxx . . $ int64_t# value) {
337 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)stream;
338 switch (prop) {
339 case MZ_STREAM_PROP_COMPRESS_LEVELcxx . . $ `mz_strm.h:28:9`!:
340 if (value == MZ_COMPRESS_LEVEL_DEFAULTcxx . . $ `mz.h:71:9`!)
341 zlib->levelcxx . . $ mz_stream_zlib_s#level. = Z_DEFAULT_COMPRESSIONcxx . . $ `<external>/8929586433573063152/zlib.h:197:9`!;
342 else
343 zlib->levelcxx . . $ mz_stream_zlib_s#level. = (int16_tcxx . . $ int16_t#)value;
344 break;
345 case MZ_STREAM_PROP_TOTAL_IN_MAXcxx . . $ `mz_strm.h:21:9`!:
346 zlib->max_total_incxx . . $ mz_stream_zlib_s#max_total_in. = value;
347 break;
348 case MZ_STREAM_PROP_COMPRESS_WINDOWcxx . . $ `mz_strm.h:30:9`!:
349 zlib->window_bitscxx . . $ mz_stream_zlib_s#window_bits. = (int32_tcxx . . $ int32_t#)value;
350 break;
351 default:
352 return MZ_EXIST_ERRORcxx . . $ `mz.h:36:9`!;
353 }
354 return MZ_OKcxx . . $ `mz.h:21:9`!;
355 }
356
357 void *mz_stream_zlib_createcxx . . $ mz_stream_zlib_create(50c7df7de5344ebb).(void) {
358 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(mz_stream_zlibcxx . . $ mz_stream_zlib#));
359 if (zlib) {
360 zlib->streamcxx . . $ mz_stream_zlib_s#stream..vtblcxx . . $ mz_stream_s#vtbl. = &mz_stream_zlib_vtblcxx . . $ mz_stream_zlib_vtbl.;
361 zlib->levelcxx . . $ mz_stream_zlib_s#level. = Z_DEFAULT_COMPRESSIONcxx . . $ `<external>/8929586433573063152/zlib.h:197:9`!;
362 zlib->window_bitscxx . . $ mz_stream_zlib_s#window_bits. = -MAX_WBITScxx . . $ `<external>/116306602880328527/zconf.h:287:11`!;
363 }
364 return zlib;
365 }
366
367 void mz_stream_zlib_deletecxx . . $ mz_stream_zlib_delete(539e082cf00e1f43).(void **stream) {
368 mz_stream_zlibcxx . . $ mz_stream_zlib# *zlib = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
369 if (!stream)
370 return;
371 zlib = (mz_stream_zlibcxx . . $ mz_stream_zlib# *)*stream;
372 freecxx . . $ free(5d22bdacc48458e8).(zlib);
373 *stream = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
374 }
375
376 void *mz_stream_zlib_get_interfacecxx . . $ mz_stream_zlib_get_interface(50c7df7de5344ebb).(void) {
377 return (void *)&mz_stream_zlib_vtblcxx . . $ mz_stream_zlib_vtbl.;
378 }