diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-09-25 10:34:35 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-09-25 10:34:35 +0000 |
commit | 9084f49286547cdd9043015b8c2088c1c7dc27bd (patch) | |
tree | 3cc9e92b74565df8fe3d60ea7628edca69639cf4 /strcasecmp.c | |
parent | 39b9add3ccc3aabad2382b06d4fbdbae41f53e63 (diff) | |
download | fetchmail-9084f49286547cdd9043015b8c2088c1c7dc27bd.tar.gz fetchmail-9084f49286547cdd9043015b8c2088c1c7dc27bd.tar.bz2 fetchmail-9084f49286547cdd9043015b8c2088c1c7dc27bd.zip |
Properly cast arguments of ctype is*()/to*() functions to unsigned char.
svn path=/trunk/; revision=4324
Diffstat (limited to 'strcasecmp.c')
-rw-r--r-- | strcasecmp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/strcasecmp.c b/strcasecmp.c index c1f3bbd8..76ab9be3 100644 --- a/strcasecmp.c +++ b/strcasecmp.c @@ -6,18 +6,18 @@ */ #include <ctype.h> -strcasecmp(char *s1, char *s2) +int strcasecmp(char *s1, char *s2) { - while (toupper(*s1) == toupper(*s2++)) + while (toupper((unsigned char)*s1) == toupper((unsigned char)*s2++)) if (*s1++ == '\0') - return(0); - return(toupper(*s1) - toupper(*--s2)); + return 0; + return(toupper((unsigned char)*s1) - toupper((unsigned char)*--s2)); } -strncasecmp(char *s1, char *s2, register int n) +int strncasecmp(char *s1, char *s2, register int n) { - while (--n >= 0 && toupper(*s1) == toupper(*s2++)) - if (toupper(*s1++) == '\0') - return(0); - return(n < 0 ? 0 : toupper(*s1) - toupper(*--s2)); + while (--n >= 0 && toupper((unsigned char)*s1) == toupper((unsigned char)*s2++)) + if (*s1++ == '\0') + return 0; + return(n < 0 ? 0 : toupper((unsigned char)*s1) - toupper((unsigned char)*--s2)); } |