Merge branch 'use-boost-override' of https://github.com/EugeneZelenko/regex into develop

Resolved Conflicts:
	include/boost/regex/v4/cpp_regex_traits.hpp
	src/wc_regex_traits.cpp
This commit is contained in:
jzmaddock
2020-10-12 19:34:55 +01:00
16 changed files with 65 additions and 102 deletions

View File

@ -16,7 +16,6 @@
* DESCRIPTION: Implements out of line c_regex_traits<char> members
*/
#define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
@ -105,7 +104,7 @@ c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transfo
case ::boost::BOOST_REGEX_DETAIL_NS::sort_delim:
// get a regular sort key, and then truncate everything after the delim:
result = transform(p1, p2);
if(result.size() && (result[0] == s_delim))
if((!result.empty()) && (result[0] == s_delim))
break;
std::size_t i;
for(i = 0; i < result.size(); ++i)

View File

@ -42,7 +42,7 @@ void cpp_regex_traits_char_layer<char>::init()
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
#endif
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
if(cat_name.size() && (m_pmessages != 0))
if((!cat_name.empty()) && (m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,
@ -114,4 +114,3 @@ void cpp_regex_traits_char_layer<char>::init()
} // BOOST_REGEX_DETAIL_NS
} // boost
#endif

View File

@ -22,11 +22,11 @@
#include <boost/regex.hpp>
#include <boost/cregex.hpp>
#if !defined(BOOST_NO_STD_STRING)
#include <map>
#include <cstdio>
#include <list>
#include <map>
#include <boost/regex/v4/fileiter.hpp>
typedef boost::match_flag_type match_flag_type;
#include <cstdio>
#ifdef BOOST_MSVC
#pragma warning(disable:4309)
@ -417,7 +417,7 @@ unsigned int RegEx::GrepFiles(GrepFileCallback cb, const char* files, bool recur
result += r;
++start;
pdata->clean();
if(pred.ok == false)
if(!pred.ok)
return result;
}
@ -443,7 +443,7 @@ unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recu
if(regex_search(map.begin(), map.end(), pdata->fm, pdata->e, flags))
{
++result;
if(false == cb((*start).c_str()))
if(!cb((*start).c_str()))
return result;
}
//pdata->update();
@ -649,19 +649,3 @@ basic_string<wchar_t>::replace<const wchar_t*>(wchar_t* f1, wchar_t* f2, const w
#endif
#endif

View File

@ -44,14 +44,14 @@ icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do
#endif
::uint8_t result[100];
::int32_t len;
if(t.size())
if(!t.empty())
len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), result, sizeof(result));
else
len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast< ::int32_t>(0), result, sizeof(result));
if(std::size_t(len) > sizeof(result))
{
scoped_array< ::uint8_t> presult(new ::uint8_t[len+1]);
if(t.size())
if(!t.empty())
len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), presult.get(), len+1);
else
len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast< ::int32_t>(0), presult.get(), len+1);
@ -414,11 +414,11 @@ icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_
++i;
}
}
if(s.size())
if(!s.empty())
idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
if(idx >= 0)
return masks[idx+1];
if(s.size())
if(!s.empty())
result = lookup_icu_mask(&*s.begin(), &*s.begin() + s.size());
if(result != 0)
return result;

View File

@ -19,9 +19,9 @@
#define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <cstdio>
#include <boost/regex.hpp>
#include <boost/cregex.hpp>
#include <cstdio>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
@ -269,8 +269,8 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, cons
std::size_t i;
for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
{
array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf);
array[i].rm_so = m[i].matched ? (m[i].first - buf) : -1;
array[i].rm_eo = m[i].matched ? (m[i].second - buf) : -1;
}
// and set anything else to -1:
for(i = expression->re_nsub + 1; i < n; ++i)
@ -296,7 +296,3 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
}
} // namespace boost

View File

@ -145,7 +145,7 @@ c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::t
case ::boost::BOOST_REGEX_DETAIL_NS::sort_delim:
// get a regular sort key, and then truncate everything after the delim:
result = c_regex_traits<wchar_t>::transform(&*result.begin(), &*result.begin() + result.size());
if(result.size() && (result[0] == s_delim))
if((!result.empty()) && (result[0] == s_delim))
break;
std::size_t i;
for(i = 0; i < result.size(); ++i)
@ -236,7 +236,7 @@ c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::l
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
&& !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
&& !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)
if(name.size())
if(!name.empty())
return string_type(name.begin(), name.end());
#else
if(name.size())
@ -311,4 +311,3 @@ int BOOST_REGEX_CALL c_regex_traits<unsigned short>::value(unsigned short c, int
#endif // BOOST_NO_WREGEX
#endif // BOOST_BORLANDC

View File

@ -25,9 +25,9 @@
#include <boost/regex.hpp>
#include <boost/cregex.hpp>
#include <cwchar>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <cwchar>
#ifdef BOOST_INTEL
#pragma warning(disable:981)
@ -284,8 +284,8 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, cons
std::size_t i;
for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
{
array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf);
array[i].rm_so = m[i].matched ? (m[i].first - buf) : -1;
array[i].rm_eo = m[i].matched ? (m[i].second - buf) : -1;
}
// and set anything else to -1:
for(i = expression->re_nsub + 1; i < n; ++i)
@ -313,7 +313,3 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression)
} // namespace boost;
#endif