Subject: [Boost-bugs] [Boost C++ Libraries] #1033: iostreams::restrict doesn't work on an iostreams::file_source
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-06-05 03:27:07
#1033: iostreams::restrict doesn't work on an iostreams::file_source
----------------------------+-----------------------------------------------
Reporter: phil_at_[hidden] | Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: release 1.34.0
Severity: Problem | Keywords: iostreams
----------------------------+-----------------------------------------------
I ran into a problem when using restrict on a file_source. The problem was
that it decided that the stream wasn't seekable and called the version of
skip that reads a character at a time until it gets to the requested
offset, instead of just calling seek.
The code was similar to this:
{{{
namespace io = boost::iostreams;
std::string filename;
io::filtering_istream rstr(io::restrict(io::file_source(filename), 10,
100));
}}}
I've attached a patch that solved my problem. It was checking to see if
the device was seekable (which means both input_seekable and
output_seekable), but since it was an input device, it was just
input_seekable.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1033>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:55 UTC