diff options
author | Yuri Gorshenin <y@maps.me> | 2017-01-30 13:18:08 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2017-01-30 14:06:54 +0300 |
commit | 39b800ec8655d443b23b5ec1c05f47dd1771f770 (patch) | |
tree | 6e343afd50df72ed15bf6728a7757e5be6668496 /coding/zlib.hpp | |
parent | c0a9fbc742d200e447670d89cd5067d14f8e9d9a (diff) |
[coding] Fixed ZLib wrappers.
Diffstat (limited to 'coding/zlib.hpp')
-rw-r--r-- | coding/zlib.hpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/coding/zlib.hpp b/coding/zlib.hpp index ee6775563b..dba1a59ec7 100644 --- a/coding/zlib.hpp +++ b/coding/zlib.hpp @@ -118,12 +118,19 @@ private: while (true) { int const flush = processor.ConsumedAll() ? Z_FINISH : Z_NO_FLUSH; - int const ret = processor.Process(flush); - if (ret != Z_OK && ret != Z_STREAM_END) - return false; + int ret = Z_OK; + + while (true) + { + ret = processor.Process(flush); + if (ret != Z_OK && ret != Z_STREAM_END) + return false; + + if (!processor.BufferIsFull()) + break; - if (processor.BufferIsFull()) processor.MoveOut(out); + } if (flush == Z_FINISH && ret == Z_STREAM_END) break; |