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: Replace subscriptionClasses.js properly instead of creating a new file Created March 27, 2017, 9:06 a.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') | compiled/subscription/DownloadableSubscription.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 { 341 {
342 if (!sourceLen) 342 if (!sourceLen)
343 return; 343 return;
344 344
345 assert(source, u"Null buffer passed to OwnedString.append()"_str); 345 assert(source, u"Null buffer passed to OwnedString.append()"_str);
346 size_t oldLength = length(); 346 size_t oldLength = length();
347 grow(sourceLen); 347 grow(sourceLen);
348 std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen); 348 std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen);
349 } 349 }
350 350
351 void append(const char* source, size_type sourceLen)
352 {
353 if (!sourceLen)
354 return;
355
356 assert(source, u"Null buffer passed to OwnedString.append()"_str);
357 size_t oldLength = length();
358 grow(sourceLen);
359 for (size_t i = 0; i < sourceLen; i++)
360 mBuf[oldLength + i] = source[i];
361 }
362
351 void append(const String& str) 363 void append(const String& str)
352 { 364 {
353 append(str.mBuf, str.length()); 365 append(str.mBuf, str.length());
354 } 366 }
355 367
356 void append(value_type c) 368 void append(value_type c)
357 { 369 {
358 append(&c, 1); 370 append(&c, 1);
359 } 371 }
360 }; 372 };
OLDNEW
« 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