pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.05k stars 2.11k forks source link

Poco::BasicMemoryStreamBuf is missing seekpos() #4492

Closed obiltschnig closed 3 months ago

obiltschnig commented 3 months ago

In order to support both seekg() and seekp(), a streambuf needs to implement both seekoff() and seekpos(). However, Poco::BasicMemoryStreamBuf currently only has seekoff().

Minimal working seekpos() implementation based on seekoff():

    virtual pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
    {
        off_type off = pos;
        return seekoff(off, std::ios::beg, which);
    }