Commit d74a55e1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Dridi Boukelmoune

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.
parent 47bca247
......@@ -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) {
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment