Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/filter/ActiveFilter.cpp

Issue 29721753: Issue 6180 - use ABP_TEXT everywhere in order to let String be a UTF-8 string (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git@adb2678354813ce5b6de095072954c5a784a7bc4
Patch Set: Created March 13, 2018, 6:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/filter/ActiveFilter.cpp
diff --git a/compiled/filter/ActiveFilter.cpp b/compiled/filter/ActiveFilter.cpp
index 58166343138f7ba30ea4ede78a76b101966182e9..5fe9a0258752365d7a9e5326967b7f4da33192ea 100644
--- a/compiled/filter/ActiveFilter.cpp
+++ b/compiled/filter/ActiveFilter.cpp
@@ -22,7 +22,7 @@
ABP_NS_USING
-const DependentString ActiveFilter::DEFAULT_DOMAIN(u""_str);
+const DependentString ActiveFilter::DEFAULT_DOMAIN(ABP_TEXT(""_str));
ActiveFilter::ActiveFilter(Type type, const String& text, bool ignoreTrailingDot)
: Filter(type, text), mIgnoreTrailingDot(ignoreTrailingDot),
@@ -60,7 +60,7 @@ void ActiveFilter::ParseDomains(const String& domains,
{
done = scanner.done();
String::value_type currChar = scanner.next();
- if (currChar == u'~' && scanner.position() == start)
+ if (currChar == ABP_TEXT('~') && scanner.position() == start)
{
start++;
reverse = true;
@@ -68,7 +68,7 @@ void ActiveFilter::ParseDomains(const String& domains,
else if (currChar == separator)
{
String::size_type len = scanner.position() - start;
- if (len > 0 && mIgnoreTrailingDot && domains[start + len - 1] == '.')
+ if (len > 0 && mIgnoreTrailingDot && domains[start + len - 1] == ABP_TEXT('.'))
len--;
if (len > 0)
{
@@ -120,7 +120,7 @@ bool ActiveFilter::IsActiveOnDomain(DependentString& docDomain, const String& si
docDomain.toLower();
String::size_type len = docDomain.length();
- if (len > 0 && mIgnoreTrailingDot && docDomain[len - 1] == '.')
+ if (len > 0 && mIgnoreTrailingDot && docDomain[len - 1] == ABP_TEXT('.'))
docDomain.reset(docDomain, 0, len - 1);
while (true)
{
@@ -128,7 +128,7 @@ bool ActiveFilter::IsActiveOnDomain(DependentString& docDomain, const String& si
if (it)
return it->second;
- String::size_type nextDot = docDomain.find(u'.');
+ String::size_type nextDot = docDomain.find(ABP_TEXT('.'));
if (nextDot == docDomain.npos)
break;
docDomain.reset(docDomain, nextDot + 1);
@@ -145,7 +145,7 @@ bool ActiveFilter::IsActiveOnlyOnDomain(DependentString& docDomain) const
docDomain.toLower();
String::size_type len = docDomain.length();
- if (len > 0 && mIgnoreTrailingDot && docDomain[len - 1] == '.')
+ if (len > 0 && mIgnoreTrailingDot && docDomain[len - 1] == ABP_TEXT('.'))
docDomain.reset(docDomain, 0, len - 1);
for (const auto& item : *domains)
{
@@ -156,7 +156,7 @@ bool ActiveFilter::IsActiveOnlyOnDomain(DependentString& docDomain) const
size_t len2 = docDomain.length();
if (len1 > len2 &&
DependentString(item.first, len1 - len2).equals(docDomain) &&
- item.first[len1 - len2 - 1] == u'.')
+ item.first[len1 - len2 - 1] == ABP_TEXT('.'))
{
continue;
}
@@ -178,18 +178,18 @@ OwnedString ActiveFilter::Serialize() const
/* TODO this is very inefficient */
OwnedString result(Filter::Serialize());
if (mDisabled)
- result.append(u"disabled=true\n"_str);
+ result.append(ABP_TEXT("disabled=true\n"_str));
if (mHitCount)
{
- result.append(u"hitCount="_str);
+ result.append(ABP_TEXT("hitCount="_str));
result.append(mHitCount);
- result.append(u'\n');
+ result.append(ABP_TEXT('\n'));
}
if (mLastHit)
{
- result.append(u"lastHit="_str);
+ result.append(ABP_TEXT("lastHit="_str));
result.append(mLastHit);
- result.append(u'\n');
+ result.append(ABP_TEXT('\n'));
}
return result;
}

Powered by Google App Engine
This is Rietveld