fstream.tcc (basic_filebuf::seekoff): Fix for output-only filebufs.
* include/bits/fstream.tcc (basic_filebuf::seekoff): Fix for output-only filebufs. * include/std/std_fstream.h (basic_filebuf::_M_set_indeterminate): Likewise. (basic_filebuf::_M_set_determinate): Likewise. From-SVN: r52685
This commit is contained in:
parent
74c263af80
commit
736020b4a7
4 changed files with 16 additions and 3 deletions
|
@ -1,5 +1,11 @@
|
|||
2002-04-23 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* include/bits/fstream.tcc (basic_filebuf::seekoff): Fix for
|
||||
output-only filebufs.
|
||||
* include/std/std_fstream.h (basic_filebuf::_M_set_indeterminate):
|
||||
Likewise.
|
||||
(basic_filebuf::_M_set_determinate): Likewise.
|
||||
|
||||
PR libstdc++/6414
|
||||
* include/bits/fstream.tcc (basic_filebuf::seekoff): Adjust return
|
||||
value properly in the trivial case.
|
||||
|
|
|
@ -567,7 +567,7 @@ namespace std
|
|||
else
|
||||
{
|
||||
__ret = _M_file.seekoff(__off, ios_base::cur, __mode);
|
||||
__ret += _M_in_cur - _M_filepos;
|
||||
__ret += max(_M_out_cur, _M_in_cur) - _M_filepos;
|
||||
}
|
||||
}
|
||||
_M_last_overflowed = false;
|
||||
|
|
|
@ -264,7 +264,7 @@ namespace std
|
|||
this->setg(_M_buf, _M_buf, _M_buf);
|
||||
if (_M_mode & ios_base::out)
|
||||
this->setp(_M_buf, _M_buf);
|
||||
_M_filepos = _M_in_end;
|
||||
_M_filepos = _M_buf;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -276,7 +276,7 @@ namespace std
|
|||
this->setg(_M_buf, _M_buf, _M_buf + __off);
|
||||
if (__testout)
|
||||
this->setp(_M_buf, _M_buf + __off);
|
||||
_M_filepos = _M_in_end;
|
||||
_M_filepos = _M_buf + __off;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -167,6 +167,13 @@ void test04(void)
|
|||
pos06 = is03.tellp();
|
||||
VERIFY( pos05 == pos06 );
|
||||
|
||||
// libstdc++/6414
|
||||
if01.seekg(0, std::ios_base::beg);
|
||||
pos01 = if01.tellg();
|
||||
if01.peek();
|
||||
pos02 = if01.tellg();
|
||||
VERIFY( pos02 == pos01 );
|
||||
|
||||
#ifdef DEBUG_ASSERT
|
||||
assert(test);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue