diff --git a/appendix.htm b/appendix.htm index 22e2c1e2..e5bcadf8 100644 --- a/appendix.htm +++ b/appendix.htm @@ -206,7 +206,7 @@ the resource dll, before your code compiles any regular expressions (but not necessarily before you construct any reg_expression instances):

-

boost::w32_regex_traits<char>::set_message_calalogue("mydll.dll"); +

boost::w32_regex_traits<char>::set_message_catalogue("mydll.dll");

Note that this API sets the dll name for both the @@ -239,7 +239,7 @@ the message catalogue, before your code compiles any regular expressions (but not necessarily before you construct any reg_expression instances):

-

boost::c_regex_traits<char>::set_message_calalogue("mycatalogue"); +

boost::c_regex_traits<char>::set_message_catalogue("mycatalogue");

Note that this API sets the dll name for both the @@ -276,7 +276,7 @@ the message catalogue, before your code compiles any regular expressions (but not necessarily before you construct any reg_expression instances):

-

boost::cpp_regex_traits<char>::set_message_calalogue("mycatalogue"); +

boost::cpp_regex_traits<char>::set_message_catalogue("mycatalogue");

Note that calling reg_expression<>::imbue will diff --git a/src/c_regex_traits.cpp b/src/c_regex_traits.cpp index d2ab2608..1dfb24d0 100644 --- a/src/c_regex_traits.cpp +++ b/src/c_regex_traits.cpp @@ -179,12 +179,12 @@ std::list* syntax; #endif -unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id); +std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, std::size_t id); template -unsigned int BOOST_REGEX_CALL re_get_message(charT* buf, unsigned int len, unsigned int id) +std::size_t BOOST_REGEX_CALL re_get_message(charT* buf, std::size_t len, std::size_t id) { - unsigned int size = _re_get_message(static_cast(0), 0, id); + std::size_t size = _re_get_message(static_cast(0), 0, id); if(len < size) return size; boost::scoped_array cb(new char[size]); @@ -193,7 +193,7 @@ unsigned int BOOST_REGEX_CALL re_get_message(charT* buf, unsigned int len, unsig return size; } -inline unsigned int BOOST_REGEX_CALL re_get_message(char* buf, unsigned int len, unsigned int id) +inline std::size_t BOOST_REGEX_CALL re_get_message(char* buf, std::size_t len, std::size_t id) { return _re_get_message(buf, len, id); } @@ -307,7 +307,7 @@ void BOOST_REGEX_CALL re_update_collate() } } -unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id) +std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, std::size_t id) { BOOST_RE_GUARD_STACK // get the customised message if any: @@ -317,7 +317,7 @@ unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsig const char* m = catgets(message_cat, 0, id, 0); if(m) { - unsigned int size = std::strlen(m) + 1; + std::size_t size = std::strlen(m) + 1; if(size > len) return size; std::strcpy(buf, m); @@ -430,7 +430,7 @@ const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id) namespace boost{ namespace re_detail{ -char c_traits_base::regex_message_catalogue[200] = {0}; +char c_traits_base::regex_message_catalogue[BOOST_REGEX_MAX_PATH] = {0}; std::string BOOST_REGEX_CALL c_traits_base::error_string(unsigned id) { @@ -576,7 +576,7 @@ bool BOOST_REGEX_CALL c_regex_traits::lookup_collatename(std::basic_str { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow(static_cast(0), 0, s.c_str()); + std::size_t len = strnarrow(static_cast(0), 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -808,7 +808,7 @@ bool BOOST_REGEX_CALL c_regex_traits::do_lookup_collate(std::basic_stri { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow(static_cast(0), 0, s.c_str()); + std::size_t len = strnarrow(static_cast(0), 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -1018,28 +1018,28 @@ int BOOST_REGEX_CALL c_regex_traits::toi(const wchar_t*& first, const w boost::uint_fast32_t BOOST_REGEX_CALL c_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last) { std::basic_string s(first, last); - unsigned int len = strnarrow(static_cast(0), 0, s.c_str()); + std::size_t len = strnarrow(static_cast(0), 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); - len = do_lookup_class(buf.get()); - return len; + boost::uint_fast32_t result = do_lookup_class(buf.get()); + return result; } c_regex_traits c_regex_traits::init_; -unsigned int BOOST_REGEX_CALL c_regex_traits::strnarrow(char *s1, unsigned int len, const wchar_t *s2) +std::size_t BOOST_REGEX_CALL c_regex_traits::strnarrow(char *s1, std::size_t len, const wchar_t *s2) { BOOST_RE_GUARD_STACK - unsigned int size = std::wcslen(s2) + 1; + std::size_t size = std::wcslen(s2) + 1; if(size > len) return size; return std::wcstombs(s1, s2, len); } -unsigned int BOOST_REGEX_CALL c_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2) +std::size_t BOOST_REGEX_CALL c_regex_traits::strwiden(wchar_t *s1, std::size_t len, const char *s2) { BOOST_RE_GUARD_STACK - unsigned int size = std::strlen(s2) + 1; + std::size_t size = std::strlen(s2) + 1; if(size > len) return size; size = std::mbstowcs(s1, s2, len); diff --git a/src/c_regex_traits_common.cpp b/src/c_regex_traits_common.cpp index e14ba618..7ffb9adf 100644 --- a/src/c_regex_traits_common.cpp +++ b/src/c_regex_traits_common.cpp @@ -199,7 +199,7 @@ const mss default_messages[] = { { 0, "", }, }; -BOOST_REGEX_DECL unsigned int BOOST_REGEX_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id) +BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id) { BOOST_RE_GUARD_STACK const mss* pm = default_messages; @@ -207,7 +207,7 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CALL re_get_default_message(char* buf, { if(pm->id == id) { - unsigned int size = re_strlen(pm->what) + 1; + std::size_t size = re_strlen(pm->what) + 1; if(size > len) return size; re_strcpy(buf, pm->what); diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp index d0df40e4..d9e102fa 100644 --- a/src/cpp_regex_traits.cpp +++ b/src/cpp_regex_traits.cpp @@ -116,10 +116,11 @@ template typename parser_buf::pos_type parser_buf::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) { + typedef typename parser_buf::pos_type pos_type; if(which & ::std::ios_base::out) return pos_type(off_type(-1)); - int size = this->egptr() - this->eback(); - int pos = this->gptr() - this->eback(); + std::ptrdiff_t size = this->egptr() - this->eback(); + std::ptrdiff_t pos = this->gptr() - this->eback(); charT* g = this->eback(); switch(way) { @@ -135,14 +136,14 @@ parser_buf::seekoff(off_type off, ::std::ios_base::seekdir way, : this->setg(g, g + size - off, g + size); case ::std::ios_base::cur: { - int newpos = pos + off; + std::ptrdiff_t newpos = pos + off; if((newpos < 0) || (newpos > size)) return pos_type(off_type(-1)); else this->setg(g, g + newpos, g + size); } } - return this->gptr() - this->eback(); + return static_cast(this->gptr() - this->eback()); } template @@ -151,7 +152,7 @@ parser_buf::seekpos(pos_type sp, ::std::ios_base::openmode which) { if(which & ::std::ios_base::out) return pos_type(off_type(-1)); - int size = this->egptr() - this->eback(); + std::ptrdiff_t size = this->egptr() - this->eback(); charT* g = this->eback(); if(sp <= size) { @@ -171,7 +172,7 @@ struct message_data { unsigned char syntax_map[CHAR_MAX-CHAR_MIN]; std::map > collating_elements; - std::map > classes; + std::map > classes; //std::string _zero; //std::string _ten; parser_buf sbuf; @@ -209,10 +210,10 @@ message_data::message_data(const std::locale& l, const std::string& regex_ } #endif std::memset(syntax_map, cpp_regex_traits::syntax_char, 256); - unsigned int i; + unsigned i; scoped_array a; - unsigned array_size = 0; - unsigned new_size; + std::size_t array_size = 0; + std::size_t new_size; for(i = 1; i < cpp_regex_traits::syntax_max; ++i) { new_size = re_get_default_message(0, 0, i+100); @@ -227,7 +228,7 @@ message_data::message_data(const std::locale& l, const std::string& regex_ if((int)cat >= 0) s = pm->get(cat, 0, i+100, s); #endif - for(unsigned int j = 0; j < s.size(); ++j) + for(std::size_t j = 0; j < s.size(); ++j) { syntax_map[s[j]] = (unsigned char)(i); } @@ -290,7 +291,7 @@ std::string BOOST_REGEX_CALL cpp_regex_traits_base::set_message_catalogue(const return old; } -char cpp_regex_traits_base::regex_message_cat[200] = {0}; +char cpp_regex_traits_base::regex_message_cat[BOOST_REGEX_MAX_PATH] = {0}; } // namespace re_detail @@ -343,7 +344,7 @@ int BOOST_REGEX_CALL cpp_regex_traits::toi(char c)const int BOOST_REGEX_CALL cpp_regex_traits::toi(const char*& first, const char* last, int radix)const { - pmd->sbuf.pubsetbuf(const_cast(first), last-first); + pmd->sbuf.pubsetbuf(const_cast(first), static_cast(last-first)); pmd->is.clear(); if(std::abs(radix) == 16) pmd->is >> std::hex; else if(std::abs(radix) == 8) pmd->is >> std::oct; @@ -364,7 +365,7 @@ boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits::lookup_classname(c unsigned int i; std::string s(first, last); - std::map >::const_iterator pos = pmd->classes.find(s); + std::map >::const_iterator pos = pmd->classes.find(s); if(pos != pmd->classes.end()) return re_char_class_id[(*pos).second]; @@ -445,7 +446,7 @@ namespace re_detail{ std::string BOOST_REGEX_CALL to_narrow(const std::basic_string& is, const std::codecvt& cvt) { BOOST_RE_GUARD_STACK - unsigned int bufsize = is.size() * 2; + std::basic_string::size_type bufsize = is.size() * 2; // // declare buffer first as VC6 workaround for internal compiler error! char* pc = new char[bufsize]; @@ -484,8 +485,8 @@ std::string BOOST_REGEX_CALL to_narrow(const std::basic_string& is, con std::wstring BOOST_REGEX_CALL to_wide(const std::string& is, const std::codecvt& cvt) { BOOST_RE_GUARD_STACK - unsigned int bufsize = is.size() + 2; - unsigned int maxsize = is.size() * 100; + std::string::size_type bufsize = is.size() + 2; + std::string::size_type maxsize = is.size() * 100; // // declare buffer first as VC6 workaround for internal compiler error! wchar_t* pc = new wchar_t[bufsize]; @@ -547,7 +548,7 @@ struct message_data }; std::list syntax; - std::map classes; + std::map classes; std::map collating_elements; unsigned char syntax_[CHAR_MAX-CHAR_MIN+1]; @@ -586,9 +587,9 @@ message_data::message_data(const std::locale& l, const std::string& reg } #endif scoped_array a; - unsigned array_size = 0; - unsigned new_size; - unsigned int i; + std::size_t array_size = 0; + std::size_t new_size; + std::size_t i; std::memset(syntax_, cpp_regex_traits::syntax_char, sizeof(syntax_)); for(i = 1; i < cpp_regex_traits::syntax_max; ++i) { @@ -603,7 +604,7 @@ message_data::message_data(const std::locale& l, const std::string& reg string_type s = to_wide(ns, cvt); #ifndef BOOST_NO_STD_MESSAGES if((int)cat >= 0) - s = BOOST_USE_FACET(std::messages, l).get(cat, 0, i+100, s); + s = BOOST_USE_FACET(std::messages, l).get(cat, 0, (int)i+100, s); #endif for(unsigned int j = 0; j < s.size(); ++j) { @@ -612,7 +613,7 @@ message_data::message_data(const std::locale& l, const std::string& reg else { m.c = s[j]; - m.type = i; + m.type = static_cast(i); syntax.push_back(m); } } @@ -624,7 +625,7 @@ message_data::message_data(const std::locale& l, const std::string& reg i = 400; if((int)cat >= 0) { - c2 = msgs.get(cat, 0, i, c1); + c2 = msgs.get(cat, 0, (int)i, c1); while(c2.size()) { const wchar_t* p1, *p2, *p3, *p4;; @@ -639,7 +640,7 @@ message_data::message_data(const std::locale& l, const std::string& reg collating_elements[std::basic_string(p1, p2)] = std::basic_string(p3, p4); ++i; - c2 = msgs.get(cat, 0, i, c1); + c2 = msgs.get(cat, 0, (int)i, c1); } } @@ -648,13 +649,13 @@ message_data::message_data(const std::locale& l, const std::string& reg c2.erase(); for(i = 0; i < re_classes_max; ++i) { - c1 = msgs.get(cat, 0, i+300, c2); + c1 = msgs.get(cat, 0, static_cast(i+300), c2); if(c1.size()) classes[c1] = i; } for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i) { - c1 = msgs.get(cat, 0, i+200, c2); + c1 = msgs.get(cat, 0, static_cast(i+200), c2); error_strings[i] = to_narrow(c1, cvt); } } @@ -720,7 +721,7 @@ int BOOST_REGEX_CALL cpp_regex_traits::toi(wchar_t c)const int BOOST_REGEX_CALL cpp_regex_traits::toi(const wchar_t*& first, const wchar_t* last, int radix)const { - pmd->sbuf.pubsetbuf(const_cast(first), last-first); + pmd->sbuf.pubsetbuf(const_cast(first), static_cast(last-first)); pmd->is.clear(); if(std::abs(radix) == 16) pmd->is >> std::hex; else if(std::abs(radix) == 8) pmd->is >> std::oct; @@ -741,7 +742,7 @@ boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits::lookup_classnam unsigned int i; std::wstring s(first, last); - std::map::const_iterator pos = pmd->classes.find(s); + std::map::const_iterator pos = pmd->classes.find(s); if(pos != pmd->classes.end()) return re_char_class_id[(*pos).second]; @@ -831,7 +832,7 @@ cpp_regex_traits::locale_type BOOST_REGEX_CALL cpp_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2)const +std::size_t BOOST_REGEX_CALL cpp_regex_traits::strwiden(wchar_t *s1, std::size_t len, const char *s2)const { std::string s(s2); std::wstring ws = re_detail::to_wide(s2, *pcdv); diff --git a/src/cregex.cpp b/src/cregex.cpp index d9a54b47..4ffb25bb 100644 --- a/src/cregex.cpp +++ b/src/cregex.cpp @@ -39,7 +39,7 @@ namespace boost{ // we need to instantiate the vector classes we use // since declaring a reference to type doesn't seem to // do the job... -std::vector inst1; +std::vector inst1; std::vector inst2; #endif #endif @@ -84,7 +84,7 @@ public: unsigned line; mapfile::iterator fbase; std::map > strings; - std::map > positions; + std::map > positions; void update(); void clean(); RegExData() : e(), m(), fm(), t(type_copy), pbase(0), line(0), fbase(), strings(), positions() {} @@ -283,21 +283,21 @@ unsigned int RegEx::Grep(std::vector& v, const char* p, unsigned in namespace re_detail{ struct pred3 { - std::vector& v; + std::vector& v; const char* base; RegEx* pe; - pred3(std::vector& o, const char* pb, RegEx* p) : v(o), base(pb), pe(p) {} + pred3(std::vector& o, const char* pb, RegEx* p) : v(o), base(pb), pe(p) {} bool operator()(const cmatch& m) { pe->pdata->m = m; - v.push_back(m[0].first - base); + v.push_back(static_cast(m[0].first - base)); return true; } private: pred3& operator=(const pred3&); }; } -unsigned int RegEx::Grep(std::vector& v, const char* p, unsigned int flags) +unsigned int RegEx::Grep(std::vector& v, const char* p, unsigned int flags) { BOOST_RE_GUARD_STACK pdata->t = re_detail::RegExData::type_pc; @@ -452,7 +452,7 @@ std::string RegEx::Merge(const char* in, const char* fmt, return result; } -unsigned int RegEx::Split(std::vector& v, +std::size_t RegEx::Split(std::vector& v, std::string& s, unsigned flags, unsigned max_count) @@ -465,7 +465,7 @@ unsigned int RegEx::Split(std::vector& v, // // now operators for returning what matched in more detail: // -unsigned int RegEx::Position(int i)const +std::size_t RegEx::Position(int i)const { BOOST_RE_GUARD_STACK switch(pdata->t) @@ -509,7 +509,7 @@ unsigned int RegEx::Marks()const } -unsigned int RegEx::Length(int i)const +std::size_t RegEx::Length(int i)const { BOOST_RE_GUARD_STACK switch(pdata->t) diff --git a/src/posix_api.cpp b/src/posix_api.cpp index cd3dc0a2..19774633 100644 --- a/src/posix_api.cpp +++ b/src/posix_api.cpp @@ -103,10 +103,10 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char } -BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, unsigned int buf_size) +BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, regsize_t buf_size) { BOOST_RE_GUARD_STACK - unsigned int result = 0; + std::size_t result = 0; if(code & REG_ITOA) { code &= ~REG_ITOA; @@ -149,7 +149,7 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorA(int code, const regex_ boost::regex_traits t; p = t.error_string(code); } - unsigned int len = p.size(); + std::size_t len = p.size(); if(len < buf_size) { std::strcpy(buf, p.c_str()); @@ -161,7 +161,7 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorA(int code, const regex_ return 0; } -BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, unsigned int n, regmatch_t* array, int eflags) +BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, regsize_t n, regmatch_t* array, int eflags) { BOOST_RE_GUARD_STACK bool result = false; diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp index d1a5aa0d..71acbb1c 100644 --- a/src/w32_regex_traits.cpp +++ b/src/w32_regex_traits.cpp @@ -161,12 +161,12 @@ std::list* syntax; #endif -unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id); +std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, unsigned id); template -unsigned int BOOST_REGEX_CALL get_message(charT* buf, unsigned int len, unsigned int id) +std::size_t BOOST_REGEX_CALL get_message(charT* buf, std::size_t len, unsigned id) { - unsigned int size = _re_get_message(static_cast(0), 0, id); + std::size_t size = _re_get_message(static_cast(0), 0, id); if(len < size) return size; boost::scoped_array cb(new char[size]); @@ -175,18 +175,18 @@ unsigned int BOOST_REGEX_CALL get_message(charT* buf, unsigned int len, unsigned return size; } -inline unsigned int BOOST_REGEX_CALL get_message(char* buf, unsigned int len, unsigned int id) +inline std::size_t BOOST_REGEX_CALL get_message(char* buf, std::size_t len, unsigned id) { return _re_get_message(buf, len, id); } -unsigned int BOOST_REGEX_CALL _re_get_message(char* buf, unsigned int len, unsigned int id) +std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, unsigned id) { BOOST_RE_GUARD_STACK // get the customised message if any: if(len < 255) return 255; - unsigned int size = 0; + std::size_t size = 0; if(hresmod) size = LoadStringA(hresmod, BOOST_RE_MESSAGE_BASE + id, buf, 255); if(size) @@ -223,7 +223,7 @@ namespace boost{ namespace re_detail{ -char w32_traits_base::regex_message_catalogue[200] = {0}; +char w32_traits_base::regex_message_catalogue[BOOST_REGEX_MAX_PATH] = {0}; void BOOST_REGEX_CALL w32_traits_base::do_init() { @@ -514,7 +514,7 @@ void BOOST_REGEX_CALL w32_regex_traits::transform(std::string& out, const return; } scoped_array buf(new char[n+1]); - n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, buf.get(), n); + n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, buf.get(), (int)n); if(n == (size_t)(-1)) { out = in; @@ -582,7 +582,7 @@ bool BOOST_REGEX_CALL w32_regex_traits::lookup_collatename(std::basic_s { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow(static_cast(0), 0, s.c_str()); + std::size_t len = strnarrow(static_cast(0), 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -622,7 +622,7 @@ bool BOOST_REGEX_CALL w32_regex_traits::do_lookup_collate(std::basic_st { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow(static_cast(0), 0, s.c_str()); + std::size_t len = strnarrow(static_cast(0), 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -712,9 +712,9 @@ void BOOST_REGEX_CALL w32_regex_traits::transform(std::basic_string t(new char[n+1]); if(isPlatformNT) - n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, reinterpret_cast(t.get()), n); + n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, reinterpret_cast(t.get()), (int)n); else - n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, t.get(), n); + n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, t.get(), (int)n); int i = -1; do { @@ -785,11 +785,11 @@ int BOOST_REGEX_CALL w32_regex_traits::toi(const wchar_t*& first, const boost::uint_fast32_t BOOST_REGEX_CALL w32_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last) { std::basic_string s(first, last); - unsigned int len = strnarrow(static_cast(0), 0, s.c_str()); + std::size_t len = strnarrow(static_cast(0), 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); - len = do_lookup_class(buf.get()); - return len; + boost::uint_fast32_t result = do_lookup_class(buf.get()); + return result; } wchar_t BOOST_REGEX_CALL w32_regex_traits::wtolower(wchar_t c) @@ -803,22 +803,22 @@ wchar_t BOOST_REGEX_CALL w32_regex_traits::wtolower(wchar_t c) w32_regex_traits w32_regex_traits::init_; -unsigned int BOOST_REGEX_CALL w32_regex_traits::strnarrow(char *s1, unsigned int len, const wchar_t *s2) +std::size_t BOOST_REGEX_CALL w32_regex_traits::strnarrow(char *s1, std::size_t len, const wchar_t *s2) { BOOST_RE_GUARD_STACK - unsigned int size = WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, 0, 0, 0); + std::size_t size = WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, 0, 0, 0); if(size > len) return size; - return WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, len, 0, 0); + return WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, (int)len, 0, 0); } -unsigned int BOOST_REGEX_CALL w32_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2) +std::size_t BOOST_REGEX_CALL w32_regex_traits::strwiden(wchar_t *s1, std::size_t len, const char *s2) { BOOST_RE_GUARD_STACK - unsigned int size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, 0); + std::size_t size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, 0); if(size > len) return size; - return MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, len); + return MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, s1, (int)len); } unsigned short w32_regex_traits::wide_unicode_classes[] = { diff --git a/src/wide_posix_api.cpp b/src/wide_posix_api.cpp index 83dd7a03..dabd5ebc 100644 --- a/src/wide_posix_api.cpp +++ b/src/wide_posix_api.cpp @@ -111,10 +111,10 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha } -BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, unsigned int buf_size) +BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, regsize_t buf_size) { BOOST_RE_GUARD_STACK - unsigned int result = 0; + std::size_t result = 0; if(code & REG_ITOA) { code &= ~REG_ITOA; @@ -157,7 +157,7 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorW(int code, const regex_ pt = &static_cast(e->guts)->get_traits(); (void)pt; // warning suppression std::string p = pt->error_string(code); - unsigned int len = pt->strwiden(static_cast(0), 0, p.c_str()); + std::size_t len = pt->strwiden(static_cast(0), 0, p.c_str()); if(len < buf_size) { pt->strwiden(buf, buf_size, p.c_str()); @@ -169,7 +169,7 @@ BOOST_REGEX_DECL unsigned int BOOST_REGEX_CCALL regerrorW(int code, const regex_ return 0; } -BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, unsigned int n, regmatch_t* array, int eflags) +BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, regsize_t n, regmatch_t* array, int eflags) { BOOST_RE_GUARD_STACK bool result = false; diff --git a/template_class_ref.htm b/template_class_ref.htm index 6ff0b546..10c28d52 100644 --- a/template_class_ref.htm +++ b/template_class_ref.htm @@ -462,7 +462,7 @@ for a container of charT.

   Allocator get_allocator()const;    //    // locale: -   locale_type imbue(const locale_type& l); +   locale_type imbue(locale_type l);    locale_type getloc()const;    //    // flags: diff --git a/test/regress/regress.h b/test/regress/regress.h index 0970a76d..cd3f1f99 100644 --- a/test/regress/regress.h +++ b/test/regress/regress.h @@ -45,6 +45,10 @@ using std::endl; #if defined(TEST_UNICODE) +#ifdef BOOST_NO_WREGEX +#error "Wide character support is not enabled in regex lib - can't build wide character test program" +#endif + #ifdef __GNUC__ #define char_t wchar_t #else @@ -410,6 +414,10 @@ __iterator_category(const debug_iterator&) { } #endif +#if defined(_WIN32) && !defined(BOOST_RE_TEST_LOCALE_CPP) && !defined(BOOST_RE_TEST_LOCALE_C) && !defined(BOOST_RE_TEST_LOCALE_W32) +#define BOOST_RE_TEST_LOCALE_W32 +#endif + #ifdef BOOST_RE_TEST_LOCALE_W32 typedef boost::reg_expression, jm_debug_alloc> re_type; diff --git a/test/regress/tests.cpp b/test/regress/tests.cpp index b41f3190..6e161aad 100644 --- a/test/regress/tests.cpp +++ b/test/regress/tests.cpp @@ -147,7 +147,7 @@ public: template bool grep_test_predicate::operator()(const boost::match_results< iterator, Alloc >& m) { - int start, end; + std::ptrdiff_t start, end; start = m[0].first - base; end = m[0].second - base; if((matches[match_id] != start) || (matches[match_id + 1] != end)) @@ -452,7 +452,7 @@ __cdecl #endif hl_grep_test_proc(const RegEx& e) { - int start, end; + std::ptrdiff_t start, end; start = e.Position(0); end = start + e.Length();