From d310bc983507397586306e44253d9fd81c38bb55 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 22 Jun 2004 12:42:16 +0000 Subject: [PATCH] HP aCC patches. [SVN r23147] --- src/cpp_regex_traits.cpp | 2 +- src/cregex.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp index 7bd7bf09..5601cf40 100644 --- a/src/cpp_regex_traits.cpp +++ b/src/cpp_regex_traits.cpp @@ -379,7 +379,7 @@ int BOOST_REGEX_CALL cpp_regex_traits::toi(char c)const int BOOST_REGEX_CALL cpp_regex_traits::toi(const char*& first, const char* last, int radix)const { - pmd->sbuf.pubsetbuf(const_cast(first), static_cast(last-first)); + pmd->sbuf.pubsetbuf(const_cast(static_cast(first)), static_cast(last-first)); pmd->is.clear(); if(std::abs(radix) == 16) pmd->is >> std::hex; else if(std::abs(radix) == 8) pmd->is >> std::oct; diff --git a/src/cregex.cpp b/src/cregex.cpp index bdfd751f..37da79ec 100644 --- a/src/cregex.cpp +++ b/src/cregex.cpp @@ -21,6 +21,7 @@ #include #include +#include #if !defined(BOOST_NO_STD_STRING) #include #include @@ -113,7 +114,7 @@ void RegExData::update() for(unsigned int i = 0; i < m.size(); ++i) { if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second); - positions[i] = m[i].matched ? m[i].first - pbase : -1; + positions[i] = m[i].matched ? m[i].first - pbase : RegEx::npos; } } #ifndef BOOST_REGEX_NO_FILEITER @@ -122,7 +123,7 @@ void RegExData::update() for(unsigned int i = 0; i < fm.size(); ++i) { if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second); - positions[i] = fm[i].matched ? fm[i].first - fbase : -1; + positions[i] = fm[i].matched ? fm[i].first - fbase : RegEx::npos; } } #endif @@ -585,8 +586,13 @@ std::string RegEx::What(int i)const return result; } -const unsigned int RegEx::npos = ~0u; - +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +const std::size_t RegEx::npos = ::boost::integer_traits::const_max; +#elif defined(BOOST_HAS_LONG_LONG) +const std::size_t RegEx::npos = ~0ULL; +#else +const std::size_t RegEx::npos = ~0UL; +#endif } // namespace boost