Fixed a bug on zero padding the string's byte content.
This commit is contained in:
@@ -110,9 +110,8 @@ void TStringRemoveRange(int startIndex, int count, TString* string) {
|
|||||||
|
|
||||||
for (glyphCount = 0; glyphCount < count; glyphCount++) endByte += GetGlyphByteWidth(string->Characters[endByte]);
|
for (glyphCount = 0; glyphCount < count; glyphCount++) endByte += GetGlyphByteWidth(string->Characters[endByte]);
|
||||||
|
|
||||||
memset(&string->Characters[startByte], '\0', endByte - startByte);
|
|
||||||
|
|
||||||
if (endByte == string->ByteCount) {
|
if (endByte == string->ByteCount) {
|
||||||
|
memset(&string->Characters[startByte], '\0', endByte - startByte);
|
||||||
string->Length -= glyphCount;
|
string->Length -= glyphCount;
|
||||||
string->ByteCount -= endByte - startByte;
|
string->ByteCount -= endByte - startByte;
|
||||||
return;
|
return;
|
||||||
@@ -131,7 +130,7 @@ void TStringRemoveRange(int startIndex, int count, TString* string) {
|
|||||||
memcpy(&string->Characters[startByte], buffer, remainder);
|
memcpy(&string->Characters[startByte], buffer, remainder);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&string->Characters[endByte], '\0', string->ByteCount - endByte);
|
memset(&string->Characters[string->ByteCount - endByte - startByte], '\0', endByte - startByte);
|
||||||
|
|
||||||
string->Length -= glyphCount;
|
string->Length -= glyphCount;
|
||||||
string->ByteCount -= endByte - startByte;
|
string->ByteCount -= endByte - startByte;
|
||||||
|
|||||||
Reference in New Issue
Block a user