]> Pileus Git - ~andy/fetchmail/commitdiff
Properly cast arguments of ctype is*()/to*() functions to unsigned char.
authorMatthias Andree <matthias.andree@gmx.de>
Sun, 25 Sep 2005 10:34:35 +0000 (10:34 -0000)
committerMatthias Andree <matthias.andree@gmx.de>
Sun, 25 Sep 2005 10:34:35 +0000 (10:34 -0000)
svn path=/trunk/; revision=4324

base64.c
imap.c
kerberos.c
strcasecmp.c

index 03c6db44dde353c8baeefb7c776acf422ad723ce..21e1db9eb8a4875573b331f6de942c4e329e8331 100644 (file)
--- a/base64.c
+++ b/base64.c
@@ -25,7 +25,7 @@ static const char base64val[] = {
     BAD, 26, 27, 28,  29, 30, 31, 32,  33, 34, 35, 36,  37, 38, 39, 40,
      41, 42, 43, 44,  45, 46, 47, 48,  49, 50, 51,BAD, BAD,BAD,BAD,BAD
 };
-#define DECODE64(c)  (isascii(c) ? base64val[c] : BAD)
+#define DECODE64(c)  (isascii((unsigned char)(c)) ? base64val[c] : BAD)
 
 void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
diff --git a/imap.c b/imap.c
index 544d720e931c52f1d95f343135a6de96439e8bef..c76decc00091a8824b6bbd9cd2f1d857e54064bd 100644 (file)
--- a/imap.c
+++ b/imap.c
@@ -272,7 +272,7 @@ static void capa_probe(int sock, struct query *ctl)
 
        /* capability checks are supposed to be caseblind */
        for (cp = capabilities; *cp; cp++)
-           *cp = toupper(*cp);
+           *cp = toupper((unsigned char)*cp);
 
        /* UW-IMAP server 10.173 notifies in all caps, but RFC2060 says we
           should expect a response in mixed-case */
@@ -846,7 +846,7 @@ static int imap_getpartialsizes(int sock, int first, int last, int *sizes)
            return(ok);
        /* we want response matching to be case-insensitive */
        for (cp = buf; *cp; cp++)
-           *cp = toupper(*cp);
+           *cp = toupper((unsigned char)*cp);
        /* an untagged NO means that a message was not readable */
        if (strstr(buf, "* NO"))
            ;
index 2cbfe8c1c2eef90045ed3240d6f76ddf8df1e975..b329b12ff7e53818462990e6f65ab9c0dcf272b5 100644 (file)
@@ -96,8 +96,8 @@ int do_rfc1731(int sock, char *command, char *truename)
     strncpy(srvinst, truename, (sizeof srvinst)-1);
     srvinst[(sizeof srvinst)-1] = '\0';
     for (p = srvinst; *p; p++) {
-      if (isupper(*p)) {
-       *p = tolower(*p);
+      if (isupper((unsigned char)*p)) {
+       *p = tolower((unsigned char)*p);
       }
     }
 
index c1f3bbd82296d3ab9b41ab586950b7116327cd2d..76ab9be3eb8087b851d65896b85b5a282945e5bc 100644 (file)
@@ -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));
 }