Commit ee820b5e5b2a4145ef2266052acd306367051d4c
Committed by
Tom Rini
1 parent
960d70c600
Exists in
master
and in
54 other branches
lib/zlib: sparse fixes
define Z_NULL to (void *)0 include/u-boot/zlib.h to get rid of most of the NULL pointer warnings. inflate.c:942:1: warning: non-ANSI definition of function 'inflateEnd' inflate.c:9:1: warning: non-ANSI definition of function 'inflateReset' inflate.c:12:17: warning: Using plain integer as NULL pointer inflate.c:12:42: warning: Using plain integer as NULL pointer inflate.c:15:17: warning: Using plain integer as NULL pointer inflate.c:21:19: warning: Using plain integer as NULL pointer inflate.c:35:1: warning: non-ANSI definition of function 'inflateInit2_' inflate.c:38:20: warning: Using plain integer as NULL pointer inflate.c:41:17: warning: Using plain integer as NULL pointer inflate.c:42:17: warning: Using plain integer as NULL pointer inflate.c:50:18: warning: Using plain integer as NULL pointer inflate.c:65:23: warning: Using plain integer as NULL pointer inflate.c:69:21: warning: Using plain integer as NULL pointer inflate.c:78:1: warning: non-ANSI definition of function 'inflateInit_' inflate.c:86:1: warning: non-ANSI definition of function 'fixedtables' inflate.c:108:26: warning: Using plain integer as NULL pointer inflate.c:109:1: warning: non-ANSI definition of function 'updatewindow' inflate.c:112:30: warning: Using plain integer as NULL pointer inflate.c:339:1: warning: non-ANSI definition of function 'inflate' inflate.c:349:17: warning: Using plain integer as NULL pointer inflate.c:349:42: warning: Using plain integer as NULL pointer inflate.c:350:27: warning: Using plain integer as NULL pointer inflate.c:369:42: warning: Using plain integer as NULL pointer inflate.c:376:32: warning: Using plain integer as NULL pointer inflate.c:401:54: warning: Using plain integer as NULL pointer inflate.c:419:32: warning: Using plain integer as NULL pointer inflate.c:426:32: warning: Using plain integer as NULL pointer inflate.c:433:32: warning: Using plain integer as NULL pointer inflate.c:444:36: warning: Using plain integer as NULL pointer inflate.c:449:37: warning: Using plain integer as NULL pointer inflate.c:450:38: warning: Using plain integer as NULL pointer inflate.c:457:40: warning: Using plain integer as NULL pointer inflate.c:458:47: warning: Using plain integer as NULL pointer inflate.c:480:40: warning: Using plain integer as NULL pointer inflate.c:481:50: warning: Using plain integer as NULL pointer inflate.c:491:37: warning: Using plain integer as NULL pointer inflate.c:492:37: warning: Using plain integer as NULL pointer inflate.c:501:40: warning: Using plain integer as NULL pointer inflate.c:502:53: warning: Using plain integer as NULL pointer inflate.c:512:37: warning: Using plain integer as NULL pointer inflate.c:513:40: warning: Using plain integer as NULL pointer inflate.c:525:32: warning: Using plain integer as NULL pointer inflate.c:529:52: warning: Using plain integer as NULL pointer inflate.c:543:54: warning: Using plain integer as NULL pointer inflate.c:932:17: warning: Using plain integer as NULL pointer inflate.c:932:42: warning: Using plain integer as NULL pointer inflate.c:935:26: warning: Using plain integer as NULL pointer inflate.c:940:19: warning: Using plain integer as NULL pointer adler32.c:58:5: warning: non-ANSI definition of function 'adler32' adler32.c:81:16: warning: Using plain integer as NULL pointer zutil.c:53:9: warning: non-ANSI definition of function 'zcalloc' zutil.c:64:9: warning: non-ANSI definition of function 'zcfree' inffast.c:70:1: warning: non-ANSI definition of function 'inflate_fast' inftrees.c:33:1: warning: non-ANSI definition of function 'inflate_table' Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Showing 6 changed files with 17 additions and 44 deletions Side-by-side Diff
include/u-boot/zlib.h
... | ... | @@ -505,7 +505,7 @@ |
505 | 505 | #define Z_DEFLATED 8 |
506 | 506 | /* The deflate compression method (the only one supported in this version) */ |
507 | 507 | |
508 | -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | |
508 | +#define Z_NULL (void *)0 /* for initializing zalloc, zfree, opaque */ | |
509 | 509 | |
510 | 510 | /* basic functions */ |
511 | 511 |
lib/zlib/adler32.c
... | ... | @@ -54,10 +54,7 @@ |
54 | 54 | #endif |
55 | 55 | |
56 | 56 | /* ========================================================================= */ |
57 | -uLong ZEXPORT adler32(adler, buf, len) | |
58 | - uLong adler; | |
59 | - const Bytef *buf; | |
60 | - uInt len; | |
57 | +uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) | |
61 | 58 | { |
62 | 59 | unsigned long sum2; |
63 | 60 | unsigned n; |
lib/zlib/inffast.c
... | ... | @@ -66,9 +66,8 @@ |
66 | 66 | requires strm->avail_out >= 258 for each loop to avoid checking for |
67 | 67 | output space. |
68 | 68 | */ |
69 | -void inflate_fast(strm, start) | |
70 | -z_streamp strm; | |
71 | -unsigned start; /* inflate()'s starting value for strm->avail_out */ | |
69 | +void inflate_fast(z_streamp strm, unsigned start) | |
70 | +/* start: inflate()'s starting value for strm->avail_out */ | |
72 | 71 | { |
73 | 72 | struct inflate_state FAR *state; |
74 | 73 | unsigned char FAR *in; /* local strm->next_in */ |
lib/zlib/inflate.c
... | ... | @@ -5,8 +5,7 @@ |
5 | 5 | local void fixedtables OF((struct inflate_state FAR *state)); |
6 | 6 | local int updatewindow OF((z_streamp strm, unsigned out)); |
7 | 7 | |
8 | -int ZEXPORT inflateReset(strm) | |
9 | -z_streamp strm; | |
8 | +int ZEXPORT inflateReset(z_streamp strm) | |
10 | 9 | { |
11 | 10 | struct inflate_state FAR *state; |
12 | 11 | |
... | ... | @@ -31,11 +30,8 @@ |
31 | 30 | return Z_OK; |
32 | 31 | } |
33 | 32 | |
34 | -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) | |
35 | -z_streamp strm; | |
36 | -int windowBits; | |
37 | -const char *version; | |
38 | -int stream_size; | |
33 | +int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, | |
34 | + int stream_size) | |
39 | 35 | { |
40 | 36 | struct inflate_state FAR *state; |
41 | 37 | |
42 | 38 | |
... | ... | @@ -74,16 +70,12 @@ |
74 | 70 | return inflateReset(strm); |
75 | 71 | } |
76 | 72 | |
77 | -int ZEXPORT inflateInit_(strm, version, stream_size) | |
78 | -z_streamp strm; | |
79 | -const char *version; | |
80 | -int stream_size; | |
73 | +int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size) | |
81 | 74 | { |
82 | 75 | return inflateInit2_(strm, DEF_WBITS, version, stream_size); |
83 | 76 | } |
84 | 77 | |
85 | -local void fixedtables(state) | |
86 | -struct inflate_state FAR *state; | |
78 | +local void fixedtables(struct inflate_state FAR *state) | |
87 | 79 | { |
88 | 80 | state->lencode = lenfix; |
89 | 81 | state->lenbits = 9; |
... | ... | @@ -105,9 +97,7 @@ |
105 | 97 | output will fall in the output data, making match copies simpler and faster. |
106 | 98 | The advantage may be dependent on the size of the processor's data caches. |
107 | 99 | */ |
108 | -local int updatewindow(strm, out) | |
109 | -z_streamp strm; | |
110 | -unsigned out; | |
100 | +local int updatewindow(z_streamp strm, unsigned out) | |
111 | 101 | { |
112 | 102 | struct inflate_state FAR *state; |
113 | 103 | unsigned copy, dist; |
... | ... | @@ -335,9 +325,7 @@ |
335 | 325 | when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it |
336 | 326 | will return Z_BUF_ERROR if it has not reached the end of the stream. |
337 | 327 | */ |
338 | -int ZEXPORT inflate(strm, flush) | |
339 | -z_streamp strm; | |
340 | -int flush; | |
328 | +int ZEXPORT inflate(z_streamp strm, int flush) | |
341 | 329 | { |
342 | 330 | struct inflate_state FAR *state; |
343 | 331 | unsigned char FAR *next; /* next input */ |
... | ... | @@ -938,8 +926,7 @@ |
938 | 926 | return ret; |
939 | 927 | } |
940 | 928 | |
941 | -int ZEXPORT inflateEnd(strm) | |
942 | -z_streamp strm; | |
929 | +int ZEXPORT inflateEnd(z_streamp strm) | |
943 | 930 | { |
944 | 931 | struct inflate_state FAR *state; |
945 | 932 | if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) |
lib/zlib/inftrees.c
... | ... | @@ -29,13 +29,9 @@ |
29 | 29 | table index bits. It will differ if the request is greater than the |
30 | 30 | longest code or if it is less than the shortest code. |
31 | 31 | */ |
32 | -int inflate_table(type, lens, codes, table, bits, work) | |
33 | -codetype type; | |
34 | -unsigned short FAR *lens; | |
35 | -unsigned codes; | |
36 | -code FAR * FAR *table; | |
37 | -unsigned FAR *bits; | |
38 | -unsigned short FAR *work; | |
32 | +int inflate_table(codetype type, unsigned short FAR *lens, unsigned codes, | |
33 | + code FAR * FAR *table, unsigned FAR *bits, | |
34 | + unsigned short FAR *work) | |
39 | 35 | { |
40 | 36 | unsigned len; /* a code's length in bits */ |
41 | 37 | unsigned sym; /* index of code symbols */ |
lib/zlib/zutil.c
... | ... | @@ -49,10 +49,7 @@ |
49 | 49 | extern void free OF((voidpf ptr)); |
50 | 50 | #endif |
51 | 51 | |
52 | -voidpf zcalloc (opaque, items, size) | |
53 | - voidpf opaque; | |
54 | - unsigned items; | |
55 | - unsigned size; | |
52 | +voidpf zcalloc(voidpf opaque, unsigned items, unsigned size) | |
56 | 53 | { |
57 | 54 | if (opaque) |
58 | 55 | items += size - size; /* make compiler happy */ |
... | ... | @@ -60,10 +57,7 @@ |
60 | 57 | (voidpf)calloc(items, size); |
61 | 58 | } |
62 | 59 | |
63 | -void zcfree (opaque, ptr, nb) | |
64 | - voidpf opaque; | |
65 | - voidpf ptr; | |
66 | - unsigned nb; | |
60 | +void zcfree(voidpf opaque, voidpf ptr, unsigned nb) | |
67 | 61 | { |
68 | 62 | free(ptr); |
69 | 63 | if (opaque) |