Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83374 - trunk/boost/format
From: afojgo_at_[hidden]
Date: 2013-03-09 14:15:29


Author: jofaber
Date: 2013-03-09 14:15:28 EST (Sat, 09 Mar 2013)
New Revision: 83374
URL: http://svn.boost.org/trac/boost/changeset/83374

Log:
Fix for Ticket #7435: Crash with format using UTF16 strings on MacOS X. Reporter: Franz Detro.
https://svn.boost.org/trac/boost/ticket/7435

Text files modified:
   trunk/boost/format/internals.hpp | 17 +++++++++--------
   1 files changed, 9 insertions(+), 8 deletions(-)

Modified: trunk/boost/format/internals.hpp
==============================================================================
--- trunk/boost/format/internals.hpp (original)
+++ trunk/boost/format/internals.hpp 2013-03-09 14:15:28 EST (Sat, 09 Mar 2013)
@@ -104,6 +104,15 @@
     template<class Ch, class Tr>
     void stream_format_state<Ch,Tr>:: apply_on (basic_ios & os,
                       boost::io::detail::locale_t * loc_default) const {
+ // If a locale is available, set it first. "os.fill(fill_);" may chrash otherwise.
+#if !defined(BOOST_NO_STD_LOCALE)
+ if(loc_)
+ os.imbue(loc_.get());
+ else if(loc_default)
+ os.imbue(*loc_default);
+#else
+ (void) loc_default; // keep compiler quiet if we don't support locales
+#endif
         // set the state of this stream according to our params
         if(width_ != -1)
             os.width(width_);
@@ -114,14 +123,6 @@
         os.flags(flags_);
         os.clear(rdstate_);
         os.exceptions(exceptions_);
-#if !defined(BOOST_NO_STD_LOCALE)
- if(loc_)
- os.imbue(loc_.get());
- else if(loc_default)
- os.imbue(*loc_default);
-#else
- (void) loc_default; // keep compiler quiet if we don't support locales
-#endif
     }
 
     template<class Ch, class Tr>


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