From 6732abe03edcfff1f3b7cd7f0c942ded9e579e46 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 23 Jun 2004 12:44:17 +0000 Subject: [PATCH] HP aCC patches. [SVN r23169] --- include/boost/regex/v4/cregex.hpp | 2 +- include/boost/regex/v4/regex_token_iterator.hpp | 3 ++- src/cpp_regex_traits.cpp | 2 +- src/cregex.cpp | 13 ++++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/boost/regex/v4/cregex.hpp b/include/boost/regex/v4/cregex.hpp index 15c92b52..903aa165 100644 --- a/include/boost/regex/v4/cregex.hpp +++ b/include/boost/regex/v4/cregex.hpp @@ -252,7 +252,7 @@ public: std::string What(int i = 0)const; std::string operator[](int i)const { return What(i); } - static const unsigned int npos; + static const std::size_t npos; friend struct re_detail::pred1; friend struct re_detail::pred2; diff --git a/include/boost/regex/v4/regex_token_iterator.hpp b/include/boost/regex/v4/regex_token_iterator.hpp index f6f944ab..e25230b9 100644 --- a/include/boost/regex/v4/regex_token_iterator.hpp +++ b/include/boost/regex/v4/regex_token_iterator.hpp @@ -23,7 +23,8 @@ #include #if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ - || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ + || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) // // Borland C++ Builder 6, and Visual C++ 6, // can't cope with the array template constructor 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..154d0a84 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,7 +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