seek issue with boost::iostreams::stream

I've created a device with the boost::iostreams::dual_seekable category to use with the boost::iostreams::stream class, but I'm having trouble implementing seek. When I call seekp on the stream, seek on my device is called with a which (openmode) of both BOOST_IOS::in and BOOST_IOS::out. I would have expected for a call to seekp the which parameter in the seek call on my device would be BOOST_IOS::out, and calling seekg would set which to BOOST_IOS::in. The following code in boost\iostream\detail\streambuf\indirect_streambuf.hpp ignores the which argument passed and passes on through both in and out. template<typename T, typename Tr, typename Alloc, typename Mode> inline typename indirect_streambuf<T, Tr, Alloc, Mode>::pos_type indirect_streambuf<T, Tr, Alloc, Mode>::seekpos (pos_type sp, BOOST_IOS::openmode) { return seek_impl( position_to_offset(sp), BOOST_IOS::beg, BOOST_IOS::in | BOOST_IOS::out ); } Is this correct, and if so how do I implement seeking when using a dual head device? Many thanks, Steve Nutt

Hi Steve, Steve Nutt wrote:
I've created a device with the boost::iostreams::dual_seekable category to use with the boost::iostreams::stream class, but I'm having trouble implementing seek.
When I call seekp on the stream, seek on my device is called with a which (openmode) of both BOOST_IOS::in and BOOST_IOS::out. I would have expected for a call to seekp the which parameter in the seek call on my device would be BOOST_IOS::out, and calling seekg would set which to BOOST_IOS::in.
The following code in boost\iostream\detail\streambuf\indirect_streambuf.hpp ignores the which argument passed and passes on through both in and out.
Is this correct, and if so how do I implement seeking when using a dual head device?
This is almost certainly a bug. I have created a ticket (http://svn.boost.org/trac/boost/ticket/1551) and will make sure it is fixed for 1.36.
Many thanks,
Steve Nutt
-- Jonathan Turkanis CodeRage http://www.coderage.com

Jonathan Turkanis wrote:
This is almost certainly a bug. I have created a ticket (http://svn.boost.org/trac/boost/ticket/1551) and will make sure it is fixed for 1.36.
Many thanks,
Steve Nutt
Fixed now in trunk. -- Jonathan Turkanis CodeRage http://www.coderage.com
participants (2)
-
Jonathan Turkanis
-
Steve Nutt