mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-03 15:58:23 +02:00
flush underlying streams on close()/sync()
This commit is contained in:
parent
c455631e45
commit
9af6b5b2db
@ -85,6 +85,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
int readFromDevice(char* buffer, std::streamsize length);
|
int readFromDevice(char* buffer, std::streamsize length);
|
||||||
int writeToDevice(const char* buffer, std::streamsize length);
|
int writeToDevice(const char* buffer, std::streamsize length);
|
||||||
|
int sync();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
|
@ -159,6 +159,7 @@ int DeflatingStreamBuf::close()
|
|||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_pOstr->flush();
|
||||||
_pOstr = 0;
|
_pOstr = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -188,6 +189,7 @@ int DeflatingStreamBuf::sync()
|
|||||||
_zstr.next_out = (unsigned char*) _buffer;
|
_zstr.next_out = (unsigned char*) _buffer;
|
||||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
_pOstr->flush();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -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):
|
InflatingIOS::InflatingIOS(std::ostream& ostr, InflatingStreamBuf::StreamType type):
|
||||||
_buf(ostr, type)
|
_buf(ostr, type)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user