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: Deal with ill formed filters. Created Feb. 14, 2018, 5:05 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
« no previous file with comments | « no previous file | compiled/Utils.h » ('j') | compiled/filter/ElemHideBase.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -134,26 +134,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') | compiled/filter/ElemHideBase.cpp » ('J')

Powered by Google App Engine
This is Rietveld