[6.0] d74a55e1f Align code with with zlib 1.2.11.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Oct 17 21:28:09 UTC 2023


commit d74a55e1f27c10e5255369f76a24cdadc2249015
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Feb 25 09:24:22 2021 +0000

    Align code with with zlib 1.2.11.
    
    FreeBSD's code is undergoing some compatibility adaptations
    so we go directly to the source from here.
    
    PS: Please keep cochinelle out of libvgz.

diff --git a/lib/libvgz/deflate.c b/lib/libvgz/deflate.c
index 2a2544783..e4493c125 100644
--- a/lib/libvgz/deflate.c
+++ b/lib/libvgz/deflate.c
@@ -511,7 +511,7 @@ int ZEXPORT deflateResetKeep (strm)
         s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
 #endif
         adler32(0L, Z_NULL, 0);
-    s->last_flush = -2;
+    s->last_flush = Z_NO_FLUSH;
 
     _tr_init(s);
 
@@ -606,12 +606,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
     func = configuration_table[s->level].func;
 
     if ((strategy != s->strategy || func != configuration_table[level].func) &&
-        s->last_flush != -2) {
+        s->high_water) {
         /* Flush the last buffer: */
         int err = deflate(strm, Z_BLOCK);
         if (err == Z_STREAM_ERROR)
             return err;
-        if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
+        if (strm->avail_out == 0)
             return Z_BUF_ERROR;
     }
     if (s->level != level) {
diff --git a/lib/libvgz/vgz.h b/lib/libvgz/vgz.h
index 1bb81009d..342a0fba5 100644
--- a/lib/libvgz/vgz.h
+++ b/lib/libvgz/vgz.h
@@ -717,12 +717,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
    used to switch between compression and straight copy of the input data, or
    to switch to a different kind of input data requiring a different strategy.
    If the compression approach (which is a function of the level) or the
-   strategy is changed, and if there have been any deflate() calls since the
-   state was initialized or reset, then the input available so far is
-   compressed with the old level and strategy using deflate(strm, Z_BLOCK).
-   There are three approaches for the compression levels 0, 1..3, and 4..9
-   respectively.  The new level and strategy will take effect at the next call
-   of deflate().
+   strategy is changed, and if any input has been consumed in a previous
+   deflate() call, then the input available so far is compressed with the old
+   level and strategy using deflate(strm, Z_BLOCK).  There are three approaches
+   for the compression levels 0, 1..3, and 4..9 respectively.  The new level
+   and strategy will take effect at the next call of deflate().
 
      If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
    not have enough output space to complete, then the parameter change will not
diff --git a/lib/libvgz/zconf.h b/lib/libvgz/zconf.h
index 1afeed62a..21f3eada7 100644
--- a/lib/libvgz/zconf.h
+++ b/lib/libvgz/zconf.h
@@ -3,7 +3,7 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-/* @(#) $FreeBSD: head/contrib/zlib/zconf.h 311285 2017-01-04 16:09:08Z delphij $ */
+/* @(#) $Id$ */
 
 #ifndef ZCONF_H
 #define ZCONF_H
@@ -431,7 +431,7 @@ typedef uLong FAR uLongf;
    typedef unsigned long z_crc_t;
 #endif
 
-#if 0    /* was set to #if 0 by ./configure */
+#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
 #  define Z_HAVE_UNISTD_H
 #endif
 
@@ -500,15 +500,8 @@ typedef uLong FAR uLongf;
 #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
 #endif
 
-/*
- * This is hard-configured for FreeBSD.
- */
-#define	z_off_t	off_t
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-
 #ifndef z_off_t
+# error "z_off_t missing"
 #  define z_off_t long
 #endif
 


More information about the varnish-commit mailing list