From d9e0300f903aa7cfb85a94480ad544082a7a6c35 Mon Sep 17 00:00:00 2001 From: ben Date: Sun, 11 Jan 2009 14:26:27 +0000 Subject: [PATCH] Arguments to ctype functions are required to be either EOF or representable 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 | 2 +- logging.c | 2 +- terminal.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmdgen.c b/cmdgen.c index 9aa585f3..ae405208 100644 --- 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); } diff --git a/logging.c b/logging.c index db02892a..17924c5a 100644 --- 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; diff --git a/terminal.c b/terminal.c index 19d5a750..4f0d8225 100644 --- a/terminal.c +++ b/terminal.c @@ -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; -- 2.11.0