mirror of
https://github.com/pocoproject/poco.git
synced 2025-07-01 16:33:28 +02:00
fixed GH #1828: DeflatingStreamBuf::sync() should also flush underlying stream.
This commit is contained in:
parent
ffc97bbed4
commit
70217aa083
@ -176,23 +176,27 @@ int DeflatingStreamBuf::sync()
|
|||||||
if (BufferedStreamBuf::sync())
|
if (BufferedStreamBuf::sync())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (_pOstr && _zstr.next_out)
|
if (_pOstr)
|
||||||
{
|
{
|
||||||
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
if (_zstr.next_out)
|
||||||
if (rc != Z_OK) throw IOException(zError(rc));
|
|
||||||
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
|
||||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
|
||||||
while (_zstr.avail_out == 0)
|
|
||||||
{
|
{
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
|
||||||
rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
|
||||||
if (rc != Z_OK) throw IOException(zError(rc));
|
if (rc != Z_OK) throw IOException(zError(rc));
|
||||||
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
if (!_pOstr->good()) throw IOException(zError(rc));
|
||||||
};
|
while (_zstr.avail_out == 0)
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
{
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
|
rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
||||||
|
if (rc != Z_OK) throw IOException(zError(rc));
|
||||||
|
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||||
|
if (!_pOstr->good()) throw IOException(zError(rc));
|
||||||
|
};
|
||||||
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
_pOstr->flush();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user