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.
This commit is contained in:
Mark Adler 2013-03-24 22:12:31 -07:00
parent 81c3068b9a
commit c661c374e8

View File

@ -513,6 +513,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
strm->total_in != 0) { strm->total_in != 0) {
/* Flush the last buffer: */ /* Flush the last buffer: */
err = deflate(strm, Z_BLOCK); err = deflate(strm, Z_BLOCK);
if (err == Z_BUF_ERROR && s->pending == 0)
err = Z_OK;
} }
if (s->level != level) { if (s->level != level) {
s->level = level; s->level = level;