Fix GCC 9.2.0 compilation

src/game/server/ddracechat.cpp:623:39: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
This commit is contained in:
def 2020-02-04 17:30:36 +01:00 committed by Dennis Felsing
parent 6fddf4aa9e
commit 598ec52892
3 changed files with 28 additions and 2 deletions

View file

@ -2459,6 +2459,13 @@ char *str_skip_to_whitespace(char *str)
return str;
}
const char *str_skip_to_whitespace_const(const char *str)
{
while(*str && (*str != ' ' && *str != '\t' && *str != '\n'))
str++;
return str;
}
char *str_skip_whitespaces(char *str)
{
while(*str && (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r'))
@ -2466,6 +2473,13 @@ char *str_skip_whitespaces(char *str)
return str;
}
const char *str_skip_whitespaces_const(const char *str)
{
while(*str && (*str == ' ' || *str == '\t' || *str == '\n' || *str == '\r'))
str++;
return str;
}
/* case */
int str_comp_nocase(const char *a, const char *b)
{

View file

@ -1137,6 +1137,12 @@ void str_clean_whitespaces(char *str);
*/
char *str_skip_to_whitespace(char *str);
/*
Function: str_skip_to_whitespace_const
See str_skip_to_whitespace.
*/
const char *str_skip_to_whitespace_const(const char *str);
/*
Function: str_skip_whitespaces
Skips leading whitespace characters(' ', '\t', '\n', '\r').
@ -1153,6 +1159,12 @@ char *str_skip_to_whitespace(char *str);
*/
char *str_skip_whitespaces(char *str);
/*
Function: str_skip_whitespaces_const
See str_skip_whitespaces.
*/
const char *str_skip_whitespaces_const(const char *str);
/*
Function: str_comp_nocase
Compares to strings case insensitively.

View file

@ -620,12 +620,12 @@ void CGameContext::ConSave(IConsole::IResult *pResult, void *pUserData)
if(pCode[3] == ' ')
{
str_copy(aCountry, pCode, 4);
pCode = str_skip_whitespaces(pCode + 4);
pCode = str_skip_whitespaces_const(pCode + 4);
}
else if(str_length(pCode) > 4 && pCode[4] == ' ')
{
str_copy(aCountry, pCode, 5);
pCode = str_skip_whitespaces(pCode + 5);
pCode = str_skip_whitespaces_const(pCode + 5);
}
else
{