mirror of
https://github.com/boostorg/regex.git
synced 2025-07-16 13:52:17 +02:00
Added workaround for Rogue Wave lib bug.
[SVN r11391]
This commit is contained in:
@ -34,6 +34,27 @@ namespace boost{
|
|||||||
#pragma option push -a4 -b -Ve -pc -w-8026
|
#pragma option push -a4 -b -Ve -pc -w-8026
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Unfortunately Rogue Waves standard library appears to have a bug
|
||||||
|
// in std::basic_string::compare that results in eroneous answers
|
||||||
|
// in some cases (tested with Borland C++ 5.1, Rogue Wave lib version
|
||||||
|
// 0x020101) the test case was:
|
||||||
|
// {39135,0} < {0xff,0}
|
||||||
|
// which succeeds when it should not.
|
||||||
|
//
|
||||||
|
#ifndef _RWSTD_VER
|
||||||
|
# define STR_COMP(s,p) s.compare(p)
|
||||||
|
#else
|
||||||
|
template <class C, class T, class A>
|
||||||
|
int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
||||||
|
{ return s.compare(p); }
|
||||||
|
int string_compare(const std::string& s, const char* p)
|
||||||
|
{ return std::strcmp(s.c_str(), p); }
|
||||||
|
int string_compare(const std::wstring& s, const wchar_t* p)
|
||||||
|
{ return std::wcscmp(s.c_str(), p); }
|
||||||
|
# define STR_COMP(s,p) string_compare(s,p)
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class iterator, class charT, class traits_type, class Allocator>
|
template <class iterator, class charT, class traits_type, class Allocator>
|
||||||
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
|
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
|
||||||
iterator last,
|
iterator last,
|
||||||
@ -104,11 +125,11 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
|
|||||||
traits_inst.transform(s1, s2);
|
traits_inst.transform(s1, s2);
|
||||||
for(i = 0; i < set_->cranges; ++i)
|
for(i = 0; i < set_->cranges; ++i)
|
||||||
{
|
{
|
||||||
if(s1 <= p)
|
if(STR_COMP(s1, p) <= 0)
|
||||||
{
|
{
|
||||||
while(*p)++p;
|
while(*p)++p;
|
||||||
++p;
|
++p;
|
||||||
if(s1 >= p)
|
if(STR_COMP(s1, p) >= 0)
|
||||||
return set_->isnot ? next : ++next;
|
return set_->isnot ? next : ++next;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -129,7 +150,7 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
|
|||||||
traits_inst.transform_primary(s1, s2);
|
traits_inst.transform_primary(s1, s2);
|
||||||
for(i = 0; i < set_->cequivalents; ++i)
|
for(i = 0; i < set_->cequivalents; ++i)
|
||||||
{
|
{
|
||||||
if(s1 == p)
|
if(STR_COMP(s1, p) == 0)
|
||||||
return set_->isnot ? next : ++next;
|
return set_->isnot ? next : ++next;
|
||||||
// skip string
|
// skip string
|
||||||
while(*p)++p;
|
while(*p)++p;
|
||||||
|
Reference in New Issue
Block a user