From: Hans Kristian Rosbach Date: Sat, 29 Aug 2020 08:29:43 +0000 (+0200) Subject: Move and reduce size of s->pending_buf_size X-Git-Tag: 1.9.9-b1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7cd452ca9d8543c9a7c4306d0139dbb46176827;p=thirdparty%2Fzlib-ng.git Move and reduce size of s->pending_buf_size --- diff --git a/deflate.c b/deflate.c index 6757e24b..6b79939b 100644 --- a/deflate.c +++ b/deflate.c @@ -373,7 +373,7 @@ int32_t Z_EXPORT PREFIX(deflateInit2_)(PREFIX3(stream) *strm, int32_t level, int */ s->pending_buf = (unsigned char *) ZALLOC(strm, s->lit_bufsize, 4); - s->pending_buf_size = (unsigned long)s->lit_bufsize * 4; + s->pending_buf_size = s->lit_bufsize * 4; if (s->window == NULL || s->prev == NULL || s->head == NULL || s->pending_buf == NULL) { @@ -1132,7 +1132,7 @@ int32_t Z_EXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *sou memcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(unsigned char)); memcpy((void *)ds->prev, (void *)ss->prev, ds->w_size * sizeof(Pos)); memcpy((void *)ds->head, (void *)ss->head, HASH_SIZE * sizeof(Pos)); - memcpy(ds->pending_buf, ss->pending_buf, (unsigned int)ds->pending_buf_size); + memcpy(ds->pending_buf, ss->pending_buf, ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); ds->sym_buf = ds->pending_buf + ds->lit_bufsize; diff --git a/deflate.h b/deflate.h index 11b9973f..a8d7aad3 100644 --- a/deflate.h +++ b/deflate.h @@ -107,12 +107,12 @@ typedef uint16_t Pos; typedef struct internal_state { PREFIX3(stream) *strm; /* pointer back to this zlib stream */ unsigned char *pending_buf; /* output still pending */ - unsigned long pending_buf_size; /* size of pending_buf */ unsigned char *pending_out; /* next pending byte to output to the stream */ + uint32_t pending_buf_size; /* size of pending_buf */ uint32_t pending; /* nb of bytes in the pending buffer */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - PREFIX(gz_headerp) gzhead; /* gzip header information to write */ uint32_t gzindex; /* where in extra, name, or comment */ + PREFIX(gz_headerp) gzhead; /* gzip header information to write */ int status; /* as the name implies */ unsigned char method; /* can only be DEFLATED */ int last_flush; /* value of flush param for previous deflate call */