Codechange: do not make a string valid in place, to then copy it

This commit is contained in:
Rubidium
2023-07-05 19:36:35 +02:00
committed by rubidium42
parent b958a343fe
commit 18a31cca7c
3 changed files with 5 additions and 10 deletions

View File

@@ -2651,12 +2651,9 @@ static ChangeInfoResult LoadTranslationTable(uint gvid, int numinfo, ByteReader
*/
static std::string ReadDWordAsString(ByteReader *reader)
{
char output[5];
for (int i = 0; i < 4; i++) output[i] = reader->ReadByte();
output[4] = '\0';
StrMakeValidInPlace(output, lastof(output));
return std::string(output);
std::string output;
for (int i = 0; i < 4; i++) output.push_back(reader->ReadByte());
return StrMakeValid(output);
}
/**