Index: compiled/String.h |
=================================================================== |
--- a/compiled/String.h |
+++ b/compiled/String.h |
@@ -344,16 +344,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); |
sergei
2017/04/12 12:04:31
I think it makes sense to put this assert before t
hub
2017/04/12 12:12:07
Not sure what the intent is but to me it looks rea
sergei
2017/04/12 12:14:40
Ah, sorry, misread it as `if (!source)...`. It's c
|
+ 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); |
@@ -366,17 +378,17 @@ public: |
bool negative = false; |
if (num < 0) |
{ |
negative = true; |
num = -num; |
} |
size_type size = 0; |
- for (int i = num; i; i /= 10) |
+ for (T i = num; i; i /= 10) |
size++; |
size = (size ? size : 1); |
size_type pos = length(); |
grow((negative ? 1 : 0) + size); |
if (negative) |
mBuf[pos++] = '-'; |