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

Unified Diff: compiled/String.h

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 13, 2017, 10:25 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/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -186,16 +186,33 @@
if (currChar >= u'A' && currChar <= u'Z')
mBuf[i] = currChar + u'a' - u'A';
else if (currChar >= 128)
{
mBuf[i] = CharToLower(currChar);
}
}
}
+
+ int toInt() const
+ {
hub 2017/11/27 17:15:44 This is redundant with some of the changes in http
+ size_type count = 0;
+ int value = 0;
+ for (size_type i = 0; i < length(); i++)
+ {
+ if (mBuf[i] < u'0' || mBuf[i] > u'9')
+ return 0;
+ value *= 10;
+ value += mBuf[i] - u'0';
+ count++;
+ if (count > 8)
+ return 0;
+ }
+ return value;
+ }
};
class DependentString : public String
{
public:
explicit DependentString()
: String(nullptr, 0, INVALID)
{

Powered by Google App Engine
This is Rietveld