]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Move and reduce size of s->pending_buf_size
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 29 Aug 2020 08:29:43 +0000 (10:29 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 31 Aug 2020 11:22:54 +0000 (13:22 +0200)
deflate.c
deflate.h

index 6757e24bc96129f02594c35909932b5dc88cbaf8..6b79939badfeab61b63214c5728b17c037030fff 100644 (file)
--- 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;
index 11b9973f97aac6776b71ee3f9ac467a7df4aac33..a8d7aad3658e65472e0da5569b11b591d1b93860 100644 (file)
--- 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 */