Arguments to ctype functions are required to be either EOF or representable
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 11 Jan 2009 14:26:27 +0000 (14:26 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Sun, 11 Jan 2009 14:26:27 +0000 (14:26 +0000)
as unsigned char.  This means that passing in a bare char is incorrect on
systems where char is signed.  Sprinkle some appropriate casts to prevent
this.

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

cmdgen.c
logging.c
terminal.c

index 9aa585f..ae40520 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -119,7 +119,7 @@ void sk_cleanup(void)
 void showversion(void)
 {
     char *verstr = dupstr(ver);
-    verstr[0] = tolower(verstr[0]);
+    verstr[0] = tolower((unsigned char)verstr[0]);
     printf("PuTTYgen %s\n", verstr);
     sfree(verstr);
 }
index db02892..17924c5 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -384,7 +384,7 @@ static void xlatlognam(Filename *dest, Filename src,
            char c;
            s++;
            size = 0;
-           if (*s) switch (c = *s++, tolower(c)) {
+           if (*s) switch (c = *s++, tolower((unsigned char)c)) {
              case 'y':
                size = strftime(buf, sizeof(buf), "%Y", tm);
                break;
index 19d5a75..4f0d822 100644 (file)
@@ -5942,7 +5942,7 @@ void term_key(Terminal *term, Key_Sym keysym, wchar_t *text, size_t tlen,
                if (modifiers & PKM_CONTROL)
                    c &= 0x1f;
                else if (modifiers & PKM_SHIFT)
-                   c = toupper(c);
+                       c = toupper((unsigned char)c);
            }
            *p++ = c;
            goto done;