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

Unified Diff: compiled/String.h

Issue 29384812: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 1 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Use uint64_t for properties Created April 7, 2017, 7:12 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/StringMap.h » ('j') | compiled/bindings.ipp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/String.h
===================================================================
--- a/compiled/String.h
+++ b/compiled/String.h
@@ -344,16 +344,28 @@ public:
return;
assert(source, u"Null buffer passed to OwnedString.append()"_str);
size_t oldLength = length();
grow(sourceLen);
std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen);
}
+ void append(const char* source, size_type sourceLen)
+ {
+ if (!sourceLen)
+ return;
+
+ assert(source, u"Null buffer passed to OwnedString.append()"_str);
+ size_t oldLength = length();
+ grow(sourceLen);
+ for (size_t i = 0; i < sourceLen; i++)
+ mBuf[oldLength + i] = source[i];
+ }
+
void append(const String& str)
{
append(str.mBuf, str.length());
}
void append(value_type c)
{
append(&c, 1);
@@ -366,17 +378,17 @@ public:
bool negative = false;
if (num < 0)
{
negative = true;
num = -num;
}
size_type size = 0;
- for (int i = num; i; i /= 10)
+ for (T i = num; i; i /= 10)
Wladimir Palant 2017/04/07 07:14:57 Yep, fixed a stupid mistake here.
size++;
size = (size ? size : 1);
size_type pos = length();
grow((negative ? 1 : 0) + size);
if (negative)
mBuf[pos++] = '-';
« no previous file with comments | « no previous file | compiled/StringMap.h » ('j') | compiled/bindings.ipp » ('J')

Powered by Google App Engine
This is Rietveld