Opened 15 years ago

Closed 15 years ago

#1033 closed Bugs (fixed)

iostreams::restrict doesn't work on an iostreams::file_source

Reported by: phil@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.34.0 Severity: Problem
Keywords: iostreams Cc:

Description

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.

Attachments (1)

skip.patch (684 bytes ) - added by phil@… 15 years ago.

Download all attachments as: .zip

Change History (6)

by phil@…, 15 years ago

Attachment: skip.patch added

comment:1 by Marshall Clow, 15 years ago

Owner: set to Douglas Gregor

comment:2 by Marshall Clow, 15 years ago

Component: Noneiostreams
Owner: changed from Douglas Gregor to Marshall Clow

comment:3 by Marshall Clow, 15 years ago

Owner: Marshall Clow removed

comment:4 by Marshall Clow, 15 years ago

Owner: set to Jonathan Turkanis

comment:5 by Jonathan Turkanis, 15 years ago

Resolution: fixed
Status: newclosed

fixed in [42305] in branches/iostreams_dev, to be merged into trunk shortly.

Note: See TracTickets for help on using tickets.