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 /gzwrite.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 'gzwrite.c')
-rw-r--r-- | gzwrite.c | 82 |
1 files changed, 18 insertions, 64 deletions
@@ -5,18 +5,10 @@ | |||
5 | 5 | ||
6 | #include "gzguts.h" | 6 | #include "gzguts.h" |
7 | 7 | ||
8 | /* Local functions */ | ||
9 | local int gz_init OF((gz_statep)); | ||
10 | local int gz_comp OF((gz_statep, int)); | ||
11 | local int gz_zero OF((gz_statep, z_off64_t)); | ||
12 | local z_size_t gz_write OF((gz_statep, voidpc, z_size_t)); | ||
13 | |||
14 | /* Initialize state for writing a gzip file. Mark initialization by setting | 8 | /* Initialize state for writing a gzip file. Mark initialization by setting |
15 | state->size to non-zero. Return -1 on a memory allocation failure, or 0 on | 9 | state->size to non-zero. Return -1 on a memory allocation failure, or 0 on |
16 | success. */ | 10 | success. */ |
17 | local int gz_init(state) | 11 | local int gz_init(gz_statep state) { |
18 | gz_statep state; | ||
19 | { | ||
20 | int ret; | 12 | int ret; |
21 | z_streamp strm = &(state->strm); | 13 | z_streamp strm = &(state->strm); |
22 | 14 | ||
@@ -70,10 +62,7 @@ local int gz_init(state) | |||
70 | deflate() flush value. If flush is Z_FINISH, then the deflate() state is | 62 | deflate() flush value. If flush is Z_FINISH, then the deflate() state is |
71 | reset to start a new gzip stream. If gz->direct is true, then simply write | 63 | reset to start a new gzip stream. If gz->direct is true, then simply write |
72 | to the output file without compressing, and ignore flush. */ | 64 | to the output file without compressing, and ignore flush. */ |
73 | local int gz_comp(state, flush) | 65 | local int gz_comp(gz_statep state, int flush) { |
74 | gz_statep state; | ||
75 | int flush; | ||
76 | { | ||
77 | int ret, writ; | 66 | int ret, writ; |
78 | unsigned have, put, max = ((unsigned)-1 >> 2) + 1; | 67 | unsigned have, put, max = ((unsigned)-1 >> 2) + 1; |
79 | z_streamp strm = &(state->strm); | 68 | z_streamp strm = &(state->strm); |
@@ -151,10 +140,7 @@ local int gz_comp(state, flush) | |||
151 | 140 | ||
152 | /* Compress len zeros to output. Return -1 on a write error or memory | 141 | /* Compress len zeros to output. Return -1 on a write error or memory |
153 | allocation failure by gz_comp(), or 0 on success. */ | 142 | allocation failure by gz_comp(), or 0 on success. */ |
154 | local int gz_zero(state, len) | 143 | local int gz_zero(gz_statep state, z_off64_t len) { |
155 | gz_statep state; | ||
156 | z_off64_t len; | ||
157 | { | ||
158 | int first; | 144 | int first; |
159 | unsigned n; | 145 | unsigned n; |
160 | z_streamp strm = &(state->strm); | 146 | z_streamp strm = &(state->strm); |
@@ -184,11 +170,7 @@ local int gz_zero(state, len) | |||
184 | 170 | ||
185 | /* Write len bytes from buf to file. Return the number of bytes written. If | 171 | /* Write len bytes from buf to file. Return the number of bytes written. If |
186 | the returned value is less than len, then there was an error. */ | 172 | the returned value is less than len, then there was an error. */ |
187 | local z_size_t gz_write(state, buf, len) | 173 | local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) { |
188 | gz_statep state; | ||
189 | voidpc buf; | ||
190 | z_size_t len; | ||
191 | { | ||
192 | z_size_t put = len; | 174 | z_size_t put = len; |
193 | 175 | ||
194 | /* if len is zero, avoid unnecessary operations */ | 176 | /* if len is zero, avoid unnecessary operations */ |
@@ -252,11 +234,7 @@ local z_size_t gz_write(state, buf, len) | |||
252 | } | 234 | } |
253 | 235 | ||
254 | /* -- see zlib.h -- */ | 236 | /* -- see zlib.h -- */ |
255 | int ZEXPORT gzwrite(file, buf, len) | 237 | int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) { |
256 | gzFile file; | ||
257 | voidpc buf; | ||
258 | unsigned len; | ||
259 | { | ||
260 | gz_statep state; | 238 | gz_statep state; |
261 | 239 | ||
262 | /* get internal structure */ | 240 | /* get internal structure */ |
@@ -280,12 +258,8 @@ int ZEXPORT gzwrite(file, buf, len) | |||
280 | } | 258 | } |
281 | 259 | ||
282 | /* -- see zlib.h -- */ | 260 | /* -- see zlib.h -- */ |
283 | z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) | 261 | z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems, |
284 | voidpc buf; | 262 | gzFile file) { |
285 | z_size_t size; | ||
286 | z_size_t nitems; | ||
287 | gzFile file; | ||
288 | { | ||
289 | z_size_t len; | 263 | z_size_t len; |
290 | gz_statep state; | 264 | gz_statep state; |
291 | 265 | ||
@@ -310,10 +284,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) | |||
310 | } | 284 | } |
311 | 285 | ||
312 | /* -- see zlib.h -- */ | 286 | /* -- see zlib.h -- */ |
313 | int ZEXPORT gzputc(file, c) | 287 | int ZEXPORT gzputc(gzFile file, int c) { |
314 | gzFile file; | ||
315 | int c; | ||
316 | { | ||
317 | unsigned have; | 288 | unsigned have; |
318 | unsigned char buf[1]; | 289 | unsigned char buf[1]; |
319 | gz_statep state; | 290 | gz_statep state; |
@@ -358,10 +329,7 @@ int ZEXPORT gzputc(file, c) | |||
358 | } | 329 | } |
359 | 330 | ||
360 | /* -- see zlib.h -- */ | 331 | /* -- see zlib.h -- */ |
361 | int ZEXPORT gzputs(file, s) | 332 | int ZEXPORT gzputs(gzFile file, const char *s) { |
362 | gzFile file; | ||
363 | const char *s; | ||
364 | { | ||
365 | z_size_t len, put; | 333 | z_size_t len, put; |
366 | gz_statep state; | 334 | gz_statep state; |
367 | 335 | ||
@@ -388,8 +356,7 @@ int ZEXPORT gzputs(file, s) | |||
388 | #include <stdarg.h> | 356 | #include <stdarg.h> |
389 | 357 | ||
390 | /* -- see zlib.h -- */ | 358 | /* -- see zlib.h -- */ |
391 | int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) | 359 | int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) { |
392 | { | ||
393 | int len; | 360 | int len; |
394 | unsigned left; | 361 | unsigned left; |
395 | char *next; | 362 | char *next; |
@@ -460,8 +427,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) | |||
460 | return len; | 427 | return len; |
461 | } | 428 | } |
462 | 429 | ||
463 | int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) | 430 | int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) { |
464 | { | ||
465 | va_list va; | 431 | va_list va; |
466 | int ret; | 432 | int ret; |
467 | 433 | ||
@@ -474,13 +440,10 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) | |||
474 | #else /* !STDC && !Z_HAVE_STDARG_H */ | 440 | #else /* !STDC && !Z_HAVE_STDARG_H */ |
475 | 441 | ||
476 | /* -- see zlib.h -- */ | 442 | /* -- see zlib.h -- */ |
477 | int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | 443 | int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3, |
478 | a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) | 444 | int a4, int a5, int a6, int a7, int a8, int a9, int a10, |
479 | gzFile file; | 445 | int a11, int a12, int a13, int a14, int a15, int a16, |
480 | const char *format; | 446 | int a17, int a18, int a19, int a20) { |
481 | int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | ||
482 | a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; | ||
483 | { | ||
484 | unsigned len, left; | 447 | unsigned len, left; |
485 | char *next; | 448 | char *next; |
486 | gz_statep state; | 449 | gz_statep state; |
@@ -562,10 +525,7 @@ int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, | |||
562 | #endif | 525 | #endif |
563 | 526 | ||
564 | /* -- see zlib.h -- */ | 527 | /* -- see zlib.h -- */ |
565 | int ZEXPORT gzflush(file, flush) | 528 | int ZEXPORT gzflush(gzFile file, int flush) { |
566 | gzFile file; | ||
567 | int flush; | ||
568 | { | ||
569 | gz_statep state; | 529 | gz_statep state; |
570 | 530 | ||
571 | /* get internal structure */ | 531 | /* get internal structure */ |
@@ -594,11 +554,7 @@ int ZEXPORT gzflush(file, flush) | |||
594 | } | 554 | } |
595 | 555 | ||
596 | /* -- see zlib.h -- */ | 556 | /* -- see zlib.h -- */ |
597 | int ZEXPORT gzsetparams(file, level, strategy) | 557 | int ZEXPORT gzsetparams(gzFile file, int level, int strategy) { |
598 | gzFile file; | ||
599 | int level; | ||
600 | int strategy; | ||
601 | { | ||
602 | gz_statep state; | 558 | gz_statep state; |
603 | z_streamp strm; | 559 | z_streamp strm; |
604 | 560 | ||
@@ -636,9 +592,7 @@ int ZEXPORT gzsetparams(file, level, strategy) | |||
636 | } | 592 | } |
637 | 593 | ||
638 | /* -- see zlib.h -- */ | 594 | /* -- see zlib.h -- */ |
639 | int ZEXPORT gzclose_w(file) | 595 | int ZEXPORT gzclose_w(gzFile file) { |
640 | gzFile file; | ||
641 | { | ||
642 | int ret = Z_OK; | 596 | int ret = Z_OK; |
643 | gz_statep state; | 597 | gz_statep state; |
644 | 598 | ||