ctype functions require their argument to be EOF or representable as an
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 11 Jan 2009 14:17:57 +0000 (14:17 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 11 Jan 2009 14:17:57 +0000 (14:17 +0000)
unsigned char.  On platforms were char is signed, passing plain char won't
cut it.  Make sure we case chars to unsigned char before passing them to
tolower().

git-svn-id: svn://svn.tartarus.org/sgt/charset@8404 cda61777-01e9-0310-a592-d414129be87e

emacsenc.c
localenc.c
mimeenc.c
xenc.c

index f1046bb..ac49939 100644 (file)
@@ -118,7 +118,7 @@ int charset_from_emacsenc(const char *name)
        p = name;
        q = emacsencs[i].name;
        while (*p || *q) {
-           if (tolower(*p) != tolower(*q))
+               if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
                break;
            p++; q++;
        }
index f462729..cd08cab 100644 (file)
@@ -156,7 +156,7 @@ int charset_from_localenc(const char *name)
        p = name;
        q = localencs[i].name;
        while (*p || *q) {
-           if (tolower(*p) != tolower(*q))
+               if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
                break;
            p++; q++;
        }
index e0ace12..d3471d0 100644 (file)
--- a/mimeenc.c
+++ b/mimeenc.c
@@ -323,7 +323,7 @@ int charset_from_mimeenc(const char *name)
        p = name;
        q = mimeencs[i].name;
        while (*p || *q) {
-           if (tolower(*p) != tolower(*q))
+               if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
                break;
            p++; q++;
        }
diff --git a/xenc.c b/xenc.c
index d27dafb..ba1c283 100644 (file)
--- a/xenc.c
+++ b/xenc.c
@@ -83,7 +83,7 @@ int charset_from_xenc(const char *name)
        p = name;
        q = xencs[i].name;
        while (*p || *q) {
-           if (tolower(*p) != tolower(*q))
+               if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
                break;
            p++; q++;
        }