1 | void CheckBinaryFFOutThroughBoostFilterStream()
|
---|
2 | {
|
---|
3 | // filtering stream fails to write 0xFF chars to ostream. Have reproduced with ofstream too
|
---|
4 | std::ostringstream ostm(std::ios_base::out | std::ios_base::binary);
|
---|
5 |
|
---|
6 | // Use empty filtering stream. Problem was originally found with zlib_compressor
|
---|
7 | boost::iostreams::filtering_ostream filterStream;
|
---|
8 | filterStream.push( ostm );
|
---|
9 |
|
---|
10 | const unsigned fileSize = 30000;
|
---|
11 | for( unsigned nWritten = 0; nWritten < fileSize; ++nWritten)
|
---|
12 | {
|
---|
13 | const char eofTest = -1; // Only fails with 0xFF character any other value fine
|
---|
14 |
|
---|
15 | filterStream.write( &eofTest, sizeof eofTest);
|
---|
16 | }
|
---|
17 | filterStream.flush();
|
---|
18 | // This assert fails on Xcode. The number of missing characters is equal to the number
|
---|
19 | // of times overflow got called
|
---|
20 | assert( ostm.str().size() == fileSize);
|
---|
21 | }
|
---|