fixed GH #1828: DeflatingStreamBuf::sync() should also flush underlying stream.

This commit is contained in:
Günter Obiltschnig 2017-11-07 18:09:53 +01:00
parent ffc97bbed4
commit 70217aa083

View File

@ -176,7 +176,9 @@ int DeflatingStreamBuf::sync()
if (BufferedStreamBuf::sync())
return -1;
if (_pOstr && _zstr.next_out)
if (_pOstr)
{
if (_zstr.next_out)
{
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
if (rc != Z_OK) throw IOException(zError(rc));
@ -194,6 +196,8 @@ int DeflatingStreamBuf::sync()
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
}
_pOstr->flush();
}
return 0;
}