Boost logo

Boost :

Subject: [boost] Patch to make code_converter flushable
From: Eddie Carle (eddie_at_[hidden])
Date: 2011-02-03 19:22:18


I've attached a little patch that makes iostreams::code_converter
flushable. It seems like it really should be. Is there any chance
someone could look at this? I've included some test code as well that
outputs the following.

********** OUTPUT BEFORE PATCH **********

main(): Sending 24 characters of data to output stream
SinkDev::write(): Recieved 16 characters.
main(): Calling a sync on the output stream
main(): Sending 21 characters of data to output stream
SinkDev::write(): Recieved 16 characters.

main(): Asking for 24 characters of data from input stream
SourceDev::read(): Sending 16 characters.
SourceDev::read(): Sending 16 characters.
main(): Calling a sync on the input stream
main(): Asking for 9 characters of data from input stream
SourceDev::read(): Sending 16 characters.

main(): At end of test case
SinkDev::write(): Recieved 13 characters.

********** OUTPUT AFTER PATCH **********

main(): Sending 24 characters of data to output stream
SinkDev::write(): Recieved 16 characters.
main(): Calling a sync on the output stream
SinkDev::write(): Recieved 8 characters.
main(): Sending 21 characters of data to output stream
SinkDev::write(): Recieved 16 characters.

main(): Asking for 24 characters of data from input stream
SourceDev::read(): Sending 16 characters.
SourceDev::read(): Sending 16 characters.
main(): Calling a sync on the input stream
main(): Asking for 9 characters of data from input stream
SourceDev::read(): Sending 16 characters.

main(): At end of test case
SinkDev::write(): Recieved 5 characters.
SinkDev::write(): Recieved 0 characters.
SinkDev::write(): Recieved 0 characters.
SinkDev::write(): Recieved 0 characters.

********** END **********

Notice that input functionality doesn't change but the output
functionality does. The one cause for concern to me is that for some
reason upon deconstruction the new flush() function is called a bunch of
extras times. I'm not entirely sure why this is happening.

-- 
        Eddie Carle







Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk