From ffc47002c5a263357f88148528c3aa69712f5d32 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 31 Mar 2006 05:36:37 +0000 Subject: (char)to{upper,lower}() --- lib/libc/gen/fnmatch.c | 8 ++++---- lib/libc/gen/readpassphrase.c | 6 +++--- lib/libc/net/nsap_addr.c | 8 ++++---- lib/libc/regex/regcomp.c | 6 +++--- lib/libc/string/strcasestr.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c index 551ba56419e..5a282f1e596 100644 --- a/lib/libc/gen/fnmatch.c +++ b/lib/libc/gen/fnmatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fnmatch.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: fnmatch.c,v 1.13 2006/03/31 05:34:14 deraadt Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -167,7 +167,7 @@ rangematch(const char *pattern, char test, int flags, char **newp) ++pattern; if (flags & FNM_CASEFOLD) - test = tolower((unsigned char)test); + test = (char)tolower((unsigned char)test); /* * A right bracket shall lose its special meaning and represent @@ -184,7 +184,7 @@ rangematch(const char *pattern, char test, int flags, char **newp) if (c == '/' && (flags & FNM_PATHNAME)) return (RANGE_NOMATCH); if ((flags & FNM_CASEFOLD)) - c = tolower((unsigned char)c); + c = (char)tolower((unsigned char)c); if (*pattern == '-' && (c2 = *(pattern+1)) != EOS && c2 != ']') { pattern += 2; @@ -193,7 +193,7 @@ rangematch(const char *pattern, char test, int flags, char **newp) if (c2 == EOS) return (RANGE_ERROR); if (flags & FNM_CASEFOLD) - c2 = tolower((unsigned char)c2); + c2 = (char)tolower((unsigned char)c2); if (c <= test && test <= c2) ok = 1; } else if (c == test) diff --git a/lib/libc/gen/readpassphrase.c b/lib/libc/gen/readpassphrase.c index 8e6dde432c4..860494054ce 100644 --- a/lib/libc/gen/readpassphrase.c +++ b/lib/libc/gen/readpassphrase.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readpassphrase.c,v 1.18 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: readpassphrase.c,v 1.19 2006/03/31 05:33:59 deraadt Exp $ */ /* * Copyright (c) 2000-2002 Todd C. Miller @@ -109,9 +109,9 @@ restart: ch &= 0x7f; if (isalpha(ch)) { if ((flags & RPP_FORCELOWER)) - ch = tolower(ch); + ch = (char)tolower(ch); if ((flags & RPP_FORCEUPPER)) - ch = toupper(ch); + ch = (char)toupper(ch); } *p++ = ch; } diff --git a/lib/libc/net/nsap_addr.c b/lib/libc/net/nsap_addr.c index 50e3bdda95d..8cfe86f4752 100644 --- a/lib/libc/net/nsap_addr.c +++ b/lib/libc/net/nsap_addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nsap_addr.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ +/* $OpenBSD: nsap_addr.c,v 1.7 2006/03/31 05:35:44 deraadt Exp $ */ /* * Copyright (c) 1996 by Internet Software Consortium. @@ -25,7 +25,7 @@ #include #include -static char +static u_char xtob(int c) { return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); @@ -43,11 +43,11 @@ inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) if (!isascii(c)) return (0); if (islower(c)) - c = toupper(c); + c = (u_char)toupper(c); if (isxdigit(c)) { nib = xtob(c); if ((c = *ascii++)) { - c = toupper(c); + c = (u_char)toupper(c); if (isxdigit(c)) { *binary++ = (nib << 4) | xtob(c); len++; diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index ad65f3622b8..402c64056f3 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regcomp.c,v 1.15 2005/08/05 13:03:00 espie Exp $ */ +/* $OpenBSD: regcomp.c,v 1.16 2006/03/31 05:36:36 deraadt Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -856,9 +856,9 @@ othercase(int ch) ch = (uch)ch; assert(isalpha(ch)); if (isupper(ch)) - return(tolower(ch)); + return ((uch)tolower(ch)); else if (islower(ch)) - return(toupper(ch)); + return ((uch)toupper(ch)); else /* peculiar, but could happen */ return(ch); } diff --git a/lib/libc/string/strcasestr.c b/lib/libc/string/strcasestr.c index 07c8c2e8fb3..aa74c0176dc 100644 --- a/lib/libc/string/strcasestr.c +++ b/lib/libc/string/strcasestr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcasestr.c,v 1.2 2005/08/08 08:05:37 espie Exp $ */ +/* $OpenBSD: strcasestr.c,v 1.3 2006/03/31 05:34:55 deraadt Exp $ */ /* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */ /*- @@ -46,7 +46,7 @@ strcasestr(const char *s, const char *find) size_t len; if ((c = *find++) != 0) { - c = tolower((unsigned char)c); + c = (char)tolower((unsigned char)c); len = strlen(find); do { do { -- cgit v1.2.3