mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-14 02:57:45 +01:00
fix(Foundation): Poco::BasicMemoryStreamBuf is missing seekpos() #4492
This commit is contained in:
parent
77eb14eebd
commit
5fec3deeb9
@ -140,6 +140,12 @@ public:
|
|||||||
|
|
||||||
return newoff;
|
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()
|
virtual int sync()
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,14 @@ void MemoryStreamTest::testInputSeek()
|
|||||||
assertTrue (istr.good());
|
assertTrue (istr.good());
|
||||||
assertTrue (9 == istr.tellg());
|
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());
|
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||||
istr2.seekg(10, std::ios_base::beg);
|
istr2.seekg(10, std::ios_base::beg);
|
||||||
@ -337,6 +345,12 @@ void MemoryStreamTest::testOutputSeek()
|
|||||||
assertTrue (ostr.good());
|
assertTrue (ostr.good());
|
||||||
assertTrue (9 == ostr.tellp());
|
assertTrue (9 == ostr.tellp());
|
||||||
|
|
||||||
|
|
||||||
|
ostr.seekp(5);
|
||||||
|
assertTrue (ostr.good());
|
||||||
|
assertTrue (5 == ostr.tellp());
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||||
ostr2.seekp(10, std::ios_base::beg);
|
ostr2.seekp(10, std::ios_base::beg);
|
||||||
|
Loading…
Reference in New Issue
Block a user