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: Switched to our own number conversion Created April 6, 2017, 3:25 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 /* 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 { 342 {
343 if (!sourceLen) 343 if (!sourceLen)
344 return; 344 return;
345 345
346 assert(source, u"Null buffer passed to OwnedString.append()"_str); 346 assert(source, u"Null buffer passed to OwnedString.append()"_str);
347 size_t oldLength = length(); 347 size_t oldLength = length();
348 grow(sourceLen); 348 grow(sourceLen);
349 std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen); 349 std::memcpy(mBuf + oldLength, source, sizeof(value_type) * sourceLen);
350 } 350 }
351 351
352 void append(const char* source, size_type sourceLen)
353 {
354 if (!sourceLen)
355 return;
356
357 assert(source, u"Null buffer passed to OwnedString.append()"_str);
358 size_t oldLength = length();
359 grow(sourceLen);
360 for (size_t i = 0; i < sourceLen; i++)
361 mBuf[oldLength + i] = source[i];
362 }
363
352 void append(const String& str) 364 void append(const String& str)
353 { 365 {
354 append(str.mBuf, str.length()); 366 append(str.mBuf, str.length());
355 } 367 }
356 368
357 void append(value_type c) 369 void append(value_type c)
358 { 370 {
359 append(&c, 1); 371 append(&c, 1);
360 } 372 }
361 373
(...skipping 19 matching lines...) Expand all
381 if (negative) 393 if (negative)
382 mBuf[pos++] = '-'; 394 mBuf[pos++] = '-';
383 395
384 for (int i = size - 1; i >= 0; i--) 396 for (int i = size - 1; i >= 0; i--)
385 { 397 {
386 mBuf[pos + i] = '0' + (num % 10); 398 mBuf[pos + i] = '0' + (num % 10);
387 num /= 10; 399 num /= 10;
388 } 400 }
389 } 401 }
390 }; 402 };
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