mirror of
https://github.com/boostorg/regex.git
synced 2025-07-18 06:42:08 +02:00
Fix -analyse errors from VC8.
Merge a couple of changes from the release branch. [SVN r31987]
This commit is contained in:
@ -572,9 +572,10 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
|||||||
// Oops error:
|
// Oops error:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
BOOST_ASSERT(c3[1] == 0);
|
||||||
for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
|
for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
|
||||||
{
|
{
|
||||||
charT c3[2] = { static_cast<charT>(i), charT(0), };
|
c3[0] = static_cast<charT>(i);
|
||||||
string_type s3 = this->m_traits.transform(c3, c3 +1);
|
string_type s3 = this->m_traits.transform(c3, c3 +1);
|
||||||
if((s1 <= s3) && (s3 <= s2))
|
if((s1 <= s3) && (s3 <= s2))
|
||||||
result->_map[i] = true;
|
result->_map[i] = true;
|
||||||
@ -796,6 +797,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
|
|||||||
v.pop_back();
|
v.pop_back();
|
||||||
|
|
||||||
// Build maps:
|
// Build maps:
|
||||||
|
m_bad_repeats = 0;
|
||||||
create_startmap(state->next.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_take);
|
create_startmap(state->next.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_take);
|
||||||
m_bad_repeats = 0;
|
m_bad_repeats = 0;
|
||||||
create_startmap(static_cast<re_alt*>(state)->alt.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_skip);
|
create_startmap(static_cast<re_alt*>(state)->alt.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_skip);
|
||||||
@ -1181,7 +1183,8 @@ bool basic_regex_creator<charT, traits>::is_bad_repeat(re_syntax_base* pt)
|
|||||||
unsigned id = static_cast<re_repeat*>(pt)->id;
|
unsigned id = static_cast<re_repeat*>(pt)->id;
|
||||||
if(id > sizeof(m_bad_repeats) * CHAR_BIT)
|
if(id > sizeof(m_bad_repeats) * CHAR_BIT)
|
||||||
return true; // run out of bits, assume we can't traverse this one.
|
return true; // run out of bits, assume we can't traverse this one.
|
||||||
return m_bad_repeats & static_cast<boost::uintmax_t>(1uL << id);
|
static const boost::uintmax_t one = 1uL;
|
||||||
|
return m_bad_repeats & (one << id);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -1200,8 +1203,9 @@ void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt)
|
|||||||
case syntax_element_long_set_rep:
|
case syntax_element_long_set_rep:
|
||||||
{
|
{
|
||||||
unsigned id = static_cast<re_repeat*>(pt)->id;
|
unsigned id = static_cast<re_repeat*>(pt)->id;
|
||||||
|
static const boost::uintmax_t one = 1uL;
|
||||||
if(id <= sizeof(m_bad_repeats) * CHAR_BIT)
|
if(id <= sizeof(m_bad_repeats) * CHAR_BIT)
|
||||||
m_bad_repeats |= static_cast<boost::uintmax_t>(1uL << id);
|
m_bad_repeats |= (one << id);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -614,7 +614,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, (std::min)((unsigned)::boost::re_detail::distance(position, last), desired));
|
std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
|
while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
|
||||||
{
|
{
|
||||||
@ -704,7 +704,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, (std::min)((unsigned)::boost::re_detail::distance(position, last), desired));
|
std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
|
while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,11 @@ struct character_pointer_range
|
|||||||
}
|
}
|
||||||
bool operator == (const character_pointer_range& r)const
|
bool operator == (const character_pointer_range& r)const
|
||||||
{
|
{
|
||||||
return ((p2 - p1) == (r.p2 - r.p1)) && std::equal(p1, p2, r.p1);
|
// Not only do we check that the ranges are of equal size before
|
||||||
|
// calling std::equal, but there is no other algorithm available:
|
||||||
|
// not even a non-standard MS one. So forward to unchecked_equal
|
||||||
|
// in the MS case.
|
||||||
|
return ((p2 - p1) == (r.p2 - r.p1)) && re_detail::equal(p1, p2, r.p1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <class charT>
|
template <class charT>
|
||||||
|
@ -128,7 +128,7 @@ inline void pointer_construct(T* p, const T& t)
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
namespace boost{ namespace re_detail{
|
namespace boost{ namespace re_detail{
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC,>=1400)
|
#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(_CPPLIB_VER) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||||
//
|
//
|
||||||
// MSVC 8 will either emit warnings or else refuse to compile
|
// MSVC 8 will either emit warnings or else refuse to compile
|
||||||
// code that makes perfectly legitimate use of std::copy, when
|
// code that makes perfectly legitimate use of std::copy, when
|
||||||
@ -144,12 +144,22 @@ namespace boost{ namespace re_detail{
|
|||||||
{
|
{
|
||||||
return stdext::unchecked_copy(first, last, dest);
|
return stdext::unchecked_copy(first, last, dest);
|
||||||
}
|
}
|
||||||
|
template<class InputIterator1, class InputIterator2>
|
||||||
|
inline bool equal(
|
||||||
|
InputIterator1 first,
|
||||||
|
InputIterator1 last,
|
||||||
|
InputIterator2 with
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return stdext::unchecked_equal(first, last, with);
|
||||||
|
}
|
||||||
|
|
||||||
// use safe versions of strcpy etc:
|
// use safe versions of strcpy etc:
|
||||||
using ::strcpy_s;
|
using ::strcpy_s;
|
||||||
using ::strcat_s;
|
using ::strcat_s;
|
||||||
#else
|
#else
|
||||||
using std::copy;
|
using std::copy;
|
||||||
|
using std::equal;
|
||||||
|
|
||||||
inline std::size_t strcpy_s(
|
inline std::size_t strcpy_s(
|
||||||
char *strDestination,
|
char *strDestination,
|
||||||
|
Reference in New Issue
Block a user