diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2012-09-02 09:14:55 -0700 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2012-09-02 09:14:55 -0700 |
commit | 9cb4c8073edea87d52bd0cf88f2317ead353eec2 (patch) | |
tree | f8b92c1aaabb72d8736ffd420d6e2ef914f9e88a /src | |
parent | f6eb5b0a5f70a471eadf3922ee175bbc059258c8 (diff) |
Fixing ZHandle, and adding a unit test for it.
Diffstat (limited to 'src')
-rw-r--r-- | src/ZHandle.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ZHandle.cc b/src/ZHandle.cc index 4f216c7..aa7bde7 100644 --- a/src/ZHandle.cc +++ b/src/ZHandle.cc @@ -22,14 +22,14 @@ Balau::ZStream::ZStream(const IO<Handle> & h, int level, header_t header) : m_h( } void Balau::ZStream::close() throw (GeneralException) { - if (m_in) { - free(m_in); - m_in = NULL; - } if (m_h->canWrite()) finish(); inflateEnd(&m_zin); deflateEnd(&m_zout); + if (m_in) { + free(m_in); + m_in = NULL; + } if (!m_detached) m_h->close(); m_closed = true; @@ -78,6 +78,7 @@ ssize_t Balau::ZStream::read(void * buf, size_t count) throw (GeneralException) size_t r = m_h->read(m_in, BLOCK_SIZE); if (r <= 0) return readTotal; + m_zin.avail_in = r; } Task::operationYield(); int r = inflate(&m_zin, Z_SYNC_FLUSH); |