]> git.lizzy.rs Git - zlib.git/commitdiff
Avoid some random compiler warnings on various platforms.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 31 Dec 2016 06:05:05 +0000 (22:05 -0800)
committerMark Adler <madler@alumni.caltech.edu>
Sat, 31 Dec 2016 07:42:10 +0000 (23:42 -0800)
deflate.c
gzwrite.c
inftrees.c
test/example.c
test/minigzip.c
trees.c

index cf4c056edec8008602055c71aa42691c82c40fd5..9079741117cd7f10678983c0ed979f9925a54e15 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -447,11 +447,12 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
     uInt  *dictLength;
 {
     deflate_state *s;
+    uInt len;
 
     if (deflateStateCheck(strm))
         return Z_STREAM_ERROR;
     s = strm->state;
-    uInt len = s->strstart + s->lookahead;
+    len = s->strstart + s->lookahead;
     if (len > s->w_size)
         len = s->w_size;
     if (dictionary != Z_NULL && len)
@@ -1758,12 +1759,12 @@ local block_state deflate_stored(s, flush)
      * code following this won't be able to either.
      */
     if (flush != Z_NO_FLUSH && s->strm->avail_in == 0 &&
-        s->strstart == s->block_start)
+        (long)s->strstart == s->block_start)
         return flush == Z_FINISH ? finish_done : block_done;
 
     /* Fill the window with any remaining input. */
     have = s->window_size - s->strstart - 1;
-    if (s->strm->avail_in > have && s->block_start >= s->w_size) {
+    if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
         /* Slide the window down. */
         s->block_start -= s->w_size;
         s->strstart -= s->w_size;
index 24205140af2294853492a0f5d24923a3aca9e471..c29308b75f0d5342672b3a999fb848cea09263dd 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -225,7 +225,7 @@ local z_size_t gz_write(state, buf, len)
         /* directly compress user buffer to file */
         state->strm.next_in = (z_const Bytef *)buf;
         do {
-            unsigned n = -1;
+            unsigned n = (unsigned)-1;
             if (n > len)
                 n = len;
             state->strm.avail_in = n;
index 0ea34eba1f04eda10fc12154f937d267d1233b7f..8b2ad4f918997d77dce4add616d8a2e2855f2e7f 100644 (file)
@@ -188,7 +188,7 @@ unsigned short FAR *work;
         extra = lext;
         match = 257;
         break;
-    case DISTS:
+    default:    /* DISTS */
         base = dbase;
         extra = dext;
         match = 0;
@@ -214,7 +214,7 @@ unsigned short FAR *work;
     for (;;) {
         /* create table entry */
         here.bits = (unsigned char)(len - drop);
-        if (work[sym] + 1 < match) {
+        if (work[sym] + 1U < match) {
             here.op = (unsigned char)0;
             here.val = work[sym];
         }
index 104b2b7ea706bcd9abd6a0ae2c68751e6ca9727a..f008749ac62dee8d28213f7dfdbbee7d293e30d2 100644 (file)
@@ -59,13 +59,13 @@ void *myalloc(q, n, m)
     void *q;
     unsigned n, m;
 {
-    q = Z_NULL;
+    (void)q;
     return calloc(n, m);
 }
 
 void myfree(void *q, void *p)
 {
-    q = Z_NULL;
+    (void)q;
     free(p);
 }
 
@@ -573,7 +573,8 @@ int main(argc, argv)
     }
 
 #ifdef Z_SOLO
-    argc = strlen(argv[0]);
+    (void)argc;
+    (void)argv;
 #else
     test_compress(compr, comprLen, uncompr, uncomprLen);
 
index 850458c03a3259ee385084f2950bb35ff6169370..b3923040fc21a6345d371cb4db75505359d81bcd 100644 (file)
@@ -156,14 +156,14 @@ void *myalloc(q, n, m)
     void *q;
     unsigned n, m;
 {
-    q = Z_NULL;
+    (void)q;
     return calloc(n, m);
 }
 
 void myfree(q, p)
     void *q, *p;
 {
-    q = Z_NULL;
+    (void)q;
     free(p);
 }
 
diff --git a/trees.c b/trees.c
index 685a388acff9fc14d644de5454ca46404b49c6dc..559a0de1ee3fe894cce9653d5c4e98e85abb0581 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -870,7 +870,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
     bi_windup(s);        /* align on byte boundary */
     put_short(s, (ush)stored_len);
     put_short(s, (ush)~stored_len);
-    zmemcpy(s->pending_buf + s->pending, buf, stored_len);
+    zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
     s->pending += stored_len;
 #ifdef ZLIB_DEBUG
     s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;