Ticket #7701: locale.diff

File locale.diff, 6.9 KB (added by tvaneerd@…, 10 years ago)

diff of required changes

  • libs/locale/src/std/codecvt.cpp

    diff --git b/libs/locale/src/std/codecvt.cpp a/libs/locale/src/std/codecvt.cpp
    index 513d22f..8ea00aa 100644
    b a namespace impl_std {  
    1818    std::locale codecvt_bychar( std::locale const &in,
    1919                                std::string const &locale_name)
    2020    {
    21         return std::locale(in,new std::codecvt_byname<CharType,char,mbstate_t>(locale_name.c_str()));
     21        return std::locale(in,new std::codecvt_byname<CharType,char,std::mbstate_t>(locale_name.c_str()));
    2222    }
    2323   
    2424
  • libs/locale/src/util/codecvt_converter.cpp

    diff --git b/libs/locale/src/util/codecvt_converter.cpp a/libs/locale/src/util/codecvt_converter.cpp
    index 7a9aab2..8c7e25c 100644
    b a namespace util {  
    7070            if(!utf::is_valid_codepoint(u))
    7171                return illegal;
    7272            int width = utf::utf_traits<char>::width(u);
    73             ptrdiff_t d=end-begin;
     73            std::ptrdiff_t d=end-begin;
    7474            if(d < width)
    7575                return incomplete;
    7676            utf::utf_traits<char>::encode(u,begin);
    namespace util {  
    229229    // Real codecvt
    230230
    231231    template<typename CharType>
    232     class code_converter : public std::codecvt<CharType,char,mbstate_t>
     232    class code_converter : public std::codecvt<CharType,char,std::mbstate_t>
    233233    {
    234234    public:
    235235        code_converter(std::auto_ptr<base_converter> cvt,size_t refs = 0) :
    236             std::codecvt<CharType,char,mbstate_t>(refs),
     236          std::codecvt<CharType,char,std::mbstate_t>(refs),
    237237            cvt_(cvt)
    238238        {
    239239            max_len_ = cvt_->max_len();
    namespace util {  
    627627
    628628    };
    629629
    630     static const char ensure_mbstate_size_is_at_least_2[sizeof(mbstate_t) >= 2 ? 1 : -1] = {0};
     630    static const char ensure_mbstate_size_is_at_least_2[sizeof(std::mbstate_t) >= 2 ? 1 : -1] = {0};
    631631   
    632632    template<>
    633     class code_converter<char> : public std::codecvt<char,char,mbstate_t>
     633    class code_converter<char> : public std::codecvt<char,char,std::mbstate_t>
    634634    {
    635635    public:
    636636        code_converter(std::auto_ptr<base_converter> /*cvt*/,size_t refs = 0) :
    637             std::codecvt<char,char,mbstate_t>(refs) 
     637          std::codecvt<char,char,std::mbstate_t>(refs) 
    638638        {
    639639        }
    640640    };
  • libs/locale/src/util/gregorian.cpp

    diff --git b/libs/locale/src/util/gregorian.cpp a/libs/locale/src/util/gregorian.cpp
    index 4c7a8c1..9a99cab 100644
    b a namespace util {  
    7070            return days[is_leap(year)][month-1] + day - 1;
    7171        }
    7272       
    73         time_t internal_timegm(std::tm const *t)
     73        std::time_t internal_timegm(std::tm const *t)
    7474        {
    7575            int year = t->tm_year + 1900;
    7676            int month = t->tm_mon;
    namespace util {  
    8888            int day_of_year = days_from_1jan(year,month,day);
    8989            int days_since_epoch = days_from_1970(year) + day_of_year;
    9090           
    91             time_t seconds_in_day = 3600 * 24;
    92             time_t result =  seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec;
     91            std::time_t seconds_in_day = 3600 * 24;
     92            std::time_t result =  seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec;
    9393           
    9494            return result;
    9595        }
    namespace util {  
    235235                    std::tm val = tm_updated_;
    236236                    val.tm_isdst = -1;
    237237                    val.tm_wday = -1; // indecator of error
    238                     time_t point = -1;
     238                    std::time_t point = -1;
    239239                    if(is_local_) {
    240240                        point = mktime(&val);
    241                         if(point == static_cast<time_t>(-1)){
     241                        if(point == static_cast<std::time_t>(-1)){
    242242                            #ifndef BOOST_WINDOWS
    243243                            // windows does not handle negative time_t, under other plaforms
    244244                            // it may be actually valid value in  1969-12-31 23:59:59
    namespace util {  
    318318                        #ifdef BOOST_WINDOWS
    319319                        return 1970; // Unix epoch windows can't handle negative time_t
    320320                        #else
    321                         if(sizeof(time_t) == 4)
     321                        if(sizeof(std::time_t) == 4)
    322322                            return 1901; // minimal year with 32 bit time_t
    323323                        else
    324324                            return 1;
    namespace util {  
    326326                    case absolute_maximum:
    327327                    case least_maximum:
    328328                    case actual_maximum:
    329                         if(sizeof(time_t) == 4)
     329                        if(sizeof(std::time_t) == 4)
    330330                            return 2038; // Y2K38 - maximal with 32 bit time_t
    331331                        else
    332332                            return std::numeric_limits<int>::max();
    namespace util {  
    565565            ///
    566566            virtual void set_time(posix_time const &p)
    567567            {
    568                 from_time(static_cast<time_t>(p.seconds));
     568                from_time(static_cast<std::time_t>(p.seconds));
    569569            }
    570570            virtual posix_time get_time() const 
    571571            {
    namespace util {  
    791791
    792792    private:
    793793
    794         void from_time(time_t point)
     794        void from_time(std::time_t point)
    795795        {
    796             time_t real_point = point + tzoff_;
     796            std::time_t real_point = point + tzoff_;
    797797            std::tm *t = 0;
    798798            #ifdef BOOST_WINDOWS
    799799            // Windows uses TLS, thread safe
    namespace util {  
    811811            time_ = point;
    812812        }
    813813        int first_day_of_week_;
    814         time_t time_;
     814        std::time_t time_;
    815815        std::tm tm_;
    816816        std::tm tm_updated_;
    817817        bool normalized_;
  • libs/locale/src/util/numeric.hpp

    diff --git b/libs/locale/src/util/numeric.hpp a/libs/locale/src/util/numeric.hpp
    index 3155dbc..ee5bb51 100644
    b a  
    1414#include <boost/locale/info.hpp>
    1515#include <sstream>
    1616#include <vector>
     17#include <ctime>
    1718#include <stdlib.h>
    1819
    1920#include "timezone.hpp"
    private:  
    177178        return out;
    178179    }
    179180
    180     iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,time_t time,char c) const
     181    iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,std::time_t time,char c) const
    181182    {
    182183        string_type fmt;
    183184        fmt+=char_type('%');
    private:  
    185186        return format_time(out,ios,fill,time,fmt);
    186187    }
    187188
    188     iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,time_t time,string_type const &format) const
     189    iter_type format_time(iter_type out,std::ios_base &ios,char_type fill,std::time_t time,string_type const &format) const
    189190    {
    190191        std::string tz = ios_info::get(ios).time_zone();
    191192        std::tm tm;