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: Added md5 checksum. Reorganized some code. Created Nov. 28, 2017, 10:46 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 | « compiled/Md5.cpp ('k') | compiled/StringScanner.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
@@ -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
+ {
+ 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)
{
« no previous file with comments | « compiled/Md5.cpp ('k') | compiled/StringScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld