mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
Fix StringBuf.add()
This commit is contained in:
parent
504e0488a8
commit
9fb8f4cb6b
@ -46,10 +46,11 @@ public:
|
|||||||
{
|
{
|
||||||
size_t remainingLen = this->limit - this->length;
|
size_t remainingLen = this->limit - this->length;
|
||||||
size_t copyLen = appendedStr.size();
|
size_t copyLen = appendedStr.size();
|
||||||
if (remainingLen > copyLen)
|
if (remainingLen < copyLen)
|
||||||
copyLen = remainingLen;
|
copyLen = remainingLen;
|
||||||
char* outputStart = (char*)(this->str + this->length);
|
char* outputStart = (char*)(this->str + this->length);
|
||||||
std::copy(appendedStr.data(), appendedStr.data() + copyLen, outputStart);
|
std::copy(appendedStr.data(), appendedStr.data() + copyLen, outputStart);
|
||||||
|
length += copyLen;
|
||||||
outputStart[copyLen] = '\0';
|
outputStart[copyLen] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user