summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2013-03-24 22:12:31 -0700
committerMark Adler <madler@alumni.caltech.edu>2013-03-24 22:15:04 -0700
commitc661c374e8df43365738daa09f4390d61bc57f08 (patch)
tree6aacaf41324478393daa5fb098a484bc0e9e0f6c
parent81c3068b9ac4e75a4c65338e5b95f421478f5295 (diff)
downloadzlib-c661c374e8df43365738daa09f4390d61bc57f08.tar.gz
zlib-c661c374e8df43365738daa09f4390d61bc57f08.tar.bz2
zlib-c661c374e8df43365738daa09f4390d61bc57f08.zip
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.
-rw-r--r--deflate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/deflate.c b/deflate.c
index 4aa5afb..a942e25 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;