Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58569 - trunk/boost/iostreams/detail
From: daniel_james_at_[hidden]
Date: 2009-12-29 16:32:15


Author: danieljames
Date: 2009-12-29 16:32:15 EST (Tue, 29 Dec 2009)
New Revision: 58569
URL: http://svn.boost.org/trac/boost/changeset/58569

Log:
Don't throw if seeking the end of the restricted area of a file.

The restrict tests were failing on Visual C++ because they seek the end
of the restricted area (`io.seekp(0, BOOST_IOS::END)`). I think this is
something that should be allowed, so I've changed it so that it doesn't
throw if moving to one past the end. Hopefully it will throw if the user
actually tries to write to the file after this seek.

It looks like the test wasn't failing on gcc because the standard
library was suppressing the exception.
Text files modified:
   trunk/boost/iostreams/detail/restrict_impl.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/boost/iostreams/detail/restrict_impl.hpp
==============================================================================
--- trunk/boost/iostreams/detail/restrict_impl.hpp (original)
+++ trunk/boost/iostreams/detail/restrict_impl.hpp 2009-12-29 16:32:15 EST (Tue, 29 Dec 2009)
@@ -304,7 +304,7 @@
             boost::throw_exception(bad_seek());
         return offset_to_position(pos_ - beg_);
     }
- if (next < beg_ || (end_ != -1 && next >= end_))
+ if (next < beg_ || (end_ != -1 && next > end_))
         boost::throw_exception(bad_seek());
     pos_ = iostreams::seek(this->component(), next - pos_, BOOST_IOS::cur);
     return offset_to_position(pos_ - beg_);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk