Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84611 - trunk/boost/utility
From: andrey.semashev_at_[hidden]
Date: 2013-06-02 15:16:51


Author: andysem
Date: 2013-06-02 15:16:50 EDT (Sun, 02 Jun 2013)
New Revision: 84611
URL: http://svn.boost.org/trac/boost/changeset/84611

Log:
More modifications according to the review.
Text files modified:
   trunk/boost/utility/string_ref.hpp | 13 +++++++------
   1 files changed, 7 insertions(+), 6 deletions(-)

Modified: trunk/boost/utility/string_ref.hpp
==============================================================================
--- trunk/boost/utility/string_ref.hpp (original)
+++ trunk/boost/utility/string_ref.hpp 2013-06-02 15:16:50 EDT (Sun, 02 Jun 2013)
@@ -406,11 +406,11 @@
 
         template<class charT, class traits>
         inline void insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
- charT fill_chars[8];
- std::fill_n(fill_chars, 8, os.fill());
- for (std::size_t m = n / 8u; m > 0 && os.good(); --m)
- os.write(fill_chars, 8);
- n &= 7u;
+ enum { chunk_size = 8 };
+ charT fill_chars[chunk_size];
+ std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
+ for (; n >= chunk_size && os.good(); n -= chunk_size)
+ os.write(fill_chars, static_cast< std::streamsize >(chunk_size));
             if (n > 0 && os.good())
                 os.write(fill_chars, static_cast< std::streamsize >(n));
             }
@@ -427,7 +427,8 @@
                 }
             else {
                 os.write(str.data(), static_cast< std::streamsize >(size));
- detail::insert_fill_chars(os, alignment_size);
+ if (os.good())
+ detail::insert_fill_chars(os, alignment_size);
                 }
             }
 


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