Currently, zpq_stream contains a check only for the tx buffered data - zpq_buffered().
I think that there should be the same functionality for rx buffered data. For example, the zpq_buffered_rx().
zpq_buffered_rx() returns a value greater than zero if there is any data that was fetched by rx_func() but haven't been decompressed yet, in any other case zpq_buffered_rx() returns zero.
In this case, I think that we may also rename the existing zpq_buffered() to zpq_buffered_tx() for clarity.

Daniil Zakhlystov