Subject: [boost] Iostreams Code converter bug
From: Eddie Carle (eddie_at_[hidden])
Date: 2011-02-02 19:35:12
I've been trying to patch up a bug in iostreams::code_converter but have
run in to a lot of trouble understanding what a lot of the macros do.
First I'll summarize what the bug is.
The documentation for iostreams::code_converter states that the
code_converter(const Device& dev, std::streamsize buffer_size =
uses the buffer_size parameter to create a buffer that buffers up data
before sending it out along its way. What I've noticed is that somewhere
inside the macros that generate the constructors the value is discarded
or sent somewhere it shouldn't be going. This means that the default
value is always used. For my implementation, 128 bytes.
Here is what I've tracked down so far.
The code_converter constructors are generated at
boost/iostreams/code_converter.hpp:275 which calls the
BOOST_IOSTREAMS_FORWARD macro at boost/iostreams/detail/forward.hpp:44.
The lines 45-56 make sense to me but 57-64 is where I start to get lost.
An interesting thing is that if I comment out the stuff on lines 57-64,
things work perfectly. The value that I pass to buffer_size is used and
the buffer is exactly the size I want it to be. I'm sure some other
facility of iostreams gets broken though. What it seems is that the
constructors defined on lines 45-48 somehow get "replaced" or something
along those lines by the BOOST_IOSTREAMS_FORWARDING_CTOR macro.
Although there is commenting explaining what BOOST_IOSTREAMS_FORWARD
does, there is no comments explaining what
BOOST_IOSTREAMS_FORWARDING_CTOR is and what all that macro code actually
does. I can't run it through a debugger so I've hit a wall as far as
fixing this. Can anyone offer any insight as to what is going on here?
What is this BOOST_IOSTREAMS_FORWARDING_CTOR macro?
-- Eddie Carle
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk