Ticket #6635: 6635.patch

File 6635.patch, 2.6 KB (added by jason.erb@…, 11 years ago)

Patch for #6635

  • boost/locale/utf.hpp

     
    280280        template<typename Iterator>
    281281        static Iterator encode(code_point value,Iterator out)
    282282        {
    283             if(value <=0x7F) {
    284                 *out++ = value;
     283            if(value <= 0x7F) {
     284                *out++ = static_cast<char_type>(value);
    285285            }
    286             else if(value <=0x7FF) {
    287                 *out++=(value >> 6) | 0xC0;
    288                 *out++=(value & 0x3F) | 0x80;
     286            else if(value <= 0x7FF) {
     287                *out++ = static_cast<char_type>((value >> 6) | 0xC0);
     288                *out++ = static_cast<char_type>((value & 0x3F) | 0x80);
    289289            }
    290             else if(BOOST_LOCALE_LIKELY(value <=0xFFFF)) {
    291                 *out++=(value >> 12) | 0xE0;
    292                 *out++=((value >> 6) & 0x3F) | 0x80;
    293                 *out++=(value & 0x3F) | 0x80;
     290            else if(BOOST_LOCALE_LIKELY(value <= 0xFFFF)) {
     291                *out++ = static_cast<char_type>((value >> 12) | 0xE0);
     292                *out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x80);
     293                *out++ = static_cast<char_type>((value & 0x3F) | 0x80);
    294294            }
    295295            else {
    296                 *out++=(value >> 18) | 0xF0;
    297                 *out++=((value >> 12) & 0x3F) | 0x80;
    298                 *out++=((value >> 6) & 0x3F) | 0x80;
    299                 *out++=(value & 0x3F) | 0x80;
     296                *out++ = static_cast<char_type>((value >> 18) | 0xF0);
     297                *out++ = static_cast<char_type>(((value >> 12) & 0x3F) | 0x80);
     298                *out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x80);
     299                *out++ = static_cast<char_type>((value & 0x3F) | 0x80);
    300300            }
    301301            return out;
    302302        }
     
    380380        static It encode(code_point u,It out)
    381381        {
    382382            if(BOOST_LOCALE_LIKELY(u<=0xFFFF)) {
    383                 *out++ = u;
     383                *out++ = static_cast<char_type>(u);
    384384            }
    385385            else {
    386                 u-=0x10000;
    387                 *out++=0xD800 | (u>>10);
    388                 *out++=0xDC00 | (u & 0x3FF);
     386                u -= 0x10000;
     387                *out++ = static_cast<char_type>(0xD800 | (u>>10));
     388                *out++ = static_cast<char_type>(0xDC00 | (u & 0x3FF));
    389389            }
    390390            return out;
    391391        }
     
    434434        template<typename It>
    435435        static It encode(code_point u,It out)
    436436        {
    437             *out++ = u;
     437            *out++ = static_cast<char_type>(u);
    438438            return out;
    439439        }
    440440