From fa96f4edf1d1e7362c822499bb9ee430e5585dc7 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 5 May 2010 17:40:07 +0000 Subject: [PATCH] Change "id" to "idx" to be Objective C++ compatible. Fixes #2306. Fixes #4132. Fixes #4191. [SVN r61789] --- .../boost/regex/v4/basic_regex_creator.hpp | 23 ++-- include/boost/regex/v4/perl_matcher.hpp | 4 +- .../boost/regex/v4/perl_matcher_common.hpp | 8 +- .../regex/v4/perl_matcher_non_recursive.hpp | 20 ++-- .../boost/regex/v4/perl_matcher_recursive.hpp | 6 +- src/c_regex_traits.cpp | 10 +- src/icu.cpp | 18 +-- src/w32_regex_traits.cpp | 108 +++++++++--------- src/wc_regex_traits.cpp | 10 +- 9 files changed, 104 insertions(+), 103 deletions(-) diff --git a/include/boost/regex/v4/basic_regex_creator.hpp b/include/boost/regex/v4/basic_regex_creator.hpp index 0909a836..fe971ed5 100644 --- a/include/boost/regex/v4/basic_regex_creator.hpp +++ b/include/boost/regex/v4/basic_regex_creator.hpp @@ -769,14 +769,14 @@ void basic_regex_creator::fixup_recursions(re_syntax_base* state) case syntax_element_assert_backref: { // just check that the index is valid: - int id = static_cast(state)->index; - if(id < 0) + int idx = static_cast(state)->index; + if(idx < 0) { - id = -id-1; - if(id >= 10000) + idx = -idx-1; + if(idx >= 10000) { - id = m_pdata->get_id(id); - if(id <= 0) + idx = m_pdata->get_id(idx); + if(idx <= 0) { // check of sub-expression that doesn't exist: if(0 == this->m_pdata->m_status) // update the error code if not already set @@ -804,12 +804,12 @@ void basic_regex_creator::fixup_recursions(re_syntax_base* state) { bool ok = false; re_syntax_base* p = base; - std::ptrdiff_t id = static_cast(state)->alt.i; - if(id > 10000) - id = m_pdata->get_id(id); + std::ptrdiff_t idx = static_cast(state)->alt.i; + if(idx > 10000) + idx = m_pdata->get_id(idx); while(p) { - if((p->type == syntax_element_startmark) && (static_cast(p)->index == id)) + if((p->type == syntax_element_startmark) && (static_cast(p)->index == idx)) { // // We've found the target of the recursion, set the jump target: @@ -833,7 +833,7 @@ void basic_regex_creator::fixup_recursions(re_syntax_base* state) next_rep_id = static_cast(p)->state_id; break; case syntax_element_endmark: - if(static_cast(p)->index == id) + if(static_cast(p)->index == idx) next_rep_id = -1; break; default: @@ -1543,3 +1543,4 @@ void basic_regex_creator::probe_leading_repeat(re_syntax_base* st #endif #endif + diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index d2be50fd..52cc55cc 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -336,7 +336,7 @@ struct recursion_info { typedef typename Results::value_type value_type; typedef typename value_type::iterator iterator; - int id; + int idx; const re_syntax_base* preturn_address; Results results; repeater_count* repeater_stack; @@ -522,7 +522,7 @@ private: void push_repeater_count(int i, repeater_count** s); void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id); void push_non_greedy_repeat(const re_syntax_base* ps); - void push_recursion(int id, const re_syntax_base* p, results_type* presults); + void push_recursion(int idx, const re_syntax_base* p, results_type* presults); void push_recursion_pop(); // pointer to base of stack: diff --git a/include/boost/regex/v4/perl_matcher_common.hpp b/include/boost/regex/v4/perl_matcher_common.hpp index b5bd5936..fe224210 100644 --- a/include/boost/regex/v4/perl_matcher_common.hpp +++ b/include/boost/regex/v4/perl_matcher_common.hpp @@ -732,10 +732,10 @@ inline bool perl_matcher::match_assert_backref( { // Have we recursed into subexpression "index"? // If index == 0 then check for any recursion at all, otherwise for recursion to -index-1. - int id = -index-1; - if(id >= 10000) - id = re.get_data().get_id(id); - result = !recursion_stack.empty() && ((recursion_stack.back().id == id) || (index == 0)); + int idx = -index-1; + if(idx >= 10000) + idx = re.get_data().get_id(idx); + result = !recursion_stack.empty() && ((recursion_stack.back().idx == idx) || (index == 0)); pstate = pstate->next.p; } return result; diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index b62a42b2..7ab67817 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -130,8 +130,8 @@ struct saved_single_repeat : public saved_state template struct saved_recursion : public saved_state { - saved_recursion(int id, const re_syntax_base* p, Results* pr) - : saved_state(14), recursion_id(id), preturn_address(p), results(*pr) + saved_recursion(int idx, const re_syntax_base* p, Results* pr) + : saved_state(14), recursion_id(idx), preturn_address(p), results(*pr) {} int recursion_id; const re_syntax_base* preturn_address; @@ -329,7 +329,7 @@ inline void perl_matcher::push_single_repeat(st } template -inline void perl_matcher::push_recursion(int id, const re_syntax_base* p, results_type* presults) +inline void perl_matcher::push_recursion(int idx, const re_syntax_base* p, results_type* presults) { saved_recursion* pmp = static_cast*>(m_backup_state); --pmp; @@ -339,7 +339,7 @@ inline void perl_matcher::push_recursion(int id pmp = static_cast*>(m_backup_state); --pmp; } - (void) new (pmp)saved_recursion(id, p, presults); + (void) new (pmp)saved_recursion(idx, p, presults); m_backup_state = pmp; } @@ -910,7 +910,7 @@ bool perl_matcher::match_recursion() push_repeater_count(static_cast(pstate)->state_id, &next_count); } pstate = static_cast(pstate)->alt.p; - recursion_stack.back().id = static_cast(pstate)->index; + recursion_stack.back().idx = static_cast(pstate)->index; return true; } @@ -928,11 +928,11 @@ bool perl_matcher::match_endmark() } if(!recursion_stack.empty()) { - if(index == recursion_stack.back().id) + if(index == recursion_stack.back().idx) { pstate = recursion_stack.back().preturn_address; *m_presult = recursion_stack.back().results; - push_recursion(recursion_stack.back().id, recursion_stack.back().preturn_address, &recursion_stack.back().results); + push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results); recursion_stack.pop_back(); } } @@ -952,10 +952,10 @@ bool perl_matcher::match_match() { if(!recursion_stack.empty()) { - BOOST_ASSERT(0 == recursion_stack.back().id); + BOOST_ASSERT(0 == recursion_stack.back().idx); pstate = recursion_stack.back().preturn_address; *m_presult = recursion_stack.back().results; - push_recursion(recursion_stack.back().id, recursion_stack.back().preturn_address, &recursion_stack.back().results); + push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results); recursion_stack.pop_back(); return true; } @@ -1523,7 +1523,7 @@ bool perl_matcher::unwind_recursion(bool r) if(!r) { recursion_stack.push_back(recursion_info()); - recursion_stack.back().id = pmp->recursion_id; + recursion_stack.back().idx = pmp->recursion_id; recursion_stack.back().preturn_address = pmp->preturn_address; recursion_stack.back().results = pmp->results; } diff --git a/include/boost/regex/v4/perl_matcher_recursive.hpp b/include/boost/regex/v4/perl_matcher_recursive.hpp index 7436fa6c..74c29122 100644 --- a/include/boost/regex/v4/perl_matcher_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_recursive.hpp @@ -866,7 +866,7 @@ bool perl_matcher::match_recursion() recursion_stack.back().results = *m_presult; recursion_stack.back().repeater_stack = next_count; pstate = static_cast(pstate)->alt.p; - recursion_stack.back().id = static_cast(pstate)->index; + recursion_stack.back().idx = static_cast(pstate)->index; repeater_count* saved = next_count; repeater_count r(&next_count); // resets all repeat counts since we're recursing and starting fresh on those @@ -897,7 +897,7 @@ bool perl_matcher::match_endmark() } if(!recursion_stack.empty()) { - if(index == recursion_stack.back().id) + if(index == recursion_stack.back().idx) { recursion_info saved = recursion_stack.back(); recursion_stack.pop_back(); @@ -929,7 +929,7 @@ bool perl_matcher::match_match() { if(!recursion_stack.empty()) { - BOOST_ASSERT(0 == recursion_stack.back().id); + BOOST_ASSERT(0 == recursion_stack.back().idx); const re_syntax_base* saved_state = pstate = recursion_stack.back().preturn_address; *m_presult = recursion_stack.back().results; recursion_stack.pop_back(); diff --git a/src/c_regex_traits.cpp b/src/c_regex_traits.cpp index 6466bc42..a99de14c 100644 --- a/src/c_regex_traits.cpp +++ b/src/c_regex_traits.cpp @@ -155,16 +155,16 @@ c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits::loo char_class_xdigit, }; - int id = ::boost::re_detail::get_default_class_id(p1, p2); - if(id < 0) + int idx = ::boost::re_detail::get_default_class_id(p1, p2); + if(idx < 0) { std::string s(p1, p2); for(std::string::size_type i = 0; i < s.size(); ++i) s[i] = static_cast((std::tolower)(static_cast(s[i]))); - id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size()); + idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size()); } - BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0])); - return masks[id+1]; + BOOST_ASSERT(std::size_t(idx+1) < sizeof(masks) / sizeof(masks[0])); + return masks[idx+1]; } bool BOOST_REGEX_CALL c_regex_traits::isctype(char c, char_class_type mask) diff --git a/src/icu.cpp b/src/icu.cpp index a815e915..75ca1444 100644 --- a/src/icu.cpp +++ b/src/icu.cpp @@ -388,14 +388,14 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_ char_class_type(U_GC_ND_MASK) | mask_xdigit, }; - int id = ::boost::re_detail::get_default_class_id(p1, p2); - if(id >= 0) - return masks[id+1]; + int idx = ::boost::re_detail::get_default_class_id(p1, p2); + if(idx >= 0) + return masks[idx+1]; char_class_type result = lookup_icu_mask(p1, p2); if(result != 0) return result; - if(id < 0) + if(idx < 0) { string_type s(p1, p2); string_type::size_type i = 0; @@ -411,16 +411,16 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_ } } if(s.size()) - id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size()); - if(id >= 0) - return masks[id+1]; + idx = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size()); + if(idx >= 0) + return masks[idx+1]; if(s.size()) result = lookup_icu_mask(&*s.begin(), &*s.begin() + s.size()); if(result != 0) return result; } - BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0])); - return masks[id+1]; + BOOST_ASSERT(std::size_t(idx+1) < sizeof(masks) / sizeof(masks[0])); + return masks[idx+1]; } icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_type* p1, const char_type* p2) const diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp index 365fccc0..8c22214d 100644 --- a/src/w32_regex_traits.cpp +++ b/src/w32_regex_traits.cpp @@ -43,10 +43,10 @@ namespace std{ namespace boost{ namespace re_detail{ #ifdef BOOST_NO_ANSI_APIS -UINT get_code_page_for_locale_id(lcid_type id) +UINT get_code_page_for_locale_id(lcid_type idx) { WCHAR code_page_string[7]; - if (::GetLocaleInfoW(id, LOCALE_IDEFAULTANSICODEPAGE, code_page_string, 7) == 0) + if (::GetLocaleInfoW(idx, LOCALE_IDEFAULTANSICODEPAGE, code_page_string, 7) == 0) return 0; return static_cast(_wtol(code_page_string)); @@ -157,15 +157,15 @@ BOOST_REGEX_DECL lcid_type BOOST_REGEX_CALL w32_get_default_locale() return ::GetUserDefaultLCID(); } -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type id) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type idx) { #ifndef BOOST_NO_ANSI_APIS WORD mask; - if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER)) + if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER)) return true; return false; #else - UINT code_page = get_code_page_for_locale_id(id); + UINT code_page = get_code_page_for_locale_id(idx); if (code_page == 0) return false; @@ -174,39 +174,39 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type id) return false; WORD mask; - if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER)) return true; return false; #endif } -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type id) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type idx) { WORD mask; - if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER)) return true; return false; } #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type id) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type idx) { WORD mask; wchar_t c = ca; - if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER)) return true; return false; } #endif -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type id) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type idx) { #ifndef BOOST_NO_ANSI_APIS WORD mask; - if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER)) + if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER)) return true; return false; #else - UINT code_page = get_code_page_for_locale_id(id); + UINT code_page = get_code_page_for_locale_id(idx); if (code_page == 0) return false; @@ -215,25 +215,25 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type id) return false; WORD mask; - if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER)) return true; return false; #endif } -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t c, lcid_type id) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t c, lcid_type idx) { WORD mask; - if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER)) return true; return false; } #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type id) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type idx) { WORD mask; wchar_t c = ca; - if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER)) return true; return false; } @@ -322,11 +322,11 @@ BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_cat_get( } #endif #endif -BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const char* p1, const char* p2) +BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type idx, const char* p1, const char* p2) { #ifndef BOOST_NO_ANSI_APIS int bytes = ::LCMapStringA( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type p1, // source string static_cast(p2 - p1), // number of characters in source string @@ -337,7 +337,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const return std::string(p1, p2); std::string result(++bytes, '\0'); bytes = ::LCMapStringA( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type p1, // source string static_cast(p2 - p1), // number of characters in source string @@ -345,7 +345,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const bytes // size of destination buffer ); #else - UINT code_page = get_code_page_for_locale_id(id); + UINT code_page = get_code_page_for_locale_id(idx); if(code_page == 0) return std::string(p1, p2); @@ -355,7 +355,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const return std::string(p1, p2); int bytes = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type wide_p1, // source string src_len, // number of characters in source string @@ -366,7 +366,7 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const return std::string(p1, p2); std::string result(++bytes, '\0'); bytes = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type wide_p1, // source string src_len, // number of characters in source string @@ -384,10 +384,10 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const } #ifndef BOOST_NO_WREGEX -BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const wchar_t* p1, const wchar_t* p2) +BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type idx, const wchar_t* p1, const wchar_t* p2) { int bytes = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type p1, // source string static_cast(p2 - p1), // number of characters in source string @@ -398,7 +398,7 @@ BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const return std::wstring(p1, p2); std::string result(++bytes, '\0'); bytes = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type p1, // source string static_cast(p2 - p1), // number of characters in source string @@ -417,10 +417,10 @@ BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const return r2; } #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_transform(lcid_type id, const unsigned short* p1, const unsigned short* p2) +BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_transform(lcid_type idx, const unsigned short* p1, const unsigned short* p2) { int bytes = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type (LPCWSTR)p1, // source string static_cast(p2 - p1), // number of characters in source string @@ -431,7 +431,7 @@ BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_transfor return std::basic_string(p1, p2); std::string result(++bytes, '\0'); bytes = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_SORTKEY, // mapping transformation type (LPCWSTR)p1, // source string static_cast(p2 - p1), // number of characters in source string @@ -451,12 +451,12 @@ BOOST_REGEX_DECL std::basic_string BOOST_REGEX_CALL w32_transfor } #endif #endif -BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id) +BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx) { char result[2]; #ifndef BOOST_NO_ANSI_APIS int b = ::LCMapStringA( - id, // locale identifier + idx, // locale identifier LCMAP_LOWERCASE, // mapping transformation type &c, // source string 1, // number of characters in source string @@ -465,7 +465,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id) if(b == 0) return c; #else - UINT code_page = get_code_page_for_locale_id(id); + UINT code_page = get_code_page_for_locale_id(idx); if (code_page == 0) return c; @@ -475,7 +475,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id) WCHAR wide_result; int b = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_LOWERCASE, // mapping transformation type &wide_c, // source string 1, // number of characters in source string @@ -491,11 +491,11 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id) } #ifndef BOOST_NO_WREGEX -BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type id) +BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type idx) { wchar_t result[2]; int b = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_LOWERCASE, // mapping transformation type &c, // source string 1, // number of characters in source string @@ -506,11 +506,11 @@ BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type id) return result[0]; } #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type id) +BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type idx) { wchar_t result[2]; int b = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_LOWERCASE, // mapping transformation type (wchar_t const*)&c, // source string 1, // number of characters in source string @@ -522,12 +522,12 @@ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, l } #endif #endif -BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id) +BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type idx) { char result[2]; #ifndef BOOST_NO_ANSI_APIS int b = ::LCMapStringA( - id, // locale identifier + idx, // locale identifier LCMAP_UPPERCASE, // mapping transformation type &c, // source string 1, // number of characters in source string @@ -536,7 +536,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id) if(b == 0) return c; #else - UINT code_page = get_code_page_for_locale_id(id); + UINT code_page = get_code_page_for_locale_id(idx); if(code_page == 0) return c; @@ -546,7 +546,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id) WCHAR wide_result; int b = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_UPPERCASE, // mapping transformation type &wide_c, // source string 1, // number of characters in source string @@ -562,11 +562,11 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id) } #ifndef BOOST_NO_WREGEX -BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type id) +BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type idx) { wchar_t result[2]; int b = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_UPPERCASE, // mapping transformation type &c, // source string 1, // number of characters in source string @@ -577,11 +577,11 @@ BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type id) return result[0]; } #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, lcid_type id) +BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, lcid_type idx) { wchar_t result[2]; int b = ::LCMapStringW( - id, // locale identifier + idx, // locale identifier LCMAP_UPPERCASE, // mapping transformation type (wchar_t const*)&c, // source string 1, // number of characters in source string @@ -593,14 +593,14 @@ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, l } #endif #endif -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, char c) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, char c) { WORD mask; #ifndef BOOST_NO_ANSI_APIS - if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) + if(::GetStringTypeExA(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) return true; #else - UINT code_page = get_code_page_for_locale_id(id); + UINT code_page = get_code_page_for_locale_id(idx); if(code_page == 0) return false; @@ -608,7 +608,7 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, c if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0) return false; - if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &wide_c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) return true; #endif if((m & w32_regex_traits_implementation::mask_word) && (c == '_')) @@ -617,10 +617,10 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, c } #ifndef BOOST_NO_WREGEX -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, wchar_t c) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, wchar_t c) { WORD mask; - if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) + if(::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) return true; if((m & w32_regex_traits_implementation::mask_word) && (c == '_')) return true; @@ -629,10 +629,10 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, w return false; } #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T -BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, unsigned short c) +BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type idx, boost::uint32_t m, unsigned short c) { WORD mask; - if(::GetStringTypeExW(id, CT_CTYPE1, (wchar_t const*)&c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) + if(::GetStringTypeExW(idx, CT_CTYPE1, (wchar_t const*)&c, 1, &mask) && (mask & m & w32_regex_traits_implementation::mask_base)) return true; if((m & w32_regex_traits_implementation::mask_word) && (c == '_')) return true; diff --git a/src/wc_regex_traits.cpp b/src/wc_regex_traits.cpp index fb622b5a..a9e96d9e 100644 --- a/src/wc_regex_traits.cpp +++ b/src/wc_regex_traits.cpp @@ -195,16 +195,16 @@ c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits(sizeof(masks) / sizeof(masks[0]))); - return masks[id+1]; + BOOST_ASSERT(idx+1 < static_cast(sizeof(masks) / sizeof(masks[0]))); + return masks[idx+1]; } bool BOOST_REGEX_CALL c_regex_traits::isctype(wchar_t c, char_class_type mask)