Add casts for the two remaining tolower() uses, since
tolower() is undefined for negative character values (except for -1). Also simplify the existing casts for tolower() usages.
This commit is contained in:
parent
6bd4e258d0
commit
081ad7c08c
@ -58,10 +58,10 @@ static int cJSON_strcasecmp( const char *s1, const char *s2 )
|
|||||||
return ( s1 == s2 ) ? 0 : 1;
|
return ( s1 == s2 ) ? 0 : 1;
|
||||||
if ( ! s2 )
|
if ( ! s2 )
|
||||||
return 1;
|
return 1;
|
||||||
for ( ; tolower(*s1) == tolower(*s2); ++s1, ++s2)
|
for ( ; tolower((u_char)*s1) == tolower((u_char)*s2); ++s1, ++s2)
|
||||||
if( *s1 == 0 )
|
if( *s1 == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
|
return tolower((u_char)*s1) - tolower((u_char)*s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user