Merge pull request #2058 from def-/pr-fix-compilation

Fix GCC 9.2.0 compilation
This commit is contained in:
Dennis Felsing 2020-02-11 18:17:40 +01:00 committed by GitHub
commit 5929517941
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
{