diff options
author | Pixel <pixel@nobis-crew.org> | 2011-12-13 00:55:43 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-12-13 00:55:43 -0800 |
commit | c3085db4a169ea17f8bc5c0384b71846c5e7a7f9 (patch) | |
tree | 0d4b0fd97f0aabdd4d302e0dcefc32665908d848 | |
parent | 73e17feeb7231ac92fa69fa0272377855ba7994b (diff) |
Fixing a few bugs and problems in the ZHandle code.
-rw-r--r-- | includes/ZHandle.h | 1 | ||||
-rw-r--r-- | src/ZHandle.cc | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/includes/ZHandle.h b/includes/ZHandle.h index 63da59a..048e0cb 100644 --- a/includes/ZHandle.h +++ b/includes/ZHandle.h @@ -21,7 +21,6 @@ class ZStream : public Handle { virtual const char * getName(); virtual ssize_t read(void * buf, size_t count) throw (GeneralException); virtual ssize_t write(const void * buf, size_t count) throw (GeneralException); - virtual off_t getSize(); void detach() { m_detached = true; } void flush() { doFlush(false); } private: diff --git a/src/ZHandle.cc b/src/ZHandle.cc index 964f56d..0a43b05 100644 --- a/src/ZHandle.cc +++ b/src/ZHandle.cc @@ -103,7 +103,7 @@ ssize_t Balau::ZStream::write(const void * buf, size_t count) throw (GeneralExce m_zout.next_in = (Bytef *) const_cast<void *>(buf); m_zout.avail_in = count; void * obuf = alloca(BLOCK_SIZE); - while ((count != 0) && !m_h->isClosed() && !m_h->isEOF()) { + while ((count != 0) && !m_h->isClosed()) { m_zout.next_out = (Bytef *) obuf; m_zout.avail_out = BLOCK_SIZE; int r = deflate(&m_zout, Z_NO_FLUSH); @@ -115,8 +115,9 @@ ssize_t Balau::ZStream::write(const void * buf, size_t count) throw (GeneralExce if (w <= 0) return wroteTotal; } - wroteTotal += compressed; - count -= compressed; + size_t didRead = count - m_zout.avail_in; + wroteTotal += didRead; + count -= didRead; } return wroteTotal; } |