From d97bcfb5dd6b4418040b776f33a9342a4b2b6b75 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 31 Jul 2017 18:51:25 +0100 Subject: [PATCH] Fix integer types and signedness: Fixes https://svn.boost.org/trac10/ticket/13034 --- include/boost/regex/v4/perl_matcher.hpp | 2 +- include/boost/regex/v4/perl_matcher_non_recursive.hpp | 4 ++-- include/boost/regex/v4/perl_matcher_recursive.hpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/regex/v4/perl_matcher.hpp b/include/boost/regex/v4/perl_matcher.hpp index 32517c62..abd38122 100644 --- a/include/boost/regex/v4/perl_matcher.hpp +++ b/include/boost/regex/v4/perl_matcher.hpp @@ -122,7 +122,7 @@ inline int string_compare(const Seq& s, const C* p) { ++i; } - return (i == s.size()) ? -p[i] : s[i] - p[i]; + return (i == s.size()) ? -(int)p[i] : (int)s[i] - (int)p[i]; } # define STR_COMP(s,p) string_compare(s,p) diff --git a/include/boost/regex/v4/perl_matcher_non_recursive.hpp b/include/boost/regex/v4/perl_matcher_non_recursive.hpp index c12dea8e..fb008f2b 100644 --- a/include/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -688,7 +688,7 @@ bool perl_matcher::match_rep() template bool perl_matcher::match_dot_repeat_slow() { - unsigned count = 0; + std::size_t count = 0; const re_repeat* rep = static_cast(pstate); re_syntax_base* psingle = rep->next.p; // match compulsary repeats first: @@ -740,7 +740,7 @@ bool perl_matcher::match_dot_repeat_fast() const re_repeat* rep = static_cast(pstate); bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); - unsigned count = static_cast((std::min)(static_cast(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), static_cast(greedy ? rep->max : rep->min))); + std::size_t count = static_cast((std::min)(static_cast(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), greedy ? rep->max : rep->min)); if(rep->min > count) { position = last; diff --git a/include/boost/regex/v4/perl_matcher_recursive.hpp b/include/boost/regex/v4/perl_matcher_recursive.hpp index 8eb23abf..6c33ba47 100644 --- a/include/boost/regex/v4/perl_matcher_recursive.hpp +++ b/include/boost/regex/v4/perl_matcher_recursive.hpp @@ -423,7 +423,7 @@ bool perl_matcher::match_dot_repeat_slow() #pragma warning(push) #pragma warning(disable:4127) #endif - unsigned count = 0; + std::size_t count = 0; const re_repeat* rep = static_cast(pstate); re_syntax_base* psingle = rep->next.p; // match compulsary repeats first: @@ -497,7 +497,7 @@ bool perl_matcher::match_dot_repeat_fast() #pragma warning(disable:4267) #endif bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); - std::size_t count = (std::min)(static_cast(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), static_cast(greedy ? rep->max : rep->min)); + std::size_t count = (std::min)(static_cast(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), greedy ? rep->max : rep->min); if(rep->min > count) { position = last; @@ -657,7 +657,7 @@ bool perl_matcher::match_set_repeat() #endif const re_repeat* rep = static_cast(pstate); const unsigned char* map = static_cast(rep->next.p)->_map; - unsigned count = 0; + std::size_t count = 0; // // start by working out how much we can skip: // @@ -753,7 +753,7 @@ bool perl_matcher::match_long_set_repeat() typedef typename traits::char_class_type char_class_type; const re_repeat* rep = static_cast(pstate); const re_set_long* set = static_cast*>(pstate->next.p); - unsigned count = 0; + std::size_t count = 0; // // start by working out how much we can skip: //