Re: Z_SYNC_FLUSH and adding empty blocks after that (_tr_align)



On Mar 28, 9:41 pm, byaa...@xxxxxxxxx wrote:
I am trying to add dummy data for a certain number of bytes after I am
done calling deflate.

To do this, I first call deflate with Z_SYNC_FLUSH to ensure it has
ended on a byte boundary.

Good, then that's all you need to do. (You don't need to mess with
the internal zlib routines.) Simply make sure you get all of the
output from deflate, indicated by avail_out not zero, after providing
all of the input. Then you're done with deflate (call deflateEnd() or
deflateReset()).

Now you can append empty blocks as desired. The last empty block
needs to have its last bit set.

Mark

.



Relevant Pages