{
maybe_init();
- if(zs.next_out == 0 || (zs.next_in == 0 && zs.avail_in != 0) ||
+ if(zs.next_in == nullptr && zs.avail_in != 0)
+ BOOST_THROW_EXCEPTION(std::invalid_argument{"invalid input"});
+
+ if(zs.next_out == nullptr ||
(status_ == FINISH_STATE && flush != Flush::finish))
{
ec = error::stream_error;
}
}
else if(zs.avail_in == 0 && (
- old_flush && flush <= *old_flush
+ old_flush && flush <= *old_flush // Caution: depends on enum order
) && flush != Flush::finish)
{
/* Make sure there is something to do and avoid duplicate consecutive
else if(flush != Flush::block)
{
/* FULL_FLUSH or SYNC_FLUSH */
- tr_stored_block((char*)0, 0L, 0);
+ tr_stored_block(nullptr, 0L, 0);
/* For a full flush, this empty block will be recognized
* as a special marker by inflate_sync().
*/
put_short((std::uint16_t)len);
put_short((std::uint16_t)~len);
}
- // VFALCO Use memcpy?
- while (len--)
- put_byte(*buf++);
+ if(buf)
+ std::memcpy(&pending_buf_[pending_], buf, len);
+ pending_ += len;
}
//------------------------------------------------------------------------------