diff --git a/include/boost/regex.hpp b/include/boost/regex.hpp index 329e671c..5cf40737 100644 --- a/include/boost/regex.hpp +++ b/include/boost/regex.hpp @@ -54,7 +54,7 @@ namespace boost{ #ifdef __BORLANDC__ - #pragma option push -a4 -b -Ve -pc + #pragma option push -a4 -b -Ve -pc -w-8027 #endif namespace re_detail{ diff --git a/include/boost/regex/detail/regex_compile.hpp b/include/boost/regex/detail/regex_compile.hpp index f13028a0..96b7469e 100644 --- a/include/boost/regex/detail/regex_compile.hpp +++ b/include/boost/regex/detail/regex_compile.hpp @@ -26,7 +26,7 @@ namespace boost{ #ifdef __BORLANDC__ - #pragma option push -a4 -b -Ve -pc + #pragma option push -a4 -b -Ve -pc -w-8004 #endif namespace re_detail{ @@ -607,6 +607,10 @@ void BOOST_REGEX_CALL reg_expression::compile_map( template void BOOST_REGEX_CALL reg_expression::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 // called after an insert: j = reinterpret_cast(reinterpret_cast(data.data()) + j->next.i); @@ -631,6 +635,9 @@ void BOOST_REGEX_CALL reg_expression::move_offsets(re_ break; j = reinterpret_cast(reinterpret_cast(data.data()) + j->next.i); } +# ifdef BOOST_MSVC +# pragma warning(pop) +#endif } template @@ -1245,6 +1252,11 @@ void BOOST_REGEX_CALL reg_expression::fixup_apply(re_d template unsigned int BOOST_REGEX_CALL reg_expression::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()) { traits_string_type s(p, end); @@ -1912,6 +1924,11 @@ unsigned int BOOST_REGEX_CALL reg_expression::set_expr } // sentry return REG_EMPTY; + +# ifdef BOOST_MSVC +# pragma warning(pop) +#endif + } template diff --git a/include/boost/regex/detail/regex_kmp.hpp b/include/boost/regex/detail/regex_kmp.hpp index 3a5db1ee..b922df31 100644 --- a/include/boost/regex/detail/regex_kmp.hpp +++ b/include/boost/regex/detail/regex_kmp.hpp @@ -40,10 +40,10 @@ namespace boost{ template struct kmp_info { - std::size_t size; - std::size_t len; + unsigned int size; + unsigned int len; const charT* pstr; - std::ptrdiff_t kmp_next[1]; + int kmp_next[1]; }; template @@ -57,11 +57,11 @@ template kmp_info* kmp_compile(iterator first, iterator last, charT, Trans translate, const Allocator& a) { typedef typename boost::detail::rebind_allocator::type atype; - std::ptrdiff_t i, j, m; + int i, j, m; i = 0; - m = boost::re_detail::distance(first, last); + m = static_cast(boost::re_detail::distance(first, last)); ++m; - std::size_t size = sizeof(kmp_info) + sizeof(int)*m + sizeof(charT)*m; + unsigned int size = sizeof(kmp_info) + sizeof(int)*m + sizeof(charT)*m; --m; // // allocate struct and fill it in: @@ -109,6 +109,3 @@ kmp_info* kmp_compile(iterator first, iterator last, charT, Trans transla - - - diff --git a/include/boost/regex/detail/regex_match.hpp b/include/boost/regex/detail/regex_match.hpp index cdcfb008..fb1e919f 100644 --- a/include/boost/regex/detail/regex_match.hpp +++ b/include/boost/regex/detail/regex_match.hpp @@ -31,7 +31,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #pragma option push -a4 -b -Ve -pc -w-8026 + #pragma option push -a4 -b -Ve -pc -w-8026 -w-8027 #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) #endif +template +inline const charT* re_skip_past_null(const charT* p) +{ + while (*p != 0) ++p; + return ++p; +} + template iterator BOOST_REGEX_CALL re_is_set_member(iterator next, iterator last, @@ -103,8 +110,7 @@ iterator BOOST_REGEX_CALL re_is_set_member(iterator next, if(*p == 0) // if null we've matched return set_->isnot ? next : (ptr == next) ? ++next : ptr; - while(*p)++p; - ++p; // skip null + p = re_skip_past_null(p); // skip null } } @@ -283,6 +289,11 @@ bool query_match_aux(iterator first, _priv_match_data& pd, iterator* restart) { +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4127) +#endif + typedef access_t access; if(e.flags() & regbase::failbit) @@ -1030,6 +1041,9 @@ bool query_match_aux(iterator first, // if we get to here then everything has failed // and no match was found: return false; +# ifdef BOOST_MSVC +# pragma warning(pop) +#endif } #if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE) } // namespace @@ -1257,9 +1271,9 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression* info = access::get_kmp(e); - std::ptrdiff_t len = info->len; + int len = info->len; const charT* x = info->pstr; - std::ptrdiff_t j = 0; + int j = 0; bool icase = e.flags() & regbase::icase; while (first != last) { @@ -1913,3 +1927,5 @@ inline unsigned int regex_grep(bool (*foo)(const match_results