diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2016-12-30 22:05:05 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2016-12-30 23:42:10 -0800 |
commit | 8f147c3d12591a811c5438c011d4203bb7fc5260 (patch) | |
tree | 72456761e2a029716ba4cf0b2e598c67f8ed73e6 | |
parent | fb26fc427fb5b628e1ee062d08be334c1b8c3bbe (diff) | |
download | zlib-8f147c3d12591a811c5438c011d4203bb7fc5260.tar.gz zlib-8f147c3d12591a811c5438c011d4203bb7fc5260.tar.bz2 zlib-8f147c3d12591a811c5438c011d4203bb7fc5260.zip |
Avoid some random compiler warnings on various platforms.
-rw-r--r-- | deflate.c | 7 | ||||
-rw-r--r-- | gzwrite.c | 2 | ||||
-rw-r--r-- | inftrees.c | 4 | ||||
-rw-r--r-- | test/example.c | 7 | ||||
-rw-r--r-- | test/minigzip.c | 4 | ||||
-rw-r--r-- | trees.c | 2 |
6 files changed, 14 insertions, 12 deletions
@@ -447,11 +447,12 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) | |||
447 | uInt *dictLength; | 447 | uInt *dictLength; |
448 | { | 448 | { |
449 | deflate_state *s; | 449 | deflate_state *s; |
450 | uInt len; | ||
450 | 451 | ||
451 | if (deflateStateCheck(strm)) | 452 | if (deflateStateCheck(strm)) |
452 | return Z_STREAM_ERROR; | 453 | return Z_STREAM_ERROR; |
453 | s = strm->state; | 454 | s = strm->state; |
454 | uInt len = s->strstart + s->lookahead; | 455 | len = s->strstart + s->lookahead; |
455 | if (len > s->w_size) | 456 | if (len > s->w_size) |
456 | len = s->w_size; | 457 | len = s->w_size; |
457 | if (dictionary != Z_NULL && len) | 458 | if (dictionary != Z_NULL && len) |
@@ -1758,12 +1759,12 @@ local block_state deflate_stored(s, flush) | |||
1758 | * code following this won't be able to either. | 1759 | * code following this won't be able to either. |
1759 | */ | 1760 | */ |
1760 | if (flush != Z_NO_FLUSH && s->strm->avail_in == 0 && | 1761 | if (flush != Z_NO_FLUSH && s->strm->avail_in == 0 && |
1761 | s->strstart == s->block_start) | 1762 | (long)s->strstart == s->block_start) |
1762 | return flush == Z_FINISH ? finish_done : block_done; | 1763 | return flush == Z_FINISH ? finish_done : block_done; |
1763 | 1764 | ||
1764 | /* Fill the window with any remaining input. */ | 1765 | /* Fill the window with any remaining input. */ |
1765 | have = s->window_size - s->strstart - 1; | 1766 | have = s->window_size - s->strstart - 1; |
1766 | if (s->strm->avail_in > have && s->block_start >= s->w_size) { | 1767 | if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) { |
1767 | /* Slide the window down. */ | 1768 | /* Slide the window down. */ |
1768 | s->block_start -= s->w_size; | 1769 | s->block_start -= s->w_size; |
1769 | s->strstart -= s->w_size; | 1770 | s->strstart -= s->w_size; |
@@ -225,7 +225,7 @@ local z_size_t gz_write(state, buf, len) | |||
225 | /* directly compress user buffer to file */ | 225 | /* directly compress user buffer to file */ |
226 | state->strm.next_in = (z_const Bytef *)buf; | 226 | state->strm.next_in = (z_const Bytef *)buf; |
227 | do { | 227 | do { |
228 | unsigned n = -1; | 228 | unsigned n = (unsigned)-1; |
229 | if (n > len) | 229 | if (n > len) |
230 | n = len; | 230 | n = len; |
231 | state->strm.avail_in = n; | 231 | state->strm.avail_in = n; |
@@ -188,7 +188,7 @@ unsigned short FAR *work; | |||
188 | extra = lext; | 188 | extra = lext; |
189 | match = 257; | 189 | match = 257; |
190 | break; | 190 | break; |
191 | case DISTS: | 191 | default: /* DISTS */ |
192 | base = dbase; | 192 | base = dbase; |
193 | extra = dext; | 193 | extra = dext; |
194 | match = 0; | 194 | match = 0; |
@@ -214,7 +214,7 @@ unsigned short FAR *work; | |||
214 | for (;;) { | 214 | for (;;) { |
215 | /* create table entry */ | 215 | /* create table entry */ |
216 | here.bits = (unsigned char)(len - drop); | 216 | here.bits = (unsigned char)(len - drop); |
217 | if (work[sym] + 1 < match) { | 217 | if (work[sym] + 1U < match) { |
218 | here.op = (unsigned char)0; | 218 | here.op = (unsigned char)0; |
219 | here.val = work[sym]; | 219 | here.val = work[sym]; |
220 | } | 220 | } |
diff --git a/test/example.c b/test/example.c index 104b2b7..f008749 100644 --- a/test/example.c +++ b/test/example.c | |||
@@ -59,13 +59,13 @@ void *myalloc(q, n, m) | |||
59 | void *q; | 59 | void *q; |
60 | unsigned n, m; | 60 | unsigned n, m; |
61 | { | 61 | { |
62 | q = Z_NULL; | 62 | (void)q; |
63 | return calloc(n, m); | 63 | return calloc(n, m); |
64 | } | 64 | } |
65 | 65 | ||
66 | void myfree(void *q, void *p) | 66 | void myfree(void *q, void *p) |
67 | { | 67 | { |
68 | q = Z_NULL; | 68 | (void)q; |
69 | free(p); | 69 | free(p); |
70 | } | 70 | } |
71 | 71 | ||
@@ -573,7 +573,8 @@ int main(argc, argv) | |||
573 | } | 573 | } |
574 | 574 | ||
575 | #ifdef Z_SOLO | 575 | #ifdef Z_SOLO |
576 | argc = strlen(argv[0]); | 576 | (void)argc; |
577 | (void)argv; | ||
577 | #else | 578 | #else |
578 | test_compress(compr, comprLen, uncompr, uncomprLen); | 579 | test_compress(compr, comprLen, uncompr, uncomprLen); |
579 | 580 | ||
diff --git a/test/minigzip.c b/test/minigzip.c index 850458c..b392304 100644 --- a/test/minigzip.c +++ b/test/minigzip.c | |||
@@ -156,14 +156,14 @@ void *myalloc(q, n, m) | |||
156 | void *q; | 156 | void *q; |
157 | unsigned n, m; | 157 | unsigned n, m; |
158 | { | 158 | { |
159 | q = Z_NULL; | 159 | (void)q; |
160 | return calloc(n, m); | 160 | return calloc(n, m); |
161 | } | 161 | } |
162 | 162 | ||
163 | void myfree(q, p) | 163 | void myfree(q, p) |
164 | void *q, *p; | 164 | void *q, *p; |
165 | { | 165 | { |
166 | q = Z_NULL; | 166 | (void)q; |
167 | free(p); | 167 | free(p); |
168 | } | 168 | } |
169 | 169 | ||
@@ -870,7 +870,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) | |||
870 | bi_windup(s); /* align on byte boundary */ | 870 | bi_windup(s); /* align on byte boundary */ |
871 | put_short(s, (ush)stored_len); | 871 | put_short(s, (ush)stored_len); |
872 | put_short(s, (ush)~stored_len); | 872 | put_short(s, (ush)~stored_len); |
873 | zmemcpy(s->pending_buf + s->pending, buf, stored_len); | 873 | zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); |
874 | s->pending += stored_len; | 874 | s->pending += stored_len; |
875 | #ifdef ZLIB_DEBUG | 875 | #ifdef ZLIB_DEBUG |
876 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; | 876 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; |