Opened 14 years ago

Closed 12 years ago

Last modified 9 years ago

#2449 closed Bugs (wontfix)

tellg() not working for filtering_istream

Reported by: rbock@… Owned by: Jonathan Turkanis
Milestone: Boost 1.37.0 Component: iostreams
Version: Boost 1.36.0 Severity: Problem
Keywords: iostreams filtering_istream tellg Cc:

Description

Hi,

tellg() member function is not working for boost::iostreams::filtering_istream (see attached example).

This means that filtering_istream cannot be treated like an std::istream without having strange effects. In my eyes this is practically a showstopper for using filtering_istream.

Regards,

Roland

Attachments (1)

IoStreams.cpp (666 bytes ) - added by rbock@… 14 years ago.
A short sample showing that filtering_istream::tellg() does not work (and corrupts the stream).

Download all attachments as: .zip

Change History (9)

by rbock@…, 14 years ago

Attachment: IoStreams.cpp added

A short sample showing that filtering_istream::tellg() does not work (and corrupts the stream).

comment:1 by Jonathan Turkanis, 14 years ago

Status: newassigned

comment:2 by Steven Watanabe, 12 years ago

The underlying device has to support seeking, for tellg to work.

comment:3 by Steven Watanabe, 12 years ago

After poking through the source for a while, I'm beginning to think that this behavior is by design. You can make the example work using

boost::iostreams::filtering_stream<boost::iostreams::input_seekable>

in reply to:  3 ; comment:4 by rbock@…, 12 years ago

Replying to steven_watanabe:

After poking through the source for a while, I'm beginning to think that this behavior is by design. You can make the example work using

boost::iostreams::filtering_stream<boost::iostreams::input_seekable>

Hmm. In that case, wouldn't it be better to throw an exception with some meaningful text instead of just returning -1 and invalidating the stream (good() == false)?

comment:5 by Steven Watanabe, 12 years ago

I get an exception with msvc-10 and the trunk. If you don't get an exception, it's probably because std::istream is swallowing it.

comment:6 by Steven Watanabe, 12 years ago

Resolution: wontfix
Status: assignedclosed

in reply to:  6 comment:7 by anonymous, 9 years ago

Replying to steven_watanabe: Hi, I tried using boost::iostreams::filtering_stream<boost::iostreams::input_seekable>, but, I am not able to push gzip_decompressor object into this filter (push(boost::iostreams::gzip_decompressor())). Can you please let me know if there is workaround for this.

thanks, Edwin.

in reply to:  4 comment:8 by Edwin Ramayya <redwinbosco@…>, 9 years ago

Hi, Were you able to use boost::iostreams::filtering_stream<boost::iostreams::input_seekable> and push boost::iostreams::gzip_decompressor() into the filter. I am not able to.. please let me know how you got around this.

thanks, Edwin.

Note: See TracTickets for help on using tickets.