Boost C++ Libraries: Ticket #5174: Patch to make code_converter flushable https://svn.boost.org/trac10/ticket/5174 <p> 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. </p> <p> The reason I need this functionality is because I am converting the <a class="ext-link" href="http://savannah.nongnu.org/projects/fastcgipp"><span class="icon">​</span>fastcgi++</a> library over to use boost iostreams for filtering capabilities. Unfortunately if the code_converter can not flush it is useless. </p> <p> <strong></strong><strong></strong><strong> OUTPUT BEFORE PATCH </strong><strong></strong><strong></strong> </p> <p> 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. </p> <p> 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. </p> <p> main(): At end of test case SinkDev::write(): Recieved 13 characters. </p> <p> <strong></strong><strong></strong><strong> OUTPUT AFTER PATCH </strong><strong></strong><strong></strong> </p> <p> 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. </p> <p> 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. </p> <p> 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. </p> <p> <strong></strong><strong></strong><strong> END </strong><strong></strong><strong></strong> </p> <p> 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. -- </p> <blockquote> <p> Eddie Carle </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5174 Trac 1.4.3 eddie@… Thu, 10 Feb 2011 03:18:13 GMT attachment set https://svn.boost.org/trac10/ticket/5174 https://svn.boost.org/trac10/ticket/5174 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">code_converter-flushable.diff</span> </li> </ul> <p> Patch to boost trunk </p> Ticket eddie@… Thu, 10 Feb 2011 03:18:37 GMT attachment set https://svn.boost.org/trac10/ticket/5174 https://svn.boost.org/trac10/ticket/5174 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">codeConverterTestcase.cpp</span> </li> </ul> <p> Test case for patch </p> Ticket beder@… Wed, 21 Mar 2012 17:04:53 GMT attachment set https://svn.boost.org/trac10/ticket/5174 https://svn.boost.org/trac10/ticket/5174 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">code_converter_patch</span> </li> </ul> <p> Patch to the trunk for flushing the code_converter </p> Ticket anonymous Wed, 21 Mar 2012 17:08:23 GMT <link>https://svn.boost.org/trac10/ticket/5174#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5174#comment:1</guid> <description> <p> Is there an update on this ticket? I came across this same issue, and I patched it similarly (although a little easier, I think) - see code_converter_patch. It would be very useful to get this into the trunk; and if there's some technical reason why not, what is it? </p> <p> The reason I need it is that I'm using code_converter in a stream many times per second, and it costs too much to construct and destroy the stream to force a flush. </p> <p> Thanks, Jesse Beder </p> </description> <category>Ticket</category> </item> <item> <author>beder@…</author> <pubDate>Wed, 21 Mar 2012 17:09:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5174#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5174#comment:2</guid> <description> <p> Sorry, I meant to put my email above - I didn't intend to be anonymous. </p> </description> <category>Ticket</category> </item> <item> <author>Eddie Carle <eddie@…></author> <pubDate>Sat, 24 Mar 2012 03:25:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5174#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5174#comment:3</guid> <description> <p> Yeah, I was in contact with the maintainer a while back and he said he would pursue it but didn't. I eventually gave up and included a replacement code_converter.hpp in the fastcgi++ library. I am intrigued at the simplicity of your patch though. I wonder why I didn't do it like that. </p> </description> <category>Ticket</category> </item> </channel> </rss>