Besides this patch, one workaround that I have also used is switching to 
FileOutputStream.

Thanks,
Abhishek

On Thursday, January 2, 2014 11:47:26 AM UTC-8, [email protected] 
wrote:
>
> Status: New 
> Owner: ---- 
> Labels: Type-Defect Priority-Medium 
>
> New issue 592 by [email protected]: OstreamOutputStream with ofstream 
>   
> loses data from the tail 
> http://code.google.com/p/protobuf/issues/detail?id=592 
>
> What steps will reproduce the problem? 
> 1. Use an OstreamOutputStream with an ofstream as the underlying IO 
> stream. 
> 2. Write data that is not aligned to the buffer boundary for the ofstream 
>   
> implementation.  This happens surprisingly often for me (e.g. try writing 
>   
> somewhere between 8192 and 8192+127 bytes).  It happens even with fewer   
> bytes. 
> 3. Alternatively, the attached patch adds a test to   
> zero_copy_stream_unittest.cc which fails without the attached fix. 
>
> What is the expected output? What do you see instead? 
> Expected output is that OstreamOutputStream should work regardless of the 
>   
> amount of data written.  The attached fix addresses this issue by adding a 
>   
> Flush operation to the underlying implementation. 
>
> Please use labels and text to provide additional information. 
> Protobuf version 2.5.0 
> gcc version used was 4.8.1, clang version 3.0 
>
> Attachments: 
>         protobuf-OstreamOutputStream.patch  2.8 KB 
>
> -- 
> You received this message because this project is configured to send all   
> issue notifications to this address. 
> You may adjust your notification preferences at: 
> https://code.google.com/hosting/settings 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to