loolwsd: restore Poco regex and old initialization
Unfortunately, std::regex is not well supported by old compilers, namely gcc 4.8 doesn't seem to pass tests. In addition, newer gcc versions, such as 5.2, don't like {0,0} initialization. For now we agreed on restoring the original Poco regex and the old initialization of {}. When we move to newer gcc, we can revert this commit so we get std::regex. This commit reverts the following 3 commits: Revert "Util: fix -Werror=shadow" This reverts commit01c6cb40ef
. Revert "loolwsd: replace Poco regex with std" This reverts commit1fdb4bf862
. Revert "Fix gcc-4.8 build" This reverts commit92ff278997
. Change-Id: I04912055d1143a2aeebb8d853c4d0c7fe74a40cc Reviewed-on: https://gerrit.libreoffice.org/29324 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
891b942e7c
commit
56924299c9
1 changed files with 3 additions and 5 deletions
|
@ -187,18 +187,16 @@ namespace Util
|
|||
}
|
||||
|
||||
// Not a perfect match, try regex.
|
||||
const int length = subject.size();
|
||||
for (const auto& value : set)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Not performance critical to warrant caching.
|
||||
std::regex re(value, std::regex::icase);
|
||||
std::smatch smatch;
|
||||
Poco::RegularExpression re(value, Poco::RegularExpression::RE_CASELESS);
|
||||
Poco::RegularExpression::Match reMatch{};
|
||||
|
||||
// Must be a full match.
|
||||
if (std::regex_match(subject, smatch, re) &&
|
||||
smatch.position() == 0 && smatch.length() == length)
|
||||
if (re.match(subject, reMatch) && reMatch.offset == 0 && reMatch.length == subject.size())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue