]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Arguments to ctype functions are required to be either EOF or representable
authorBen Harris <bjh21@bjh21.me.uk>
Sun, 11 Jan 2009 14:26:27 +0000 (14:26 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
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.

[originally from svn r8406]

cmdgen.c
logging.c
terminal.c

index 9aa585f3ffefe032aea8b6b47a374f4dbf15933f..ae405208b36ab936b6b555f78ab5d74745952d4a 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 db02892a5742f190dc256e7f3c8f655c22ad1ce5..17924c5a590367d08d060801062cf229b51eaa1d 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 19d5a750972415519f554c118fb6f39af09d6a9a..4f0d82259f30caf70e9117cfb7fbd3b41592954d 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;