Remove unnecessary UTF-8 check for config variables

Invalid UTF-8 will not be read from config files with `CLineReader` anymore and the local console never allowed entering invalid UTF-8, so this additional mangling of invalid UTF-8 string config variable values is unnecessary.
This commit is contained in:
Robert Müller 2024-03-03 18:08:47 +01:00
parent e0e6bbbbe2
commit 010d4dc673

View file

@ -210,25 +210,7 @@ void SStringConfigVariable::CommandCallback(IConsole::IResult *pResult, void *pU
return;
const char *pString = pResult->GetString(0);
if(!str_utf8_check(pString))
{
char aTemp[4];
size_t Length = 0;
while(*pString)
{
size_t Size = str_utf8_encode(aTemp, static_cast<unsigned char>(*pString++));
if(Length + Size < pData->m_MaxSize)
{
mem_copy(pData->m_pStr + Length, aTemp, Size);
Length += Size;
}
else
break;
}
pData->m_pStr[Length] = '\0';
}
else
str_copy(pData->m_pStr, pString, pData->m_MaxSize);
str_copy(pData->m_pStr, pString, pData->m_MaxSize);
if(pResult->m_ClientId != IConsole::CLIENT_ID_GAME)
str_copy(pData->m_pOldValue, pData->m_pStr, pData->m_MaxSize);