diff options
Diffstat (limited to 'libstdc++-v3/include/bits/sstream.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/sstream.tcc | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc index 8956e9ee758..89b9a547c25 100644 --- a/libstdc++-v3/include/bits/sstream.tcc +++ b/libstdc++-v3/include/bits/sstream.tcc @@ -1,7 +1,7 @@ // String based streams -*- C++ -*- // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007, 2009, 2010 +// 2006, 2007, 2008, 2009, 2010, 2011 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -178,14 +178,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION && __newoffi >= 0 && this->egptr() - __beg >= __newoffi) { - this->gbump((__beg + __newoffi) - this->gptr()); + this->setg(this->eback(), this->eback() + __newoffi, + this->egptr()); __ret = pos_type(__newoffi); } if ((__testout || __testboth) && __newoffo >= 0 && this->egptr() - __beg >= __newoffo) { - this->pbump((__beg + __newoffo) - this->pptr()); + _M_pbump(this->pbase(), this->epptr(), __newoffo); __ret = pos_type(__newoffo); } } @@ -212,9 +213,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__testpos) { if (__testin) - this->gbump((__beg + __pos) - this->gptr()); + this->setg(this->eback(), this->eback() + __pos, + this->egptr()); if (__testout) - this->pbump((__beg + __pos) - this->pptr()); + _M_pbump(this->pbase(), this->epptr(), __pos); __ret = __sp; } } @@ -243,8 +245,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION this->setg(__base, __base + __i, __endg); if (__testout) { - this->setp(__base, __endp); - this->pbump(__o); + _M_pbump(__base, __endp, __o); // egptr() always tracks the string end. When !__testin, // for the correct functioning of the streambuf inlines // the other get area pointers are identical. @@ -253,9 +254,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } + template <class _CharT, class _Traits, class _Alloc> + void + basic_stringbuf<_CharT, _Traits, _Alloc>:: + _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off) + { + this->setp(__pbeg, __pend); + while (__off > __gnu_cxx::__numeric_traits<int>::__max) + { + this->pbump(__gnu_cxx::__numeric_traits<int>::__max); + __off -= __gnu_cxx::__numeric_traits<int>::__max; + } + this->pbump(__off); + } + // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_stringbuf<char>; extern template class basic_istringstream<char>; @@ -271,6 +285,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif _GLIBCXX_END_NAMESPACE_VERSION -} // namespace +} // namespace std #endif |