[erlang-questions] zlib deflate problem

Matthew Dempsky <>
Wed May 21 18:06:39 CEST 2008

On Wed, May 21, 2008 at 12:55 AM, Sverker Eriksson
<> wrote:
> As I understand it, a return of Z_BUF_ERROR from inflate() means
> something like "call me again with more buffer space". But in this case
> we don't call again.

zlib.h says "inflate() returns [...] Z_BUF_ERROR if no progress is
possible or if there was not enough room in the output buffer when
Z_FINISH is used."  zlib_drv.c calls inflate() with  with Z_NO_FLUSH,
not Z_FINISH, so Z_BUF_ERROR can only indicate no progress was
possible, which will be correctly handled by noticing that avail_out
!= 0.

(However, it now seems suspicious to me now that the flush argument to
zlib_inflate() is unused.)

More information about the erlang-questions mailing list