Opened 10 years ago

Closed 8 years ago

Last modified 5 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@… 10 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)

Changed 10 years ago by rbock@…

Attachment: IoStreams.cpp added

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

comment:1 Changed 10 years ago by Jonathan Turkanis

Status: newassigned

comment:2 Changed 8 years ago by Steven Watanabe

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

comment:3 Changed 8 years ago by 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>

comment:4 in reply to:  3 ; Changed 8 years ago by rbock@…

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 Changed 8 years ago by Steven Watanabe

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 Changed 8 years ago by Steven Watanabe

Resolution: wontfix
Status: assignedclosed

comment:7 in reply to:  6 Changed 5 years ago by anonymous

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.

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

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.