Added workaround for Rogue Wave lib bug.

[SVN r11391]
This commit is contained in:
John Maddock
2001-10-16 11:36:47 +00:00
parent e047b2b509
commit 19d8e96cf5

View File

@ -34,6 +34,27 @@ namespace boost{
#pragma option push -a4 -b -Ve -pc -w-8026
#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>
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
iterator last,
@ -104,11 +125,11 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
traits_inst.transform(s1, s2);
for(i = 0; i < set_->cranges; ++i)
{
if(s1 <= p)
if(STR_COMP(s1, p) <= 0)
{
while(*p)++p;
++p;
if(s1 >= p)
if(STR_COMP(s1, p) >= 0)
return set_->isnot ? next : ++next;
}
else
@ -129,7 +150,7 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
traits_inst.transform_primary(s1, s2);
for(i = 0; i < set_->cequivalents; ++i)
{
if(s1 == p)
if(STR_COMP(s1, p) == 0)
return set_->isnot ? next : ++next;
// skip string
while(*p)++p;