Boost logo

Boost :

Subject: [boost] [iostream] Bug in indirect_streambuf::seek_impl
From: Jorge Lodos Vigil (lodos_at_[hidden])
Date: 2012-11-12 07:12:23


Hi
Currently indirect_streambuf::seek_impl always modifies input and output pointers with code:

setg(0, 0, 0);
setp(0, 0);

See detail/indirect_streambuf.hpp. However, this is incorrect for dual seekable streams buffers which only modifies one set of pointers on each seek (in or out). As a consequence, dual seekable devices cannot be correctly seek.
Those 2 lines should be replaced by:

if (is_convertible<category, dual_seekable>::value) {
    if (which == BOOST_IOS::in) {
        setg(0, 0, 0);
    }
    if (which == BOOST_IOS::out) {
        setp(0, 0);
    }
}
else {
    setg(0, 0, 0);
    setp(0, 0);
}

I have created ticket https://svn.boost.org/trac/boost/ticket/7681

Thanks, Jorge


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk