void BufferedStream::close(CloseType type) { MORDOR_LOG_VERBOSE(g_log) << this << " close(" << type << ")"; if (type & READ) m_readBuffer.clear(); try { if ((type & WRITE) && m_writeBuffer.readAvailable()) flush(false); } catch (...) { if (ownsParent()) parent()->close(type); throw; } if (ownsParent()) parent()->close(type); }
void ZlibStream::close(CloseType type) { if ((type == READ && supportsWrite()) || (type == WRITE && supportsRead()) || m_closed) { if (ownsParent()) parent()->close(type); return; } if (supportsRead()) { inflateEnd(&m_strm); } else { flush(Z_FINISH); deflateEnd(&m_strm); } m_closed = true; if (ownsParent()) parent()->close(type); }