From: Ken Hornstein Date: Thu, 31 Oct 2013 15:36:46 +0000 (-0400) Subject: Switch to the (correct) casting of char to unsigned char for is*() macros. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/c05412e6b606d064d54c6d2a13f511cdc34d71f1?ds=sidebyside;hp=--cc Switch to the (correct) casting of char to unsigned char for is*() macros. --- c05412e6b606d064d54c6d2a13f511cdc34d71f1 diff --git a/sbr/encode_rfc2047.c b/sbr/encode_rfc2047.c index 40bee578..33ed5d87 100644 --- a/sbr/encode_rfc2047.c +++ b/sbr/encode_rfc2047.c @@ -64,9 +64,9 @@ encode_rfc2047(const char *name, char **value, int encoding, */ for (p = *value; *p != '\0'; p++) { - if (isascii((int) *p)) { + if (isascii((unsigned char) *p)) { asciicount++; - if (qpspecial((int) *p)) + if (qpspecial((unsigned char) *p)) qpspecialcount++; } else eightbitcount++; @@ -230,7 +230,7 @@ field_encode_quoted(const char *name, char **value, const char *charset, *q++ = *p; ascii--; } else { - snprintf(q, outlen - (q - output), "=%02X", *((unsigned char *) p)); + snprintf(q, outlen - (q - output), "=%02X", (unsigned char) *p); q += 3; column += 2; /* column already incremented by 1 above */ encoded--; @@ -295,11 +295,11 @@ utf8len(const char *p) if (*p == '\0') return 0; - if (isascii((int) *p) || (*((unsigned char *) p) & 0xc0) == 0x80) + if (isascii((unsigned char) *p) || (((unsigned char) *p) & 0xc0) == 0x80) return 0; p++; - while ((*((unsigned char *) p++) & 0xc0) == 0x80) + while ((((unsigned char) *p++) & 0xc0) == 0x80) len++; return len;