mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 23:12:57 +02:00
Merge pull request #1941 from villytiger/streambuf-1.8.0
Fix writing into closed socket from streambuf
This commit is contained in:
commit
7e5984a76c
@ -73,12 +73,12 @@ public:
|
||||
{
|
||||
if (!(_mode & IOS::out)) return char_traits::eof();
|
||||
|
||||
if (flushBuffer() == std::streamsize(-1)) return char_traits::eof();
|
||||
if (c != char_traits::eof())
|
||||
{
|
||||
*this->pptr() = char_traits::to_char_type(c);
|
||||
this->pbump(1);
|
||||
}
|
||||
if (flushBuffer() == std::streamsize(-1)) return char_traits::eof();
|
||||
|
||||
return c;
|
||||
}
|
||||
@ -127,7 +127,7 @@ protected:
|
||||
void resetBuffers()
|
||||
{
|
||||
this->setg(_pReadBuffer + 4, _pReadBuffer + 4, _pReadBuffer + 4);
|
||||
this->setp(_pWriteBuffer, _pWriteBuffer + (_bufsize - 1));
|
||||
this->setp(_pWriteBuffer, _pWriteBuffer + _bufsize);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
_mode(mode)
|
||||
{
|
||||
this->setg(_pBuffer + 4, _pBuffer + 4, _pBuffer + 4);
|
||||
this->setp(_pBuffer, _pBuffer + (_bufsize - 1));
|
||||
this->setp(_pBuffer, _pBuffer + _bufsize);
|
||||
}
|
||||
|
||||
~BasicBufferedStreamBuf()
|
||||
@ -72,12 +72,12 @@ public:
|
||||
{
|
||||
if (!(_mode & IOS::out)) return char_traits::eof();
|
||||
|
||||
if (flushBuffer() == std::streamsize(-1)) return char_traits::eof();
|
||||
if (c != char_traits::eof())
|
||||
{
|
||||
*this->pptr() = char_traits::to_char_type(c);
|
||||
this->pbump(1);
|
||||
}
|
||||
if (flushBuffer() == std::streamsize(-1)) return char_traits::eof();
|
||||
|
||||
return c;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user