Ticket #7435: internals.hpp.patch

File internals.hpp.patch, 1.2 KB (added by Joachim Faulhaber, 10 years ago)
  • internals.hpp

     
    104104    template<class Ch, class Tr>
    105105    void stream_format_state<Ch,Tr>:: apply_on (basic_ios & os,
    106106                      boost::io::detail::locale_t * loc_default) const {
     107    // If a locale is available, set it first. "os.fill(fill_);" may chrash otherwise.
     108#if !defined(BOOST_NO_STD_LOCALE)
     109        if(loc_)
     110            os.imbue(loc_.get());
     111        else if(loc_default)
     112            os.imbue(*loc_default);
     113#else
     114        (void) loc_default; // keep compiler quiet if we don't support locales
     115#endif       
    107116        // set the state of this stream according to our params
    108117        if(width_ != -1)
    109118            os.width(width_);
     
    114123        os.flags(flags_);
    115124        os.clear(rdstate_);
    116125        os.exceptions(exceptions_);
    117 #if !defined(BOOST_NO_STD_LOCALE)
    118         if(loc_)
    119             os.imbue(loc_.get());
    120         else if(loc_default)
    121             os.imbue(*loc_default);
    122 #else
    123         (void) loc_default; // keep compiler quiet if we don't support locales
    124 #endif       
    125126    }
    126127
    127128    template<class Ch, class Tr>