summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-03-06 19:27:56 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-03-06 19:27:56 +0000
commitcc7bdae931f9b3c4b67b9d1278ddd387810eecd3 (patch)
tree7d5aeff8b04f47c4e9b9ece6561fa495a7f3e94e
parent3101474720aad336bfb3b80448f2d1d54b9cd9aa (diff)
downloadexternal_libcxx-cc7bdae931f9b3c4b67b9d1278ddd387810eecd3.tar.gz
external_libcxx-cc7bdae931f9b3c4b67b9d1278ddd387810eecd3.tar.bz2
external_libcxx-cc7bdae931f9b3c4b67b9d1278ddd387810eecd3.zip
Have basic_istream::read call sgetn intead of sbumpc individual characters. This addresses http://llvm.org/bugs/show_bug.cgi?id=15427.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176573 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/istream13
1 files changed, 3 insertions, 10 deletions
diff --git a/include/istream b/include/istream
index 3979e1407..e484571c4 100644
--- a/include/istream
+++ b/include/istream
@@ -1216,16 +1216,9 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true);
if (__sen)
{
- for (; __gc_ < __n; ++__gc_)
- {
- typename traits_type::int_type __i = this->rdbuf()->sbumpc();
- if (traits_type::eq_int_type(__i, traits_type::eof()))
- {
- this->setstate(ios_base::failbit | ios_base::eofbit);
- break;
- }
- *__s++ = traits_type::to_char_type(__i);
- }
+ __gc_ = this->rdbuf()->sgetn(__s, __n);
+ if (__gc_ != __n)
+ this->setstate(ios_base::failbit | ios_base::eofbit);
}
else
this->setstate(ios_base::failbit);