]> git.ipfire.org Git - thirdparty/zlib-ng.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)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 7 Feb 2017 09:33:09 +0000 (10:33 +0100)
deflate.c
gzwrite.c
inftrees.c
trees.c

index 90415d35a646a05fd32fd017901c0832d6b3a0d0..2b3e88f2f209d41b7a5902e753b932b4e48ecf1b 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -418,11 +418,12 @@ int ZEXPORT deflateSetDictionary(z_stream *strm, const unsigned char *dictionary
 /* ========================================================================= */
 int ZEXPORT deflateGetDictionary (z_stream *strm, unsigned char *dictionary, unsigned int  *dictLength) {
     deflate_state *s;
+    unsigned int len;
 
     if (deflateStateCheck(strm))
         return Z_STREAM_ERROR;
     s = strm->state;
-    unsigned int len = s->strstart + s->lookahead;
+    len = s->strstart + s->lookahead;
     if (len > s->w_size)
         len = s->w_size;
     if (dictionary != NULL && len)
@@ -1434,12 +1435,12 @@ static block_state deflate_stored(deflate_state *s, int 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 216d978ac896036d54db81008f28ecaf00c5cfa3..71d50b1e5406239a38d4c8e2ad420b540f3c046a 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -203,7 +203,7 @@ static size_t gz_write(gz_statep state, void const *buf, size_t len) {
         /* directly compress user buffer to file */
         state->strm.next_in = (const unsigned char *)buf;
         do {
-            unsigned n = -1;
+            unsigned n = (unsigned)-1;
             if (n > len)
                 n = len;
             state->strm.avail_in = n;
index 5bb3cc5d3a7e5faa07256268fc75279e1e1731f3..d943adc74583d46f3786051e95ab678ca521e15d 100644 (file)
@@ -181,7 +181,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, uint16_t *lens, unsigned codes,
         extra = lext;
         match = 257;
         break;
-    case DISTS:
+    default:    /* DISTS */
         base = dbase;
         extra = dext;
         match = 0;
@@ -207,7 +207,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, uint16_t *lens, unsigned codes,
     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];
         } else if (work[sym] >= match) {
diff --git a/trees.c b/trees.c
index f10caa4b2cc4a2a709a4daa12a96142988787f4b..0beafc724cbc474933b1809351741655164588d7 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -796,7 +796,7 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, unsigned long s
     bi_windup(s);        /* align on byte boundary */
     put_short(s, (uint16_t)stored_len);
     put_short(s, (uint16_t)~stored_len);
-    memcpy(s->pending_buf + s->pending, buf, stored_len);
+    memcpy(s->pending_buf + s->pending, (unsigned char *)buf, stored_len);
     s->pending += stored_len;
 #ifdef ZLIB_DEBUG
     s->compressed_len = (s->compressed_len + 3 + 7) & (unsigned long)~7L;