Fixed more warnings, rolled back some regex changes that seem to be causing problems on 64-bit platforms.

[SVN r14063]
This commit is contained in:
John Maddock
2002-05-30 11:07:05 +00:00
parent bbbd65c2e4
commit 53de3c4ae6
4 changed files with 46 additions and 16 deletions

View File

@ -54,7 +54,7 @@
namespace boost{ namespace boost{
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma option push -a4 -b -Ve -pc #pragma option push -a4 -b -Ve -pc -w-8027
#endif #endif
namespace re_detail{ namespace re_detail{

View File

@ -26,7 +26,7 @@
namespace boost{ namespace boost{
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma option push -a4 -b -Ve -pc #pragma option push -a4 -b -Ve -pc -w-8004
#endif #endif
namespace re_detail{ namespace re_detail{
@ -607,6 +607,10 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_map(
template <class charT, class traits, class Allocator> template <class charT, class traits, class Allocator>
void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_detail::re_syntax_base* j, unsigned size) void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_detail::re_syntax_base* j, unsigned size)
{ {
# ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4127)
#endif
// move all offsets starting with j->link forward by size // move all offsets starting with j->link forward by size
// called after an insert: // called after an insert:
j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i); j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i);
@ -631,6 +635,9 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_
break; break;
j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i); j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i);
} }
# ifdef BOOST_MSVC
# pragma warning(pop)
#endif
} }
template <class charT, class traits, class Allocator> template <class charT, class traits, class Allocator>
@ -1245,6 +1252,11 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_apply(re_d
template <class charT, class traits, class Allocator> template <class charT, class traits, class Allocator>
unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expression(const charT* p, const charT* end, flag_type f) unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expression(const charT* p, const charT* end, flag_type f)
{ {
# ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4127)
#endif
if(p == expression()) if(p == expression())
{ {
traits_string_type s(p, end); traits_string_type s(p, end);
@ -1912,6 +1924,11 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expr
} // sentry } // sentry
return REG_EMPTY; return REG_EMPTY;
# ifdef BOOST_MSVC
# pragma warning(pop)
#endif
} }
template <class charT, class traits, class Allocator> template <class charT, class traits, class Allocator>

View File

@ -40,10 +40,10 @@ namespace boost{
template <class charT> template <class charT>
struct kmp_info struct kmp_info
{ {
std::size_t size; unsigned int size;
std::size_t len; unsigned int len;
const charT* pstr; const charT* pstr;
std::ptrdiff_t kmp_next[1]; int kmp_next[1];
}; };
template <class charT, class Allocator> template <class charT, class Allocator>
@ -57,11 +57,11 @@ template <class iterator, class charT, class Trans, class Allocator>
kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans translate, const Allocator& a) kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans translate, const Allocator& a)
{ {
typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype; typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype;
std::ptrdiff_t i, j, m; int i, j, m;
i = 0; i = 0;
m = boost::re_detail::distance(first, last); m = static_cast<int>(boost::re_detail::distance(first, last));
++m; ++m;
std::size_t size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m; unsigned int size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m;
--m; --m;
// //
// allocate struct and fill it in: // allocate struct and fill it in:
@ -109,6 +109,3 @@ kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans transla

View File

@ -31,7 +31,7 @@ namespace boost{
namespace re_detail{ namespace re_detail{
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma option push -a4 -b -Ve -pc -w-8026 #pragma option push -a4 -b -Ve -pc -w-8026 -w-8027
#endif #endif
// //
@ -55,6 +55,13 @@ inline int string_compare(const std::wstring& s, const wchar_t* p)
# define STR_COMP(s,p) string_compare(s,p) # define STR_COMP(s,p) string_compare(s,p)
#endif #endif
template<class charT>
inline const charT* re_skip_past_null(const charT* p)
{
while (*p != 0) ++p;
return ++p;
}
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,
@ -103,8 +110,7 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
if(*p == 0) // if null we've matched if(*p == 0) // if null we've matched
return set_->isnot ? next : (ptr == next) ? ++next : ptr; return set_->isnot ? next : (ptr == next) ? ++next : ptr;
while(*p)++p; p = re_skip_past_null(p); // skip null
++p; // skip null
} }
} }
@ -283,6 +289,11 @@ bool query_match_aux(iterator first,
_priv_match_data<iterator, Allocator>& pd, _priv_match_data<iterator, Allocator>& pd,
iterator* restart) iterator* restart)
{ {
# ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable: 4127)
#endif
typedef access_t<charT, traits, Allocator2> access; typedef access_t<charT, traits, Allocator2> access;
if(e.flags() & regbase::failbit) if(e.flags() & regbase::failbit)
@ -1030,6 +1041,9 @@ bool query_match_aux(iterator first,
// if we get to here then everything has failed // if we get to here then everything has failed
// and no match was found: // and no match was found:
return false; return false;
# ifdef BOOST_MSVC
# pragma warning(pop)
#endif
} }
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE) #if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
} // namespace } // namespace
@ -1257,9 +1271,9 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
case regbase::restart_fixed_lit: case regbase::restart_fixed_lit:
{ {
const kmp_info<charT>* info = access::get_kmp(e); const kmp_info<charT>* info = access::get_kmp(e);
std::ptrdiff_t len = info->len; int len = info->len;
const charT* x = info->pstr; const charT* x = info->pstr;
std::ptrdiff_t j = 0; int j = 0;
bool icase = e.flags() & regbase::icase; bool icase = e.flags() & regbase::icase;
while (first != last) while (first != last)
{ {
@ -1913,3 +1927,5 @@ inline unsigned int regex_grep(bool (*foo)(const match_results<std::basic_string