OLD | NEW |
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 Loading... |
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 }; |
OLD | NEW |