From 96f397546006724afff6bffce35a9c981de58938 Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Tue, 26 May 2020 17:10:17 -0700 Subject: [PATCH] Fixed casting warnings about copying len into pending buf, replaced with calls to put_short. 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/deflate.c b/deflate.c index 138f02ae..dbee56d0 100644 --- 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); -- 2.47.2