Added explicit bounds to arrays, as patch for broken compilers that can't otherwise cope.

[SVN r18743]
This commit is contained in:
John Maddock
2003-06-09 11:56:15 +00:00
parent eb91bf612a
commit 6dfa7ef86c
6 changed files with 30 additions and 27 deletions

View File

@ -248,6 +248,25 @@ public:
struct saved_state; struct saved_state;
enum saved_state_type
{
saved_type_end = 0,
saved_type_paren = 1,
saved_type_recurse = 2,
saved_type_assertion = 3,
saved_state_alt = 4,
saved_state_repeater_count = 5,
saved_state_extra_block = 6,
saved_state_greedy_single_repeat = 7,
saved_state_rep_slow_dot = 8,
saved_state_rep_fast_dot = 9,
saved_state_rep_char = 10,
saved_state_rep_short_set = 11,
saved_state_rep_long_set = 12,
saved_state_non_greedy_long_repeat = 13,
saved_state_count = 14
};
template <class BidiIterator, class Allocator, class traits, class Allocator2> template <class BidiIterator, class Allocator, class traits, class Allocator2>
class perl_matcher class perl_matcher
{ {
@ -358,9 +377,9 @@ private:
repeater_count<BidiIterator> rep_obj; repeater_count<BidiIterator> rep_obj;
// table of functions to match states: // table of functions to match states:
static const matcher_proc_type s_match_vtable[]; static const matcher_proc_type s_match_vtable[re_detail::syntax_element_count];
// table of functions to search for matching attempt start: // table of functions to search for matching attempt start:
static const matcher_proc_type s_find_vtable[]; static const matcher_proc_type s_find_vtable[regbase::restart_count];
#ifdef BOOST_REGEX_NON_RECURSIVE #ifdef BOOST_REGEX_NON_RECURSIVE
@ -405,7 +424,7 @@ private:
// how many memory blocks have we used up?: // how many memory blocks have we used up?:
unsigned used_block_count; unsigned used_block_count;
// table of pointers to unwind proceedures: // table of pointers to unwind proceedures:
static const unwind_proc_type s_unwind_table[]; static const unwind_proc_type s_unwind_table[re_detail::saved_state_count];
#endif #endif
// these operations aren't allowed, so are declared private: // these operations aren't allowed, so are declared private:

View File

@ -768,7 +768,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit
template <class BidiIterator, class Allocator, class traits, class Allocator2> template <class BidiIterator, class Allocator, class traits, class Allocator2>
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_match_vtable[] = perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_match_vtable[re_detail::syntax_element_count] =
{ {
(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark), (&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark, &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
@ -811,7 +811,7 @@ perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_match_vtable[] =
template <class BidiIterator, class Allocator, class traits, class Allocator2> template <class BidiIterator, class Allocator, class traits, class Allocator2>
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::matcher_proc_type const
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_find_vtable[] = perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_find_vtable[regbase::restart_count] =
{ {
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any, &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word, &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word,

View File

@ -40,24 +40,6 @@ inline void inplace_destroy(T* p)
p->~T(); p->~T();
} }
enum saved_state_type
{
saved_type_end = 0,
saved_type_paren = 1,
saved_type_recurse = 2,
saved_type_assertion = 3,
saved_state_alt = 4,
saved_state_repeater_count = 5,
saved_state_extra_block = 6,
saved_state_greedy_single_repeat = 7,
saved_state_rep_slow_dot = 8,
saved_state_rep_fast_dot = 9,
saved_state_rep_char = 10,
saved_state_rep_short_set = 11,
saved_state_rep_long_set = 12,
saved_state_non_greedy_long_repeat = 13
};
struct saved_state struct saved_state
{ {
unsigned int id; unsigned int id;
@ -1202,7 +1184,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greed
template <class BidiIterator, class Allocator, class traits, class Allocator2> template <class BidiIterator, class Allocator, class traits, class Allocator2>
typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_proc_type const typename perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_proc_type const
perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_unwind_table[] = perl_matcher<BidiIterator, Allocator, traits, Allocator2>::s_unwind_table[re_detail::saved_state_count] =
{ {
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end, &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end,
&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren, &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren,

View File

@ -81,7 +81,8 @@ public:
restart_buf = 3, restart_buf = 3,
restart_continue = 4, restart_continue = 4,
restart_lit = 5, restart_lit = 5,
restart_fixed_lit = 6 restart_fixed_lit = 6,
restart_count = 7
}; };
flag_type BOOST_REGEX_CALL flags()const flag_type BOOST_REGEX_CALL flags()const

View File

@ -36,7 +36,7 @@ namespace re_detail{
template <class charT> template <class charT>
const reg_expression<charT>& get_default_expression(charT) const reg_expression<charT>& get_default_expression(charT)
{ {
static const charT expression_text[] = { '\\', 's', '+', '\00', }; static const charT expression_text[4] = { '\\', 's', '+', '\00', };
static const reg_expression<charT> e(expression_text); static const reg_expression<charT> e(expression_text);
return e; return e;
} }

View File

@ -109,7 +109,8 @@ enum syntax_element_type
syntax_element_dot_rep = syntax_element_restart_continue + 1, syntax_element_dot_rep = syntax_element_restart_continue + 1,
syntax_element_char_rep = syntax_element_dot_rep + 1, syntax_element_char_rep = syntax_element_dot_rep + 1,
syntax_element_short_set_rep = syntax_element_char_rep + 1, syntax_element_short_set_rep = syntax_element_char_rep + 1,
syntax_element_long_set_rep = syntax_element_short_set_rep + 1 syntax_element_long_set_rep = syntax_element_short_set_rep + 1,
syntax_element_count = syntax_element_long_set_rep +1
}; };
#ifdef BOOST_REGEX_DEBUG #ifdef BOOST_REGEX_DEBUG