예제 #1
0
파일: buffered.cpp 프로젝트: adfin/mordor
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);
}
예제 #2
0
파일: zlib.cpp 프로젝트: Abioy/mordor
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);
}