From: Mark Adler Date: Mon, 25 Mar 2013 05:12:31 +0000 (-0700) Subject: Do not return Z_BUF_ERROR if deflateParam() has nothing to write. X-Git-Tag: v1.2.7.1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c661c374e8df43365738daa09f4390d61bc57f08;p=thirdparty%2Fzlib-ng.git Do not return Z_BUF_ERROR if deflateParam() has nothing to write. If the compressed data was already at a block boundary, then deflateParam() would report Z_BUF_ERROR, because there was nothing to write. With this patch, Z_OK is returned in that case. --- diff --git a/deflate.c b/deflate.c index 4aa5afb94..a942e2528 100644 --- a/deflate.c +++ b/deflate.c @@ -513,6 +513,8 @@ int ZEXPORT deflateParams(strm, level, strategy) strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_BLOCK); + if (err == Z_BUF_ERROR && s->pending == 0) + err = Z_OK; } if (s->level != level) { s->level = level;