[Libreoffice-commits] online.git: loolwsd/Util.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue Sep 27 15:00:52 UTC 2016
loolwsd/Util.hpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
New commits:
commit 56924299c9318e9022fe248e0538c053e3732847
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Sep 27 10:59:29 2016 -0400
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 commit 01c6cb40ef3c4718b8074288e790b47b545fefbe.
Revert "loolwsd: replace Poco regex with std"
This reverts commit 1fdb4bf8626ffa67c7732fe55f0cccf733894c15.
Revert "Fix gcc-4.8 build"
This reverts commit 92ff2789976d2b6d3dc0056f87026431108c1584.
Change-Id: I04912055d1143a2aeebb8d853c4d0c7fe74a40cc
Reviewed-on: https://gerrit.libreoffice.org/29324
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index 3aab0ad..1f59627 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -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;
}
More information about the Libreoffice-commits
mailing list