diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2023-04-14 01:42:03 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2023-04-15 21:17:31 -0700 |
commit | e9d5486e6635141f589e110fd789648aa08e9544 (patch) | |
tree | a78b9ccd92b05af7cd5776b688d9c3eb3a81a40a /inflate.c | |
parent | 5799c14c8526bf1aaa130c021982f831d155b46d (diff) | |
download | zlib-e9d5486e6635141f589e110fd789648aa08e9544.tar.gz zlib-e9d5486e6635141f589e110fd789648aa08e9544.tar.bz2 zlib-e9d5486e6635141f589e110fd789648aa08e9544.zip |
Remove K&R function definitions from zlib.
C2X has removed K&R definitions from the C function syntax.
Though the standard has not yet been approved, some high-profile
compilers are now issuing warnings when such definitions are
encountered.
Diffstat (limited to 'inflate.c')
-rw-r--r-- | inflate.c | 127 |
1 files changed, 28 insertions, 99 deletions
@@ -91,20 +91,7 @@ | |||
91 | # endif | 91 | # endif |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | /* function prototypes */ | 94 | local int inflateStateCheck(z_streamp strm) { |
95 | local int inflateStateCheck OF((z_streamp strm)); | ||
96 | local void fixedtables OF((struct inflate_state FAR *state)); | ||
97 | local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, | ||
98 | unsigned copy)); | ||
99 | #ifdef BUILDFIXED | ||
100 | void makefixed OF((void)); | ||
101 | #endif | ||
102 | local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, | ||
103 | unsigned len)); | ||
104 | |||
105 | local int inflateStateCheck(strm) | ||
106 | z_streamp strm; | ||
107 | { | ||
108 | struct inflate_state FAR *state; | 95 | struct inflate_state FAR *state; |
109 | if (strm == Z_NULL || | 96 | if (strm == Z_NULL || |
110 | strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) | 97 | strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) |
@@ -116,9 +103,7 @@ z_streamp strm; | |||
116 | return 0; | 103 | return 0; |
117 | } | 104 | } |
118 | 105 | ||
119 | int ZEXPORT inflateResetKeep(strm) | 106 | int ZEXPORT inflateResetKeep(z_streamp strm) { |
120 | z_streamp strm; | ||
121 | { | ||
122 | struct inflate_state FAR *state; | 107 | struct inflate_state FAR *state; |
123 | 108 | ||
124 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; | 109 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; |
@@ -142,9 +127,7 @@ z_streamp strm; | |||
142 | return Z_OK; | 127 | return Z_OK; |
143 | } | 128 | } |
144 | 129 | ||
145 | int ZEXPORT inflateReset(strm) | 130 | int ZEXPORT inflateReset(z_streamp strm) { |
146 | z_streamp strm; | ||
147 | { | ||
148 | struct inflate_state FAR *state; | 131 | struct inflate_state FAR *state; |
149 | 132 | ||
150 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; | 133 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; |
@@ -155,10 +138,7 @@ z_streamp strm; | |||
155 | return inflateResetKeep(strm); | 138 | return inflateResetKeep(strm); |
156 | } | 139 | } |
157 | 140 | ||
158 | int ZEXPORT inflateReset2(strm, windowBits) | 141 | int ZEXPORT inflateReset2(z_streamp strm, int windowBits) { |
159 | z_streamp strm; | ||
160 | int windowBits; | ||
161 | { | ||
162 | int wrap; | 142 | int wrap; |
163 | struct inflate_state FAR *state; | 143 | struct inflate_state FAR *state; |
164 | 144 | ||
@@ -195,12 +175,8 @@ int windowBits; | |||
195 | return inflateReset(strm); | 175 | return inflateReset(strm); |
196 | } | 176 | } |
197 | 177 | ||
198 | int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) | 178 | int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, |
199 | z_streamp strm; | 179 | const char *version, int stream_size) { |
200 | int windowBits; | ||
201 | const char *version; | ||
202 | int stream_size; | ||
203 | { | ||
204 | int ret; | 180 | int ret; |
205 | struct inflate_state FAR *state; | 181 | struct inflate_state FAR *state; |
206 | 182 | ||
@@ -239,19 +215,12 @@ int stream_size; | |||
239 | return ret; | 215 | return ret; |
240 | } | 216 | } |
241 | 217 | ||
242 | int ZEXPORT inflateInit_(strm, version, stream_size) | 218 | int ZEXPORT inflateInit_(z_streamp strm, const char *version, |
243 | z_streamp strm; | 219 | int stream_size) { |
244 | const char *version; | ||
245 | int stream_size; | ||
246 | { | ||
247 | return inflateInit2_(strm, DEF_WBITS, version, stream_size); | 220 | return inflateInit2_(strm, DEF_WBITS, version, stream_size); |
248 | } | 221 | } |
249 | 222 | ||
250 | int ZEXPORT inflatePrime(strm, bits, value) | 223 | int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) { |
251 | z_streamp strm; | ||
252 | int bits; | ||
253 | int value; | ||
254 | { | ||
255 | struct inflate_state FAR *state; | 224 | struct inflate_state FAR *state; |
256 | 225 | ||
257 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; | 226 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; |
@@ -280,9 +249,7 @@ int value; | |||
280 | used for threaded applications, since the rewriting of the tables and virgin | 249 | used for threaded applications, since the rewriting of the tables and virgin |
281 | may not be thread-safe. | 250 | may not be thread-safe. |
282 | */ | 251 | */ |
283 | local void fixedtables(state) | 252 | local void fixedtables(struct inflate_state FAR *state) { |
284 | struct inflate_state FAR *state; | ||
285 | { | ||
286 | #ifdef BUILDFIXED | 253 | #ifdef BUILDFIXED |
287 | static int virgin = 1; | 254 | static int virgin = 1; |
288 | static code *lenfix, *distfix; | 255 | static code *lenfix, *distfix; |
@@ -344,7 +311,7 @@ struct inflate_state FAR *state; | |||
344 | 311 | ||
345 | a.out > inffixed.h | 312 | a.out > inffixed.h |
346 | */ | 313 | */ |
347 | void makefixed() | 314 | void makefixed(void) |
348 | { | 315 | { |
349 | unsigned low, size; | 316 | unsigned low, size; |
350 | struct inflate_state state; | 317 | struct inflate_state state; |
@@ -398,11 +365,7 @@ void makefixed() | |||
398 | output will fall in the output data, making match copies simpler and faster. | 365 | output will fall in the output data, making match copies simpler and faster. |
399 | The advantage may be dependent on the size of the processor's data caches. | 366 | The advantage may be dependent on the size of the processor's data caches. |
400 | */ | 367 | */ |
401 | local int updatewindow(strm, end, copy) | 368 | local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) { |
402 | z_streamp strm; | ||
403 | const Bytef *end; | ||
404 | unsigned copy; | ||
405 | { | ||
406 | struct inflate_state FAR *state; | 369 | struct inflate_state FAR *state; |
407 | unsigned dist; | 370 | unsigned dist; |
408 | 371 | ||
@@ -624,10 +587,7 @@ unsigned copy; | |||
624 | will return Z_BUF_ERROR if it has not reached the end of the stream. | 587 | will return Z_BUF_ERROR if it has not reached the end of the stream. |
625 | */ | 588 | */ |
626 | 589 | ||
627 | int ZEXPORT inflate(strm, flush) | 590 | int ZEXPORT inflate(z_streamp strm, int flush) { |
628 | z_streamp strm; | ||
629 | int flush; | ||
630 | { | ||
631 | struct inflate_state FAR *state; | 591 | struct inflate_state FAR *state; |
632 | z_const unsigned char FAR *next; /* next input */ | 592 | z_const unsigned char FAR *next; /* next input */ |
633 | unsigned char FAR *put; /* next output */ | 593 | unsigned char FAR *put; /* next output */ |
@@ -1303,9 +1263,7 @@ int flush; | |||
1303 | return ret; | 1263 | return ret; |
1304 | } | 1264 | } |
1305 | 1265 | ||
1306 | int ZEXPORT inflateEnd(strm) | 1266 | int ZEXPORT inflateEnd(z_streamp strm) { |
1307 | z_streamp strm; | ||
1308 | { | ||
1309 | struct inflate_state FAR *state; | 1267 | struct inflate_state FAR *state; |
1310 | if (inflateStateCheck(strm)) | 1268 | if (inflateStateCheck(strm)) |
1311 | return Z_STREAM_ERROR; | 1269 | return Z_STREAM_ERROR; |
@@ -1317,11 +1275,8 @@ z_streamp strm; | |||
1317 | return Z_OK; | 1275 | return Z_OK; |
1318 | } | 1276 | } |
1319 | 1277 | ||
1320 | int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) | 1278 | int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, |
1321 | z_streamp strm; | 1279 | uInt *dictLength) { |
1322 | Bytef *dictionary; | ||
1323 | uInt *dictLength; | ||
1324 | { | ||
1325 | struct inflate_state FAR *state; | 1280 | struct inflate_state FAR *state; |
1326 | 1281 | ||
1327 | /* check state */ | 1282 | /* check state */ |
@@ -1340,11 +1295,8 @@ uInt *dictLength; | |||
1340 | return Z_OK; | 1295 | return Z_OK; |
1341 | } | 1296 | } |
1342 | 1297 | ||
1343 | int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) | 1298 | int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, |
1344 | z_streamp strm; | 1299 | uInt dictLength) { |
1345 | const Bytef *dictionary; | ||
1346 | uInt dictLength; | ||
1347 | { | ||
1348 | struct inflate_state FAR *state; | 1300 | struct inflate_state FAR *state; |
1349 | unsigned long dictid; | 1301 | unsigned long dictid; |
1350 | int ret; | 1302 | int ret; |
@@ -1375,10 +1327,7 @@ uInt dictLength; | |||
1375 | return Z_OK; | 1327 | return Z_OK; |
1376 | } | 1328 | } |
1377 | 1329 | ||
1378 | int ZEXPORT inflateGetHeader(strm, head) | 1330 | int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) { |
1379 | z_streamp strm; | ||
1380 | gz_headerp head; | ||
1381 | { | ||
1382 | struct inflate_state FAR *state; | 1331 | struct inflate_state FAR *state; |
1383 | 1332 | ||
1384 | /* check state */ | 1333 | /* check state */ |
@@ -1403,11 +1352,8 @@ gz_headerp head; | |||
1403 | called again with more data and the *have state. *have is initialized to | 1352 | called again with more data and the *have state. *have is initialized to |
1404 | zero for the first call. | 1353 | zero for the first call. |
1405 | */ | 1354 | */ |
1406 | local unsigned syncsearch(have, buf, len) | 1355 | local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, |
1407 | unsigned FAR *have; | 1356 | unsigned len) { |
1408 | const unsigned char FAR *buf; | ||
1409 | unsigned len; | ||
1410 | { | ||
1411 | unsigned got; | 1357 | unsigned got; |
1412 | unsigned next; | 1358 | unsigned next; |
1413 | 1359 | ||
@@ -1426,9 +1372,7 @@ unsigned len; | |||
1426 | return next; | 1372 | return next; |
1427 | } | 1373 | } |
1428 | 1374 | ||
1429 | int ZEXPORT inflateSync(strm) | 1375 | int ZEXPORT inflateSync(z_streamp strm) { |
1430 | z_streamp strm; | ||
1431 | { | ||
1432 | unsigned len; /* number of bytes to look at or looked at */ | 1376 | unsigned len; /* number of bytes to look at or looked at */ |
1433 | int flags; /* temporary to save header status */ | 1377 | int flags; /* temporary to save header status */ |
1434 | unsigned long in, out; /* temporary to save total_in and total_out */ | 1378 | unsigned long in, out; /* temporary to save total_in and total_out */ |
@@ -1484,9 +1428,7 @@ z_streamp strm; | |||
1484 | block. When decompressing, PPP checks that at the end of input packet, | 1428 | block. When decompressing, PPP checks that at the end of input packet, |
1485 | inflate is waiting for these length bytes. | 1429 | inflate is waiting for these length bytes. |
1486 | */ | 1430 | */ |
1487 | int ZEXPORT inflateSyncPoint(strm) | 1431 | int ZEXPORT inflateSyncPoint(z_streamp strm) { |
1488 | z_streamp strm; | ||
1489 | { | ||
1490 | struct inflate_state FAR *state; | 1432 | struct inflate_state FAR *state; |
1491 | 1433 | ||
1492 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; | 1434 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; |
@@ -1494,10 +1436,7 @@ z_streamp strm; | |||
1494 | return state->mode == STORED && state->bits == 0; | 1436 | return state->mode == STORED && state->bits == 0; |
1495 | } | 1437 | } |
1496 | 1438 | ||
1497 | int ZEXPORT inflateCopy(dest, source) | 1439 | int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) { |
1498 | z_streamp dest; | ||
1499 | z_streamp source; | ||
1500 | { | ||
1501 | struct inflate_state FAR *state; | 1440 | struct inflate_state FAR *state; |
1502 | struct inflate_state FAR *copy; | 1441 | struct inflate_state FAR *copy; |
1503 | unsigned char FAR *window; | 1442 | unsigned char FAR *window; |
@@ -1541,10 +1480,7 @@ z_streamp source; | |||
1541 | return Z_OK; | 1480 | return Z_OK; |
1542 | } | 1481 | } |
1543 | 1482 | ||
1544 | int ZEXPORT inflateUndermine(strm, subvert) | 1483 | int ZEXPORT inflateUndermine(z_streamp strm, int subvert) { |
1545 | z_streamp strm; | ||
1546 | int subvert; | ||
1547 | { | ||
1548 | struct inflate_state FAR *state; | 1484 | struct inflate_state FAR *state; |
1549 | 1485 | ||
1550 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; | 1486 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; |
@@ -1559,10 +1495,7 @@ int subvert; | |||
1559 | #endif | 1495 | #endif |
1560 | } | 1496 | } |
1561 | 1497 | ||
1562 | int ZEXPORT inflateValidate(strm, check) | 1498 | int ZEXPORT inflateValidate(z_streamp strm, int check) { |
1563 | z_streamp strm; | ||
1564 | int check; | ||
1565 | { | ||
1566 | struct inflate_state FAR *state; | 1499 | struct inflate_state FAR *state; |
1567 | 1500 | ||
1568 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; | 1501 | if (inflateStateCheck(strm)) return Z_STREAM_ERROR; |
@@ -1574,9 +1507,7 @@ int check; | |||
1574 | return Z_OK; | 1507 | return Z_OK; |
1575 | } | 1508 | } |
1576 | 1509 | ||
1577 | long ZEXPORT inflateMark(strm) | 1510 | long ZEXPORT inflateMark(z_streamp strm) { |
1578 | z_streamp strm; | ||
1579 | { | ||
1580 | struct inflate_state FAR *state; | 1511 | struct inflate_state FAR *state; |
1581 | 1512 | ||
1582 | if (inflateStateCheck(strm)) | 1513 | if (inflateStateCheck(strm)) |
@@ -1587,9 +1518,7 @@ z_streamp strm; | |||
1587 | (state->mode == MATCH ? state->was - state->length : 0)); | 1518 | (state->mode == MATCH ? state->was - state->length : 0)); |
1588 | } | 1519 | } |
1589 | 1520 | ||
1590 | unsigned long ZEXPORT inflateCodesUsed(strm) | 1521 | unsigned long ZEXPORT inflateCodesUsed(z_streamp strm) { |
1591 | z_streamp strm; | ||
1592 | { | ||
1593 | struct inflate_state FAR *state; | 1522 | struct inflate_state FAR *state; |
1594 | if (inflateStateCheck(strm)) return (unsigned long)-1; | 1523 | if (inflateStateCheck(strm)) return (unsigned long)-1; |
1595 | state = (struct inflate_state FAR *)strm->state; | 1524 | state = (struct inflate_state FAR *)strm->state; |