]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed casting warnings about copying len into pending buf, replaced with calls to...
authorNathan Moinvaziri <nathan@nathanm.com>
Wed, 27 May 2020 00:10:17 +0000 (17:10 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 30 May 2020 19:25:18 +0000 (21:25 +0200)
  deflate.c(1413,45): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
  deflate.c(1414,50): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
  deflate.c(1415,46): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data
  deflate.c(1416,51): warning C4244: '=': conversion from 'unsigned int' to 'unsigned char', possible loss of data

deflate.c

index 138f02ae52aedce197a429429709c6f06477e228..dbee56d0605303eb6d5aefb2fecc22318ab9c4fb 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -1415,10 +1415,9 @@ static block_state deflate_stored(deflate_state *s, int flush) {
         zng_tr_stored_block(s, (char *)0, 0L, last);
 
         /* Replace the lengths in the dummy stored block with len. */
-        s->pending_buf[s->pending - 4] = len;
-        s->pending_buf[s->pending - 3] = len >> 8;
-        s->pending_buf[s->pending - 2] = ~len;
-        s->pending_buf[s->pending - 1] = ~len >> 8;
+        s->pending -= 4;
+        put_short(s, (uint16_t)len);
+        put_short(s, (uint16_t)~len);
 
         /* Write the stored block header bytes. */
         flush_pending(s->strm);