*buffer means sbuffer, zbuffer, fbuffer, and vrefbuffer.
The logic is as follows:
if buf is NULL
if len is 0
do nothing return 0 (success)
else
assertion fail
else
set contants to *buffer
When a zlib stream has avail_in == 0, it will deflate with a Z_BUF_ERROR
to indicate that "no progress is possible". A zbuffer write with an
empty string will trigger this condition, and the write call
returns/raises an error/exception. The fix is simple: change the
do/while to a while loop, so that it only tries to deflate if there is
actually data to deflate.