diff --git a/Foundation/include/Poco/InflatingStream.h b/Foundation/include/Poco/InflatingStream.h index 960ccf3fe..ca20cb07e 100644 --- a/Foundation/include/Poco/InflatingStream.h +++ b/Foundation/include/Poco/InflatingStream.h @@ -85,6 +85,7 @@ public: protected: int readFromDevice(char* buffer, std::streamsize length); int writeToDevice(const char* buffer, std::streamsize length); + int sync(); private: enum diff --git a/Foundation/src/DeflatingStream.cpp b/Foundation/src/DeflatingStream.cpp index 28c9dbb4a..c0c722f4e 100644 --- a/Foundation/src/DeflatingStream.cpp +++ b/Foundation/src/DeflatingStream.cpp @@ -159,6 +159,7 @@ int DeflatingStreamBuf::close() _zstr.avail_out = DEFLATE_BUFFER_SIZE; } } + _pOstr->flush(); _pOstr = 0; } return 0; @@ -188,6 +189,7 @@ int DeflatingStreamBuf::sync() _zstr.next_out = (unsigned char*) _buffer; _zstr.avail_out = DEFLATE_BUFFER_SIZE; } + _pOstr->flush(); return 0; } diff --git a/Foundation/src/InflatingStream.cpp b/Foundation/src/InflatingStream.cpp index 6a55f8bc1..77ecb500b 100644 --- a/Foundation/src/InflatingStream.cpp +++ b/Foundation/src/InflatingStream.cpp @@ -253,6 +253,14 @@ int InflatingStreamBuf::writeToDevice(const char* buffer, std::streamsize length } +int InflatingStreamBuf::sync() +{ + int n = BufferedStreamBuf::sync(); + if (!n && _pOstr) _pOstr->flush(); + return n; +} + + InflatingIOS::InflatingIOS(std::ostream& ostr, InflatingStreamBuf::StreamType type): _buf(ostr, type) {