[Boost-bugs] [Boost C++ Libraries] #3166: Possible Bug in Boost.Interprocess vectorstream

Subject: [Boost-bugs] [Boost C++ Libraries] #3166: Possible Bug in Boost.Interprocess vectorstream
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-11 13:39:02


#3166: Possible Bug in Boost.Interprocess vectorstream
--------------------------------+-------------------------------------------
 Reporter: chsalvia_at_[hidden] | Owner:
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: None
  Version: Boost 1.39.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 There is possibly a bug in the vectorstream class found in the Boost
 Interprocess library. It seems the internal pointer mp_high_water doesn't
 get updated every time new data is inserted into the stream via xsputn,
 which causes problems if you call seekp on a stream.

 The following code demonstrates the problem:


 {{{
 using namespace std;
 using namespace boost::interprocess;

 typedef basic_ovectorstream<std::vector<char>, std::char_traits<char> >
 vecstream;
 vecstream vs;

 vs << "AAAABBBB";

 vs.seekp(0);

 // Output the contents of the internal vector
 //
 const std::vector<char>& vec = vs.vector();
 for (int i = 0; i < vec.size(); ++i) cout << vec[i];
 cout << endl;
 }}}


 This outputs:
 AAAAB

 When it should output:
 AAAABBBB

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3166>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC