LWG issue 2341; Make the two variants of basic_ostream::seekp and basic_istream::seekg behave consistently; update tests to make sure

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@193814 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2013-10-31 22:20:45 +00:00
parent 09f8550e1c
commit 76a8670ce4
4 changed files with 22 additions and 6 deletions

View File

@@ -1159,7 +1159,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
{
if (!this->fail())
sentry __s(*this);
if (__s)
{
if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
this->setstate(ios_base::failbit);
@@ -1172,8 +1173,12 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
{
if (!this->fail())
this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
sentry __s(*this);
if (__s)
{
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
this->setstate(ios_base::failbit);
}
return *this;
}