[prev in list] [next in list] [prev in thread] [next in thread]
List: boost-bugs
Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5139: Initial Stream
From: "Boost C++ Libraries" <noreply () lists ! boost ! org>
Date: 2011-01-29 14:35:36
Message-ID: 066.62b6db948d355c95b7c55a3a75edbc9e () lists ! boost ! org
[Download RAW message or body]
#5139: Initial Stream Position in Boost.Interprocess.Vectorstream
---------------------------------+------------------------------------------
Reporter: charles@… | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.45.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------+------------------------------------------
Comment (by anonymous):
I think the problem is with
boost::interprocess::basic_vectorstream::seekoff.
On line 284 of boost/interprocess/streams/vectorstream.hpp it reads:
{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!C++
//Test for logic errors
if(!in & !out)
return pos_type(off_type(-1));
else if((in && out) && (dir == std::ios_base::cur))
return pos_type(off_type(-1));
else if((in && (!(m_mode & std::ios_base::in) || this->gptr() ==
0)) ||
(out && (!(m_mode & std::ios_base::out) || this->pptr() ==
0)))
return pos_type(off_type(-1));
}}}
}}}
This code doesn't account for the possibility that the internal vector is
empty, and the user simply wants to get the current position (which should
be 0.)
A possible fix would be:
{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!C++
//Test for logic errors
if (!in & !out)
return pos_type(off_type(-1));
else if((in && out) && (dir == std::ios_base::cur))
return pos_type(off_type(-1));
else if( (in && (!(m_mode & std::ios_base::in))) || (out && (!(m_mode &
std::ios_base::out))))
return pos_type(off_type(-1));
else if ((in && this->gptr() == 0) || (out && this->pptr() == 0))
return off == 0 ? pos_type(off_type(0)) : pos_type(off_type(-1));
}}}
}}}
--
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5139#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
_______________________________________________
Boost-bugs mailing list
Boost-bugs@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-bugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic