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

Unified Diff: compiled/String.h

Issue 29595633: Issue 5870 - Implement the new ElemHideEmulation filter type (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Address review comment. Reworked the conversion Created Feb. 7, 2018, 4:13 a.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
« no previous file with comments | « no previous file | compiled/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -131,26 +131,31 @@
for (size_type i = pos; i < length(); ++i)
if (mBuf[i] == c)
return i;
return npos;
}
size_type find(const String& str, size_type pos = 0) const
{
- if (pos > LENGTH_MASK || pos + str.length() > length())
+ return find(str.mBuf, pos, str.length());
+ }
+
+ size_type find(const value_type* str, size_type pos, size_type count) const
+ {
+ if (pos > LENGTH_MASK || pos + count > length())
return npos;
- if (!str.length())
+ if (!count)
return pos;
- for (; pos + str.length() <= length(); ++pos)
+ for (; pos + count <= length(); ++pos)
{
if (mBuf[pos] == str[0] &&
- std::memcmp(mBuf + pos, str.mBuf, sizeof(value_type) * str.length()) == 0)
+ std::memcmp(mBuf + pos, str, sizeof(value_type) * count) == 0)
{
return pos;
}
}
return npos;
}
« no previous file with comments | « no previous file | compiled/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld