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: Replace subscriptionClasses.js properly instead of creating a new file Created March 27, 2017, 9:06 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/subscription/DownloadableSubscription.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
@@ -343,16 +343,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);
« no previous file with comments | « no previous file | compiled/StringMap.h » ('j') | compiled/subscription/DownloadableSubscription.cpp » ('J')

Powered by Google App Engine
This is Rietveld