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

Unified Diff: compiled/String.h

Issue 29587914: Issue 5142 - Convert Element Hiding to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Oct. 25, 2017, 1:07 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
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -186,16 +186,34 @@
if (currChar >= u'A' && currChar <= u'Z')
mBuf[i] = currChar + u'a' - u'A';
else if (currChar >= 128)
{
mBuf[i] = CharToLower(currChar);
}
}
}
+
+ void toUpper()
hub 2017/10/25 01:19:38 I now realize I don't need this one. Will remove i
+ {
+ size_type len = length();
+ for (size_type i = 0; i < len; ++i)
+ {
+ value_type currChar = mBuf[i];
+
+ // This should be more efficient with a lookup table but I couldn't measure
+ // any performance difference.
+ if (currChar >= u'a' && currChar <= u'z')
+ mBuf[i] = currChar - (u'a' - u'A');
+ else if (currChar >= 128)
+ {
+ mBuf[i] = CharToUpper(currChar);
+ }
+ }
+ }
};
class DependentString : public String
{
public:
explicit DependentString()
: String(nullptr, 0, INVALID)
{

Powered by Google App Engine
This is Rietveld