|
@@ -1251,18 +1251,35 @@ streamsize
|
|
|
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
|
|
{
|
|
|
__gc_ = 0;
|
|
|
- streamsize __c = this->rdbuf()->in_avail();
|
|
|
- switch (__c)
|
|
|
- {
|
|
|
- case -1:
|
|
|
- this->setstate(ios_base::eofbit);
|
|
|
- break;
|
|
|
- case 0:
|
|
|
- break;
|
|
|
- default:
|
|
|
- read(__s, _VSTD::min(__c, __n));
|
|
|
- break;
|
|
|
+#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
|
+ try
|
|
|
+ {
|
|
|
+#endif // _LIBCPP_NO_EXCEPTIONS
|
|
|
+ sentry __sen(*this, true);
|
|
|
+ if (__sen)
|
|
|
+ {
|
|
|
+ streamsize __c = this->rdbuf()->in_avail();
|
|
|
+ switch (__c)
|
|
|
+ {
|
|
|
+ case -1:
|
|
|
+ this->setstate(ios_base::eofbit);
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ read(__s, _VSTD::min(__c, __n));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ this->setstate(ios_base::failbit);
|
|
|
+#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
|
}
|
|
|
+ catch (...)
|
|
|
+ {
|
|
|
+ this->__set_badbit_and_consider_rethrow();
|
|
|
+ }
|
|
|
+#endif // _LIBCPP_NO_EXCEPTIONS
|
|
|
return __gc_;
|
|
|
}
|
|
|
|