Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84514 - trunk/boost/log/utility
From: andrey.semashev_at_[hidden]
Date: 2013-05-26 12:04:11


Author: andysem
Date: 2013-05-26 12:04:10 EDT (Sun, 26 May 2013)
New Revision: 84514
URL: http://svn.boost.org/trac/boost/changeset/84514

Log:
write() no longer asserts when the stream wrapper is not attached to a string. Rather, it behaves more like a standard stream write() when the stream is bad.
Text files modified:
   trunk/boost/log/utility/formatting_ostream.hpp | 11 +++++++----
   1 files changed, 7 insertions(+), 4 deletions(-)

Modified: trunk/boost/log/utility/formatting_ostream.hpp
==============================================================================
--- trunk/boost/log/utility/formatting_ostream.hpp (original)
+++ trunk/boost/log/utility/formatting_ostream.hpp 2013-05-26 12:04:10 EDT (Sun, 26 May 2013)
@@ -355,11 +355,14 @@
     typename aux::enable_if_char_type< OtherCharT, basic_formatting_ostream& >::type
     write(const OtherCharT* p, std::streamsize size)
     {
- m_stream.flush();
+ sentry guard(*this);
+ if (guard)
+ {
+ m_stream.flush();
 
- string_type* storage = m_streambuf.storage();
- BOOST_ASSERT(storage != NULL);
- aux::code_convert(p, static_cast< std::size_t >(size), *storage, m_stream.getloc());
+ string_type* storage = m_streambuf.storage();
+ aux::code_convert(p, static_cast< std::size_t >(size), *storage, m_stream.getloc());
+ }
 
         return *this;
     }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk