From 680588f6388c9e3f3d3ee976b315ebca860c1f1f Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 18 Oct 2010 12:07:14 +0000 Subject: [PATCH] Fix some compiler warnings by using "int" consistently for hash values. [SVN r66072] --- include/boost/regex/v4/basic_regex.hpp | 12 ++++++------ include/boost/regex/v4/basic_regex_creator.hpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/regex/v4/basic_regex.hpp b/include/boost/regex/v4/basic_regex.hpp index 6382c4af..04c7bb37 100644 --- a/include/boost/regex/v4/basic_regex.hpp +++ b/include/boost/regex/v4/basic_regex.hpp @@ -62,12 +62,12 @@ void bubble_down_one(I first, I last) } template -inline std::size_t hash_value_from_capture_name(Iterator i, Iterator j) +inline int hash_value_from_capture_name(Iterator i, Iterator j) { std::size_t r = boost::hash_range(i, j); r %= ((std::numeric_limits::max)() - 10001); r += 10000; - return r; + return static_cast(r); } class named_subexpressions @@ -81,12 +81,12 @@ public: { hash = hash_value_from_capture_name(i, j); } - name(std::size_t h, int idx) + name(int h, int idx) : index(idx), hash(h) { } int index; - std::size_t hash; + int hash; bool operator < (const name& other)const { return hash < other.hash; @@ -130,7 +130,7 @@ public: name t(i, j, 0); return std::equal_range(m_sub_names.begin(), m_sub_names.end(), t); } - int get_id(std::size_t h)const + int get_id(int h)const { name t(h, 0); std::vector::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t); @@ -140,7 +140,7 @@ public: } return -1; } - range_type equal_range(std::size_t h)const + range_type equal_range(int h)const { name t(h, 0); return std::equal_range(m_sub_names.begin(), m_sub_names.end(), t); diff --git a/include/boost/regex/v4/basic_regex_creator.hpp b/include/boost/regex/v4/basic_regex_creator.hpp index f7e2aa8d..efa9f7dd 100644 --- a/include/boost/regex/v4/basic_regex_creator.hpp +++ b/include/boost/regex/v4/basic_regex_creator.hpp @@ -811,7 +811,7 @@ void basic_regex_creator::fixup_recursions(re_syntax_base* state) // There may be more than one capture group with this hash, just do what Perl // does and recurse to the leftmost: // - idx = m_pdata->get_id(idx); + idx = m_pdata->get_id(static_cast(idx)); } while(p) {