mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
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:
parent
e0e6bbbbe2
commit
010d4dc673
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue