diff options
| author | Alexander Kabaev <kan@FreeBSD.org> | 2003-02-10 05:47:54 +0000 |
|---|---|---|
| committer | Alexander Kabaev <kan@FreeBSD.org> | 2003-02-10 05:47:54 +0000 |
| commit | 5801dade0e5c0139d3379f296dc61fad77e4328a (patch) | |
| tree | 54f954d3274c4f5a43a4366c77ef6ab38c5c607d /contrib/libstdc++/include/bits/streambuf.tcc | |
| parent | 72983f38e19d795e4671ce8231e076df7f6c5bc0 (diff) | |
| parent | 61e268fb5fe80d065abc291868bc5286fe3a7632 (diff) | |
Notes
Diffstat (limited to 'contrib/libstdc++/include/bits/streambuf.tcc')
| -rw-r--r-- | contrib/libstdc++/include/bits/streambuf.tcc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/contrib/libstdc++/include/bits/streambuf.tcc b/contrib/libstdc++/include/bits/streambuf.tcc index c8084ee68ada..5f57df583a7b 100644 --- a/contrib/libstdc++/include/bits/streambuf.tcc +++ b/contrib/libstdc++/include/bits/streambuf.tcc @@ -69,7 +69,7 @@ namespace std bool __testpos = _M_in_cur && _M_in_beg < _M_in_cur; bool __testne = _M_in_cur && !traits_type::eq(__c, this->gptr()[-1]); if (!__testpos || __testne) - __ret = pbackfail(traits_type::to_int_type(__c)); + __ret = this->pbackfail(traits_type::to_int_type(__c)); else { _M_in_cur_move(-1); @@ -209,7 +209,8 @@ namespace std { while (__testput && __bufsize != -1) { - if (__bufsize != 0 && __sbin->gptr() != NULL) + if (__bufsize != 0 && __sbin->gptr() != NULL + && __sbin->gptr() + __bufsize <= __sbin->egptr()) { __xtrct = __sbout->sputn(__sbin->gptr(), __bufsize); __ret += __xtrct; @@ -219,8 +220,11 @@ namespace std } else { - _CharT __buf[256]; - streamsize __charsread = __sbin->sgetn(__buf, sizeof(__buf)); + size_t __size = + __sbin->_M_buf_size_opt > 0 ? __sbin->_M_buf_size_opt : 1; + _CharT* __buf = + static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __size)); + streamsize __charsread = __sbin->sgetn(__buf, __size); __xtrct = __sbout->sputn(__buf, __charsread); __ret += __xtrct; if (__xtrct != __charsread) |
