mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
fix(Foundation): Poco::BasicMemoryStreamBuf is missing seekpos() #4492
This commit is contained in:
parent
77eb14eebd
commit
5fec3deeb9
@ -141,6 +141,12 @@ public:
|
||||
return newoff;
|
||||
}
|
||||
|
||||
virtual pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
|
||||
{
|
||||
const off_type off = pos;
|
||||
return seekoff(off, std::ios::beg, which);
|
||||
}
|
||||
|
||||
virtual int sync()
|
||||
{
|
||||
return 0;
|
||||
|
@ -143,6 +143,14 @@ void MemoryStreamTest::testInputSeek()
|
||||
assertTrue (istr.good());
|
||||
assertTrue (9 == istr.tellg());
|
||||
|
||||
|
||||
istr.seekg(5);
|
||||
assertTrue (istr.good());
|
||||
assertTrue (5 == istr.tellg());
|
||||
istr >> c;
|
||||
assertTrue (c == '6');
|
||||
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(10, std::ios_base::beg);
|
||||
@ -337,6 +345,12 @@ void MemoryStreamTest::testOutputSeek()
|
||||
assertTrue (ostr.good());
|
||||
assertTrue (9 == ostr.tellp());
|
||||
|
||||
|
||||
ostr.seekp(5);
|
||||
assertTrue (ostr.good());
|
||||
assertTrue (5 == ostr.tellp());
|
||||
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(10, std::ios_base::beg);
|
||||
|
Loading…
Reference in New Issue
Block a user