sentry __cerb(*this);
if (__cerb)
{
+ ios_base::iostate __err = ios_base::goodbit;
__try
- { _M_write(__s, __n); }
+ {
+ if (this->rdbuf()->sputn(__s, __n) != __n)
+ __err = ios_base::badbit;
+ }
__catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
}
__catch(...)
{ this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(ios_base::badbit);
}
return *this;
}
put(char_type __c);
/**
- * @brief Core write functionality, without sentry.
- * @param __s The array to insert.
- * @param __n Maximum number of characters to insert.
- */
- void
- _M_write(const char_type* __s, streamsize __n)
- {
- const streamsize __put = this->rdbuf()->sputn(__s, __n);
- if (__put != __n)
- this->setstate(ios_base::badbit);
- }
-
- /**
* @brief Character string insertion.
* @param __s The array to insert.
* @param __n Maximum number of characters to insert.
template<typename _ValueT>
__ostream_type&
_M_insert(_ValueT __v);
+
+ private:
+#if !_GLIBCXX_INLINE_VERSION
+ void
+ _M_write(const char_type* __s, streamsize __n)
+ { std::__ostream_insert(*this, __s, __n); }
+#endif
};
/**