From 27875c1e55aadd593ecda5d32d91dbace9d8eed4 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 19 Nov 2003 12:57:50 +0000 Subject: [PATCH] Fix gcc -Wshadow warnings [SVN r20857] --- include/boost/regex/v4/basic_regex.hpp | 20 +- include/boost/regex/v4/fileiter.hpp | 6 +- .../regex/v4/perl_matcher_non_recursive.hpp | 4 +- include/boost/regex/v4/regex_compile.hpp | 266 +++++++++--------- src/c_regex_traits.cpp | 6 +- src/cpp_regex_traits.cpp | 5 +- test/regress/tests.cpp | 16 +- 7 files changed, 161 insertions(+), 162 deletions(-) diff --git a/include/boost/regex/v4/basic_regex.hpp b/include/boost/regex/v4/basic_regex.hpp index e0feacfd..1b5a2de8 100644 --- a/include/boost/regex/v4/basic_regex.hpp +++ b/include/boost/regex/v4/basic_regex.hpp @@ -96,11 +96,11 @@ public: return *this; } - reg_expression& assign(const charT* first, - const charT* last, + reg_expression& assign(const charT* arg_first, + const charT* arg_last, flag_type f = regex_constants::normal) { - set_expression(first, last, f | regex_constants::use_except); + set_expression(arg_first, arg_last, f | regex_constants::use_except); return *this; } #if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) @@ -114,10 +114,10 @@ public: : data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0) { set_expression(p, f | regex_constants::use_except); } template - reg_expression(InputIterator first, InputIterator last, flag_type f = regex_constants::normal, const Allocator& al = Allocator()) + reg_expression(InputIterator arg_first, InputIterator arg_last, flag_type f = regex_constants::normal, const Allocator& al = Allocator()) : data(al), pkmp(0), error_code_(REG_EMPTY), _expression(0) { - std::basic_string a(first, last); + std::basic_string a(arg_first, arg_last); set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except); } @@ -138,11 +138,11 @@ public: } template - reg_expression& BOOST_REGEX_CALL assign(InputIterator first, - InputIterator last, + reg_expression& BOOST_REGEX_CALL assign(InputIterator arg_first, + InputIterator arg_last, flag_type f = regex_constants::normal) { - std::basic_string a(first, last); + std::basic_string a(arg_first, arg_last); set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except); return *this; } @@ -361,8 +361,8 @@ public: : reg_expression(p,f,a){} template - basic_regex(I first, I last, flag_type f = regex_constants::normal, const Allocator& al = Allocator()) - : reg_expression(first, last, f, al){} + basic_regex(I arg_first, I arg_last, flag_type f = regex_constants::normal, const Allocator& al = Allocator()) + : reg_expression(arg_first, arg_last, f, al){} template basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string& p) diff --git a/include/boost/regex/v4/fileiter.hpp b/include/boost/regex/v4/fileiter.hpp index 3003da8d..341ce53b 100644 --- a/include/boost/regex/v4/fileiter.hpp +++ b/include/boost/regex/v4/fileiter.hpp @@ -215,11 +215,11 @@ public: typedef std::random_access_iterator_tag iterator_category; mapfile_iterator() { node = 0; file = 0; offset = 0; } - mapfile_iterator(const mapfile* f, long position) + mapfile_iterator(const mapfile* f, long arg_position) { file = f; - node = f->_first + position / mapfile::buf_size; - offset = position % mapfile::buf_size; + node = f->_first + arg_position / mapfile::buf_size; + offset = arg_position % mapfile::buf_size; if(file) file->lock(node); } diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index 29e1f647..c07e4e25 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -106,8 +106,8 @@ struct saved_single_repeat : public saved_state unsigned count; const re_repeat* rep; BidiIterator last_position; - saved_single_repeat(unsigned c, const re_repeat* r, BidiIterator lp, int id) - : saved_state(id), count(c), rep(r), last_position(lp){} + saved_single_repeat(unsigned c, const re_repeat* r, BidiIterator lp, int arg_id) + : saved_state(arg_id), count(c), rep(r), last_position(lp){} }; template diff --git a/include/boost/regex/v4/regex_compile.hpp b/include/boost/regex/v4/regex_compile.hpp index af9411a2..74b1784b 100644 --- a/include/boost/regex/v4/regex_compile.hpp +++ b/include/boost/regex/v4/regex_compile.hpp @@ -205,25 +205,25 @@ Allocator BOOST_REGEX_CALL reg_expression::get_allocat } template -unsigned int BOOST_REGEX_CALL reg_expression::parse_inner_set(const charT*& first, const charT* last) +unsigned int BOOST_REGEX_CALL reg_expression::parse_inner_set(const charT*& arg_first, const charT* arg_last) { // // we have an inner [...] construct // - jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_open_set); - const charT* base = first; - while( (first != last) - && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) != traits_type::syntax_close_set) ) - ++first; - if(first == last) + jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_open_set); + const charT* base = arg_first; + while( (arg_first != arg_last) + && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) != traits_type::syntax_close_set) ) + ++arg_first; + if(arg_first == arg_last) return 0; - ++first; - if((first-base) < 5) + ++arg_first; + if((arg_first-base) < 5) return 0; - if(*(base+1) != *(first-2)) + if(*(base+1) != *(arg_first-2)) return 0; unsigned int result = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1)); - if((result == traits_type::syntax_colon) && ((first-base) == 5)) + if((result == traits_type::syntax_colon) && ((arg_first-base) == 5)) { unsigned type = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2)); if((type == traits_type::syntax_left_word) || (type == traits_type::syntax_right_word)) @@ -234,20 +234,20 @@ unsigned int BOOST_REGEX_CALL reg_expression::parse_in template -bool BOOST_REGEX_CALL reg_expression::skip_space(const charT*& first, const charT* last) +bool BOOST_REGEX_CALL reg_expression::skip_space(const charT*& arg_first, const charT* arg_last) { // - // returns true if we get to last: + // returns true if we get to arg_last: // - while((first != last) && (traits_inst.is_class(*first, traits_type::char_class_space) == true)) + while((arg_first != arg_last) && (traits_inst.is_class(*arg_first, traits_type::char_class_space) == true)) { - ++first; + ++arg_first; } - return first == last; + return arg_first == arg_last; } template -void BOOST_REGEX_CALL reg_expression::parse_range(const charT*& ptr, const charT* end, unsigned& min, unsigned& max) +void BOOST_REGEX_CALL reg_expression::parse_range(const charT*& ptr, const charT* arg_end, unsigned& min, unsigned& max) { // // we have {x} or {x,} or {x,y} NB no spaces inside braces @@ -255,7 +255,7 @@ void BOOST_REGEX_CALL reg_expression::parse_range(cons // On input ptr points to "{" // ++ptr; - if(skip_space(ptr, end)) + if(skip_space(ptr, arg_end)) { fail(REG_EBRACE); return; @@ -265,8 +265,8 @@ void BOOST_REGEX_CALL reg_expression::parse_range(cons fail(REG_BADBR); return; } - min = traits_inst.toi(ptr, end, 10); - if(skip_space(ptr, end)) + min = traits_inst.toi(ptr, arg_end, 10); + if(skip_space(ptr, arg_end)) { fail(REG_EBRACE); return; @@ -275,13 +275,13 @@ void BOOST_REGEX_CALL reg_expression::parse_range(cons { //we have a second interval: ++ptr; - if(skip_space(ptr, end)) + if(skip_space(ptr, arg_end)) { fail(REG_EBRACE); return; } if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_digit) - max = traits_inst.toi(ptr, end, 10); + max = traits_inst.toi(ptr, arg_end, 10); else max = (unsigned)-1; } @@ -289,7 +289,7 @@ void BOOST_REGEX_CALL reg_expression::parse_range(cons max = min; // validate input: - if(skip_space(ptr, end)) + if(skip_space(ptr, arg_end)) { fail(REG_EBRACE); return; @@ -310,7 +310,7 @@ void BOOST_REGEX_CALL reg_expression::parse_range(cons { // back\ is OK now check the } ++ptr; - if((ptr == end) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace)) + if((ptr == arg_end) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace)) { fail(REG_BADBR); return; @@ -325,10 +325,10 @@ void BOOST_REGEX_CALL reg_expression::parse_range(cons } template -charT BOOST_REGEX_CALL reg_expression::parse_escape(const charT*& first, const charT* last) +charT BOOST_REGEX_CALL reg_expression::parse_escape(const charT*& arg_first, const charT* arg_last) { - charT c(*first); - traits_size_type c_unsigned = (traits_size_type)(traits_uchar_type)*first; + charT c(*arg_first); + traits_size_type c_unsigned = (traits_size_type)(traits_uchar_type)*arg_first; // this is only used for the switch(), but cannot be folded in // due to a bug in Comeau 4.2.44beta3 traits_size_type syntax = traits_inst.syntax_type(c_unsigned); @@ -336,93 +336,93 @@ charT BOOST_REGEX_CALL reg_expression::parse_escape(co { case traits_type::syntax_a: c = '\a'; - ++first; + ++arg_first; break; case traits_type::syntax_f: c = '\f'; - ++first; + ++arg_first; break; case traits_type::syntax_n: c = '\n'; - ++first; + ++arg_first; break; case traits_type::syntax_r: c = '\r'; - ++first; + ++arg_first; break; case traits_type::syntax_t: c = '\t'; - ++first; + ++arg_first; break; case traits_type::syntax_v: c = '\v'; - ++first; + ++arg_first; break; case traits_type::syntax_x: - ++first; - if(first == last) + ++arg_first; + if(arg_first == arg_last) { fail(REG_EESCAPE); break; } // maybe have \x{ddd} - if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*first)) == traits_type::syntax_open_brace) + if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*arg_first)) == traits_type::syntax_open_brace) { - ++first; - if(first == last) + ++arg_first; + if(arg_first == arg_last) { fail(REG_EESCAPE); break; } - if(traits_inst.is_class(*first, traits_type::char_class_xdigit) == false) + if(traits_inst.is_class(*arg_first, traits_type::char_class_xdigit) == false) { fail(REG_BADBR); break; } - c = (charT)traits_inst.toi(first, last, -16); - if((first == last) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*first)) != traits_type::syntax_close_brace)) + c = (charT)traits_inst.toi(arg_first, arg_last, -16); + if((arg_first == arg_last) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*arg_first)) != traits_type::syntax_close_brace)) { fail(REG_BADBR); } - ++first; + ++arg_first; break; } else { - if(traits_inst.is_class(*first, traits_type::char_class_xdigit) == false) + if(traits_inst.is_class(*arg_first, traits_type::char_class_xdigit) == false) { fail(REG_BADBR); break; } - c = (charT)traits_inst.toi(first, last, -16); + c = (charT)traits_inst.toi(arg_first, arg_last, -16); } break; case traits_type::syntax_c: - ++first; - if(first == last) + ++arg_first; + if(arg_first == arg_last) { fail(REG_EESCAPE); break; } - if(((traits_uchar_type)(*first) < (traits_uchar_type)'@') - || ((traits_uchar_type)(*first) > (traits_uchar_type)127) ) + if(((traits_uchar_type)(*arg_first) < (traits_uchar_type)'@') + || ((traits_uchar_type)(*arg_first) > (traits_uchar_type)127) ) { fail(REG_EESCAPE); return (charT)0; } - c = (charT)((traits_uchar_type)(*first) - (traits_uchar_type)'@'); - ++first; + c = (charT)((traits_uchar_type)(*arg_first) - (traits_uchar_type)'@'); + ++arg_first; break; case traits_type::syntax_e: c = (charT)27; - ++first; + ++arg_first; break; case traits_type::syntax_digit: - c = (charT)traits_inst.toi(first, last, -8); + c = (charT)traits_inst.toi(arg_first, arg_last, -8); break; default: - //c = *first; - ++first; + //c = *arg_first; + ++arg_first; } return c; } @@ -678,13 +678,13 @@ void BOOST_REGEX_CALL reg_expression::compile_map( } template -void BOOST_REGEX_CALL reg_expression::move_offsets(re_detail::re_syntax_base* j, unsigned size) +void BOOST_REGEX_CALL reg_expression::move_offsets(re_detail::re_syntax_base* j, unsigned arg_size) { # ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4127) #endif - // move all offsets starting with j->link forward by size + // move all offsets starting with j->link forward by arg_size // called after an insert: j = reinterpret_cast(reinterpret_cast(data.data()) + j->next.i); while(true) @@ -692,19 +692,19 @@ void BOOST_REGEX_CALL reg_expression::move_offsets(re_ switch(j->type) { case re_detail::syntax_element_rep: - static_cast(j)->alt.i += size; - j->next.i += size; + static_cast(j)->alt.i += arg_size; + j->next.i += arg_size; break; case re_detail::syntax_element_jump: case re_detail::syntax_element_alt: - static_cast(j)->alt.i += size; - j->next.i += size; + static_cast(j)->alt.i += arg_size; + j->next.i += arg_size; break; default: - j->next.i += size; + j->next.i += arg_size; break; } - if(j->next.i == size) + if(j->next.i == arg_size) break; j = reinterpret_cast(reinterpret_cast(data.data()) + j->next.i); } @@ -731,15 +731,15 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression -re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression::compile_set(const charT*& first, const charT* last) +re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression::compile_set(const charT*& arg_first, const charT* arg_last) { re_detail::jstack singles(64, data.allocator()); re_detail::jstack ranges(64, data.allocator()); re_detail::jstack classes(64, data.allocator()); re_detail::jstack equivalents(64, data.allocator()); bool has_digraphs = false; - jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*first) == traits_type::syntax_open_set); - ++first; + jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_open_set); + ++arg_first; bool started = false; bool done = false; bool isnot = false; @@ -754,9 +754,9 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression 1) has_digraphs = true; if(s.size())goto char_set_literal; @@ -829,7 +829,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression_map[(traits_uchar_type)traits_inst.translate((charT)i, (_flags & regex_constants::icase))] = re_detail::mask_all; } } @@ -1326,7 +1326,7 @@ void BOOST_REGEX_CALL reg_expression::fixup_apply(re_d template -unsigned int BOOST_REGEX_CALL reg_expression::set_expression(const charT* p, const charT* end, flag_type f) +unsigned int BOOST_REGEX_CALL reg_expression::set_expression(const charT* arg_first, const charT* arg_last, flag_type f) { # ifdef BOOST_MSVC # pragma warning(push) @@ -1337,27 +1337,27 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr f &= ~regex_constants::collate; #endif - if(p == expression()) + if(arg_first == expression()) { - traits_string_type s(p, end); + traits_string_type s(arg_first, arg_last); return set_expression(s.c_str(), s.c_str() + s.size(), f); } typedef typename traits_type::sentry sentry_t; sentry_t sent(traits_inst); if(sent){ - const charT* base = p; + const charT* base = arg_first; data.clear(); _flags = f; fail(REG_NOERROR); // clear any error - if(p >= end) + if(arg_first >= arg_last) { fail(REG_EMPTY); return error_code(); } - const charT* ptr = p; + const charT* ptr = arg_first; marks = 0; re_detail::jstack mark(64, data.allocator()); re_detail::jstack markid(64, data.allocator()); @@ -1376,14 +1376,14 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr if(_flags & regex_constants::literal) { - while(ptr != end) + while(ptr != arg_last) { dat = add_literal(dat, traits_inst.translate(*ptr, (_flags & regex_constants::icase))); ++ptr; } } - while (ptr < end) + while (ptr < arg_last) { c = (traits_size_type)(traits_uchar_type)*ptr; // this is only used for the switch(), but cannot be folded in @@ -1422,8 +1422,8 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr c = (traits_size_type)(traits_uchar_type)*ptr; // this is only used for the switch(), but cannot be folded in // due to a bug in Comeau 4.2.44beta3 - traits_size_type syntax = traits_inst.syntax_type(c); - switch(syntax) + traits_size_type syntax2 = traits_inst.syntax_type(c); + switch(syntax2) { case traits_type::syntax_colon: static_cast(dat)->index = 0; @@ -1510,7 +1510,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr } } - // pop any pushed alternatives and set the target end destination: + // pop any pushed alternatives and set the target arg_last destination: dat = reinterpret_cast(reinterpret_cast(data.data()) + mark.peek()); while(dat->type == re_detail::syntax_element_jump) { @@ -1537,7 +1537,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr break; case traits_type::syntax_slash: { - if(++ptr == end) + if(++ptr == arg_last) { fail(REG_EESCAPE); return error_code(); @@ -1545,8 +1545,8 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr c = (traits_size_type)(traits_uchar_type)*ptr; // this is only used for the switch(), but cannot be folded in // due to a bug in Comeau 4.2.44beta3 - traits_size_type syntax = traits_inst.syntax_type(c); - switch(syntax) + traits_size_type syntax3 = traits_inst.syntax_type(c); + switch(syntax3) { case traits_type::syntax_open_bracket: if(_flags & bk_parens) @@ -1581,7 +1581,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr break; // we have {x} or {x,} or {x,y}: - parse_range(ptr, end, rep_min, rep_max); + parse_range(ptr, arg_last, rep_min, rep_max); goto repeat_jump; case traits_type::syntax_digit: @@ -1593,7 +1593,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr { // we can have \025 which means take char whose // code is 25 (octal), so parse string: - c = traits_inst.toi(ptr, end, -8); + c = traits_inst.toi(ptr, arg_last, -8); --ptr; break; } @@ -1663,7 +1663,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr ++ptr; while(true) { - if(ptr == end) + if(ptr == arg_last) { fail(REG_EESCAPE); return error_code(); @@ -1671,7 +1671,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_slash) { ++ptr; - if((ptr != end) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_E)) + if((ptr != arg_last) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_E)) break; else { @@ -1709,7 +1709,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr ++ptr; continue; default: - c = (traits_size_type)(traits_uchar_type)parse_escape(ptr, end); + c = (traits_size_type)(traits_uchar_type)parse_escape(ptr, arg_last); dat = add_literal(dat, (charT)c); continue; } @@ -1791,7 +1791,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr ++ptr; // // now check to see if we have a non-greedy repeat: - if((ptr != end) && (_flags & (perlex | limited_ops | bk_plus_qm | bk_braces)) == perlex) + if((ptr != arg_last) && (_flags & (perlex | limited_ops | bk_plus_qm | bk_braces)) == perlex) { c = (traits_size_type)(traits_uchar_type)*ptr; if(traits_type::syntax_question == traits_inst.syntax_type(c)) @@ -1833,7 +1833,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr dat->next.i = data.size(); } // extend: - dat = compile_set(ptr, end); + dat = compile_set(ptr, arg_last); if(dat == 0) { if((_flags & regex_constants::failbit) == 0) @@ -1881,8 +1881,8 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr { // we have a '(' or '|' to go back to: offset = mark.peek(); - re_detail::re_syntax_base* base = reinterpret_cast(reinterpret_cast(data.data()) + offset); - offset = base->next.i; + re_detail::re_syntax_base* base2 = reinterpret_cast(reinterpret_cast(data.data()) + offset); + offset = base2->next.i; } re_detail::re_jump* j = static_cast(data.insert(offset, re_detail::re_jump_size)); j->type = re_detail::syntax_element_alt; @@ -1902,7 +1902,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr continue; } // we have {x} or {x,} or {x,y}: - parse_range(ptr, end, rep_min, rep_max); + parse_range(ptr, arg_last, rep_min, rep_max); goto repeat_jump; case traits_type::syntax_newline: if(_flags & newline_alt) @@ -1950,7 +1950,7 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr // if(mark.empty() == false) { - // pop any pushed alternatives and set the target end destination: + // pop any pushed alternatives and set the target arg_last destination: dat = reinterpret_cast(reinterpret_cast(data.data()) + mark.peek()); while(dat->type == re_detail::syntax_element_jump) { @@ -1974,11 +1974,11 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr // // allocate space for start _map: - startmap = reinterpret_cast(data.extend(256 + ((end - base + 1) * sizeof(charT)))); + startmap = reinterpret_cast(data.extend(256 + ((arg_last - base + 1) * sizeof(charT)))); // // and copy the expression we just compiled: _expression = reinterpret_cast(reinterpret_cast(startmap) + 256); - _expression_len = end - base; + _expression_len = arg_last - base; std::memcpy(_expression, base, _expression_len * sizeof(charT)); *(_expression + _expression_len) = charT(0); @@ -2025,16 +2025,16 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr } template -re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression::add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size) +re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression::add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int arg_size) { if(dat) { data.align(); dat->next.i = data.size(); } - if(size < sizeof(re_detail::re_syntax_base)) - size = sizeof(re_detail::re_syntax_base); - dat = static_cast(data.extend(size)); + if(arg_size < sizeof(re_detail::re_syntax_base)) + arg_size = sizeof(re_detail::re_syntax_base); + dat = static_cast(data.extend(arg_size)); dat->type = type; dat->next.i = 0; return dat; @@ -2085,11 +2085,11 @@ unsigned int BOOST_REGEX_CALL reg_expression::probe_re } template -unsigned int BOOST_REGEX_CALL reg_expression::fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end) +unsigned int BOOST_REGEX_CALL reg_expression::fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* arg_end) { unsigned int len = 0; - bool leading_lit = end ? false : true; - while(dat != end) + bool leading_lit = arg_end ? false : true; + while(dat != arg_end) { switch(dat->type) { diff --git a/src/c_regex_traits.cpp b/src/c_regex_traits.cpp index 6557f750..1cddfb40 100644 --- a/src/c_regex_traits.cpp +++ b/src/c_regex_traits.cpp @@ -717,11 +717,11 @@ void BOOST_REGEX_CALL c_regex_traits::transform_primary(std::string& out, out.erase((int)sort_delim); break; case re_detail::sort_delim: - for(unsigned int i = 0; i < out.size(); ++i) + for(unsigned int j = 0; j < out.size(); ++j) { - if((out[i] == sort_delim) && (i+1 < out.size())) + if((out[j] == sort_delim) && (j+1 < out.size())) { - out.erase(i+1); + out.erase(j+1); break; } } diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp index 3aaca1cf..edda2cab 100644 --- a/src/cpp_regex_traits.cpp +++ b/src/cpp_regex_traits.cpp @@ -115,7 +115,6 @@ 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)); std::ptrdiff_t size = this->egptr() - this->eback(); @@ -612,8 +611,8 @@ message_data::message_data(const std::locale& l, const std::string& reg cat = msgs.open(regex_message_catalogue, l); if(cat < 0) { - std::string m("Unable to open message catalog: "); - std::runtime_error err(m + regex_message_catalogue); + std::string mess("Unable to open message catalog: "); + std::runtime_error err(mess + regex_message_catalogue); boost::throw_exception(err); } } diff --git a/test/regress/tests.cpp b/test/regress/tests.cpp index 51be74b9..2a7af9b3 100644 --- a/test/regress/tests.cpp +++ b/test/regress/tests.cpp @@ -419,9 +419,9 @@ void cpp_tests(const basic_regex& e, bool recurse = true) #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) if(!recurse) { - std::basic_string s(search_text.begin(), search_text.end()); + std::basic_string s2(search_text.begin(), search_text.end()); match_results::const_iterator> sm; - if(regex_search(s, sm, e, static_cast(flags[3]))) + if(regex_search(s2, sm, e, static_cast(flags[3]))) { if(compare_result(sm, m) == false) { @@ -434,8 +434,8 @@ void cpp_tests(const basic_regex& e, bool recurse = true) begin_error(); cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const basic_regex&, int)" << endl; } - if(!regex_search(s, e, static_cast(flags[3])) - || !regex_search(s.begin(), s.end(), e, static_cast(flags[3]))) + if(!regex_search(s2, e, static_cast(flags[3])) + || !regex_search(s2.begin(), s2.end(), e, static_cast(flags[3]))) { begin_error(); cout << "regex++ API result mismatch in regex_search(const std::string&, const basic_regex&, int)" << endl; @@ -460,7 +460,7 @@ void cpp_tests(const basic_regex& e, bool recurse = true) cout << "regex++ API result: match not found when match_partial specified" << endl; } } - if(s.find(char_t(0)) == std::basic_string::npos) + if(s2.find(char_t(0)) == std::basic_string::npos) { match_results ssm; if(regex_search(search_text.c_str(), ssm, e, static_cast(flags[3]))) @@ -505,9 +505,9 @@ void cpp_tests(const basic_regex& e, bool recurse = true) begin_error(); cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const basic_regex&, int)" << endl; } - std::basic_string s(search_text.begin(), search_text.end()); + std::basic_string s3(search_text.begin(), search_text.end()); match_results::const_iterator> sm; - if(regex_match(s, sm, e, static_cast(flags[3]))) + if(regex_match(s3, sm, e, static_cast(flags[3]))) { if(compare_result(sm, m) == false) { @@ -520,7 +520,7 @@ void cpp_tests(const basic_regex& e, bool recurse = true) begin_error(); cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const basic_regex&, int)" << endl; } - if(s.find(char_t(0)) == std::basic_string::npos) + if(s3.find(char_t(0)) == std::basic_string::npos) { match_results ssm; if(regex_match(search_text.c_str(), ssm, e, static_cast(flags[3])))