]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed casting warnings in calls to put_short and put_short_msb.
authorNathan Moinvaziri <nathan@nathanm.com>
Wed, 27 May 2020 00:19:17 +0000 (17:19 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 30 May 2020 19:25:18 +0000 (21:25 +0200)
  deflate.c(845,32): warning C4244: 'function': conversion from 'unsigned int' to 'uint16_t', possible loss of data
  deflate.c(894,50): warning C4244: 'function': conversion from 'unsigned int' to 'uint16_t', possible loss of data

deflate.c

index dbee56d0605303eb6d5aefb2fecc22318ab9c4fb..5e31ad0b5679492976a1bf41b401f9cc43c645d9 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -842,7 +842,7 @@ int ZEXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int flush) {
         if (s->strstart != 0) header |= PRESET_DICT;
         header += 31 - (header % 31);
 
-        put_short_msb(s, header);
+        put_short_msb(s, (uint16_t)header);
 
         /* Save the adler32 of the preset dictionary: */
         if (s->strstart != 0) {
@@ -891,7 +891,7 @@ int ZEXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int flush) {
                      (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0));
             put_byte(s, s->gzhead->os & 0xff);
             if (s->gzhead->extra != NULL) {
-                put_short(s, s->gzhead->extra_len);
+                put_short(s, (uint16_t)s->gzhead->extra_len);
             }
             if (s->gzhead->hcrc)
                 strm->adler = PREFIX(crc32)(strm->adler, s->pending_buf, s->pending);