id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8203,filtering_ostream fails to write 0xFF characters with XCode,support@…,Jonathan Turkanis,"I originally found the problem using the zlib_compressor to write to an ofstream. It worked correctly on Windows but in Xcode 4.6 occasionally a 0xFF character was not written to the stream. I managed to reduce the code required to reproduce it down to: // filtering stream fails to write 0xFF chars to ostream. Have // reproduced with ofstream too std::ostringstream ostm(std::ios_base::out | std::ios_base::binary); // Use empty filtering stream. Problem was originally found with //zlib_compressor boost::iostreams::filtering_ostream filterStream; filterStream.push( ostm ); const unsigned fileSize = 30000; for( unsigned nWritten = 0; nWritten < fileSize; ++nWritten) { const char eofTest = -1; // Only fails with 0xFF character any other value fine filterStream.write( &eofTest, sizeof eofTest); } filterStream.flush(); // This assert fails with Xcode 4.6 assert( ostm.str().size() == fileSize); The number of missing characters is equal to the number of times overflow gets called. I suspect it's something to do with EOF character detection as the problem doesn't happen with other character values. I was unable to find the exact reason for the problem but was able to get it work by changing this code in write.hpp: static std::streamsize write(T& t, const typename char_type_of::type* s, std::streamsize n) { return t.rdbuf()->sputn(s, n); } to: static std::streamsize write(T& t, const typename char_type_of::type* s, std::streamsize n) { t.write(s, n); return n; } It looks like bypassing the ofstream in Xcode and going to the lower level rdbuf::sputn causes the issue. ",Bugs,new,To Be Determined,iostreams,Boost 1.51.0,Problem,,eof rdbuf filtering_ostream write xcode,