Changed assert's to BOOST_ASSERT's.

Made array sizes explicit to fix MWCW problems.


[SVN r26723]
This commit is contained in:
John Maddock
2005-01-18 12:52:40 +00:00
parent 9781fe3150
commit 2a248d1f87
12 changed files with 67 additions and 66 deletions

View File

@ -97,7 +97,7 @@ struct save_state_init
*end = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(*base)+BOOST_REGEX_BLOCKSIZE);
--(*end);
(void) new (*end)saved_state(0);
assert(*end > *base);
BOOST_ASSERT(*end > *base);
}
~save_state_init()
{
@ -195,7 +195,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
template <class BidiIterator, class Allocator, class traits>
inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
{
assert(index);
BOOST_ASSERT(index);
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
--pmp;
if(pmp < m_stack_base)
@ -388,7 +388,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
}
default:
{
assert(index > 0);
BOOST_ASSERT(index > 0);
if((m_match_flags & match_nosubs) == 0)
{
push_matched_paren(index, (*m_presult)[index]);
@ -634,7 +634,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
#pragma option push -w-8008 -w-8066 -w-8004
#endif
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
assert(1 == static_cast<const re_literal*>(rep->next.p)->length);
BOOST_ASSERT(1 == static_cast<const re_literal*>(rep->next.p)->length);
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(rep->next.p) + 1);
std::size_t count = 0;
//
@ -982,15 +982,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_greedy_single_repeat(
const re_repeat* rep = pmp->rep;
std::size_t count = pmp->count;
assert(rep->next.p != 0);
assert(rep->alt.p != 0);
BOOST_ASSERT(rep->next.p != 0);
BOOST_ASSERT(rep->alt.p != 0);
count -= rep->min;
if((m_match_flags & match_partial) && (position == last))
m_has_partial_match = true;
assert(count);
BOOST_ASSERT(count);
position = pmp->last_position;
// backtrack till we can skip out:
@ -1031,12 +1031,12 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat(bool
const re_repeat* rep = pmp->rep;
std::size_t count = pmp->count;
assert(rep->type == syntax_element_dot_rep);
assert(rep->next.p != 0);
assert(rep->alt.p != 0);
assert(rep->next.p->type == syntax_element_wild);
BOOST_ASSERT(rep->type == syntax_element_dot_rep);
BOOST_ASSERT(rep->next.p != 0);
BOOST_ASSERT(rep->alt.p != 0);
BOOST_ASSERT(rep->next.p->type == syntax_element_wild);
assert(count < rep->max);
BOOST_ASSERT(count < rep->max);
pstate = rep->next.p;
position = pmp->last_position;
@ -1094,7 +1094,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
const re_repeat* rep = pmp->rep;
std::size_t count = pmp->count;
assert(count < rep->max);
BOOST_ASSERT(count < rep->max);
position = pmp->last_position;
if(position != last)
{
@ -1149,11 +1149,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r)
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1);
position = pmp->last_position;
assert(rep->type == syntax_element_char_rep);
assert(rep->next.p != 0);
assert(rep->alt.p != 0);
assert(rep->next.p->type == syntax_element_literal);
assert(count < rep->max);
BOOST_ASSERT(rep->type == syntax_element_char_rep);
BOOST_ASSERT(rep->next.p != 0);
BOOST_ASSERT(rep->alt.p != 0);
BOOST_ASSERT(rep->next.p->type == syntax_element_literal);
BOOST_ASSERT(count < rep->max);
if(position != last)
{
@ -1213,11 +1213,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool
const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map;
position = pmp->last_position;
assert(rep->type == syntax_element_short_set_rep);
assert(rep->next.p != 0);
assert(rep->alt.p != 0);
assert(rep->next.p->type == syntax_element_set);
assert(count < rep->max);
BOOST_ASSERT(rep->type == syntax_element_short_set_rep);
BOOST_ASSERT(rep->next.p != 0);
BOOST_ASSERT(rep->alt.p != 0);
BOOST_ASSERT(rep->next.p->type == syntax_element_set);
BOOST_ASSERT(count < rep->max);
if(position != last)
{
@ -1278,11 +1278,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool
const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate);
position = pmp->last_position;
assert(rep->type == syntax_element_long_set_rep);
assert(rep->next.p != 0);
assert(rep->alt.p != 0);
assert(rep->next.p->type == syntax_element_long_set);
assert(count < rep->max);
BOOST_ASSERT(rep->type == syntax_element_long_set_rep);
BOOST_ASSERT(rep->next.p != 0);
BOOST_ASSERT(rep->alt.p != 0);
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
BOOST_ASSERT(count < rep->max);
if(position != last)
{