mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
fixed exception messages if writing to output stream fails
This commit is contained in:
@@ -151,7 +151,7 @@ int DeflatingStreamBuf::close()
|
|||||||
int rc = deflate(&_zstr, Z_FINISH);
|
int rc = deflate(&_zstr, Z_FINISH);
|
||||||
if (rc != Z_OK && rc != Z_STREAM_END) throw IOException(zError(rc));
|
if (rc != Z_OK && rc != Z_STREAM_END) 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("Failed writing deflated data to output stream");
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
while (rc != Z_STREAM_END)
|
while (rc != Z_STREAM_END)
|
||||||
@@ -159,7 +159,7 @@ int DeflatingStreamBuf::close()
|
|||||||
rc = deflate(&_zstr, Z_FINISH);
|
rc = deflate(&_zstr, Z_FINISH);
|
||||||
if (rc != Z_OK && rc != Z_STREAM_END) throw IOException(zError(rc));
|
if (rc != Z_OK && rc != Z_STREAM_END) 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("Failed writing deflated data to output stream");
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ int DeflatingStreamBuf::sync()
|
|||||||
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
int 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("Failed writing deflated data to output stream");
|
||||||
while (_zstr.avail_out == 0)
|
while (_zstr.avail_out == 0)
|
||||||
{
|
{
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
@@ -191,7 +191,7 @@ int DeflatingStreamBuf::sync()
|
|||||||
rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
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("Failed writing deflated data to output stream");
|
||||||
};
|
};
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
@@ -281,14 +281,14 @@ int DeflatingStreamBuf::writeToDevice(const char* buffer, std::streamsize length
|
|||||||
if (_zstr.avail_out == 0)
|
if (_zstr.avail_out == 0)
|
||||||
{
|
{
|
||||||
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE);
|
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE);
|
||||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
if (_zstr.avail_in == 0)
|
if (_zstr.avail_in == 0)
|
||||||
{
|
{
|
||||||
_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("Failed writing deflated data to output stream");
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -235,21 +235,21 @@ int InflatingStreamBuf::writeToDevice(const char* buffer, std::streamsize length
|
|||||||
if (rc == Z_STREAM_END)
|
if (rc == Z_STREAM_END)
|
||||||
{
|
{
|
||||||
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _zstr.avail_out);
|
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
if (!_pOstr->good()) throw IOException("Failed writing inflated data to output stream");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (rc != Z_OK) throw IOException(zError(rc));
|
if (rc != Z_OK) throw IOException(zError(rc));
|
||||||
if (_zstr.avail_out == 0)
|
if (_zstr.avail_out == 0)
|
||||||
{
|
{
|
||||||
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE);
|
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE);
|
||||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
if (!_pOstr->good()) throw IOException("Failed writing inflated data to output stream");
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = INFLATE_BUFFER_SIZE;
|
_zstr.avail_out = INFLATE_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
if (_zstr.avail_in == 0)
|
if (_zstr.avail_in == 0)
|
||||||
{
|
{
|
||||||
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _zstr.avail_out);
|
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
if (!_pOstr->good()) throw IOException("Failed writing inflated data to output stream");
|
||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = INFLATE_BUFFER_SIZE;
|
_zstr.avail_out = INFLATE_BUFFER_SIZE;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user