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

Side by Side 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: Created March 15, 2017, 3:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | compiled/StringMap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #pragma once 1 #pragma once
2 2
3 #include <cstddef> 3 #include <cstddef>
4 #include <cstring> 4 #include <cstring>
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include <emscripten.h> 7 #include <emscripten.h>
8 8
9 #include "debug.h" 9 #include "debug.h"
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 { 324 {
325 if (!sourceLen) 325 if (!sourceLen)
326 return; 326 return;
327 327
328 assert(source, u"Null buffer passed to OwnedString.append()"_str); 328 assert(source, u"Null buffer passed to OwnedString.append()"_str);
329 size_t oldLength = length(); 329 size_t oldLength = length();
330 grow(sourceLen); 330 grow(sourceLen);
331 std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen); 331 std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen);
332 } 332 }
333 333
334 void append(const char* source, size_type sourceLen)
335 {
336 if (!sourceLen)
337 return;
338
339 assert(source, u"Null buffer passed to OwnedString.append()"_str);
340 size_t oldLength = length();
341 grow(sourceLen);
342 for (size_t i = 0; i < sourceLen; i++)
343 mBuf[oldLength + i] = source[i];
344 }
345
334 void append(const String& str) 346 void append(const String& str)
335 { 347 {
336 append(str.mBuf, str.length()); 348 append(str.mBuf, str.length());
337 } 349 }
338 350
339 void append(value_type c) 351 void append(value_type c)
340 { 352 {
341 append(&c, 1); 353 append(&c, 1);
342 } 354 }
343 }; 355 };
OLDNEW
« no previous file with comments | « no previous file | compiled/StringMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld