From c661c374e8df43365738daa09f4390d61bc57f08 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Sun, 24 Mar 2013 22:12:31 -0700 Subject: [PATCH] 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. --- deflate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deflate.c b/deflate.c index 4aa5afb9..a942e252 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;