Boost logo

Boost Users :

From: gchen (chengang31_at_[hidden])
Date: 2007-05-27 10:44:48


Chad Walters wrote:
>

[...]

>
> This means that tee_filter's close() sets openmode to its default value of
> BOOST_IOS::in | BOOST_IOS::out. This mode is passed along to
> iostreams::close(), which ends up back in close_impl close() again as it is
> attempting to close the ChecksumFilter. However, now the check "if (in ==
> ((which & BOOST_IOS::in) != 0))" fails, and so ChecksumFilter.close() is
> never invoked.
>
> If I change the default value for openmode in tee_filter::close() to
> BOOST_IOS::out, everything works OK for me, but I am not really sure that
> this is the right thing to do.
>

It seems like a issue with close_impl<closable_tag>::close(...).

The document in close -> "Device Types" section says:

<quote>
"The semantics of close for a Device type T depends on its category as
follows:...

convertible to closable_tag and to output but not to bidirectional,
calls t.close() if (which & ios_base::out) != 0"
</quote>

(link: http://www.boost.org/libs/iostreams/doc/functions/close.html)

Your composite is a closable output, and tee_filter calls "close" with
"which = in | out". So "close" should call t.close.

>
> PS: And if you read this far, you probably understand the iostreams library
> more than well enough to confirm whether the possible (likely?) bug I
> reported earlier this week is really a bug (nobody has replied as of yet):
>
> At the bottom of concepts.hpp, the following typedefs appear:
>
> typedef multichar_filter<input> multichar_input_filter;
> typedef multichar_filter<input> multichar_input_wfilter;
> typedef multichar_filter<output> multichar_output_filter;
> typedef multichar_filter<output> multichar_output_wfilter;
> typedef multichar_filter<dual_use> multichar_dual_use_filter;
> typedef multichar_filter<dual_use> multichar_dual_use_wfilter;
>
> I think the wfilter versions of these typedefs should use
> multichar_wfilter<...>. Agreed?

A copy-n-paste bug !?

My $0.02


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net