1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-22 14:39:24 -05:00

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.

[originally from svn r8406]
This commit is contained in:
Ben Harris 2009-01-11 14:26:27 +00:00
parent 91496d37c7
commit 36f502fa93
3 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ void sk_cleanup(void)
void showversion(void) void showversion(void)
{ {
char *verstr = dupstr(ver); char *verstr = dupstr(ver);
verstr[0] = tolower(verstr[0]); verstr[0] = tolower((unsigned char)verstr[0]);
printf("PuTTYgen %s\n", verstr); printf("PuTTYgen %s\n", verstr);
sfree(verstr); sfree(verstr);
} }

View File

@ -384,7 +384,7 @@ static void xlatlognam(Filename *dest, Filename src,
char c; char c;
s++; s++;
size = 0; size = 0;
if (*s) switch (c = *s++, tolower(c)) { if (*s) switch (c = *s++, tolower((unsigned char)c)) {
case 'y': case 'y':
size = strftime(buf, sizeof(buf), "%Y", tm); size = strftime(buf, sizeof(buf), "%Y", tm);
break; break;

View File

@ -5942,7 +5942,7 @@ void term_key(Terminal *term, Key_Sym keysym, wchar_t *text, size_t tlen,
if (modifiers & PKM_CONTROL) if (modifiers & PKM_CONTROL)
c &= 0x1f; c &= 0x1f;
else if (modifiers & PKM_SHIFT) else if (modifiers & PKM_SHIFT)
c = toupper(c); c = toupper((unsigned char)c);
} }
*p++ = c; *p++ = c;
goto done; goto done;