[Bug 377] New: Reduce compiler warnings. Use unsigned args to the ctype.h is*() macros.

Mark D. Baushke mdb at juniper.net
Fri Aug 2 22:59:34 EST 2002


The patch in the bug report seems to have been mangled.
Here is a cleaner copy.

	-- Mark

Index: canohost.c
===================================================================
RCS file: /cvs/openssh/canohost.c,v
retrieving revision 1.30
diff -u -p -r1.30 canohost.c
--- canohost.c	11 Jul 2002 03:56:47 -0000	1.30
+++ canohost.c	2 Aug 2002 12:13:37 -0000
@@ -90,7 +90,7 @@ get_remote_hostname(int socket, int veri
 	 * of this software).
 	 */
 	for (i = 0; name[i]; i++)
-		if (isupper(name[i]))
+		if (isupper((unsigned)name[i]))
 			name[i] = tolower(name[i]);
 
 	if (!verify_reverse_mapping)
Index: clientloop.c
===================================================================
RCS file: /cvs/openssh/clientloop.c,v
retrieving revision 1.87
diff -u -p -r1.87 clientloop.c
--- clientloop.c	4 Jul 2002 00:14:18 -0000	1.87
+++ clientloop.c	2 Aug 2002 12:13:38 -0000
@@ -485,7 +485,7 @@ process_cmdline(void)
 	cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
 	if (s == NULL)
 		goto out;
-	while (*s && isspace(*s))
+	while (*s && isspace((unsigned)*s))
 		s++;
 	if (*s == 0)
 		goto out;
@@ -500,7 +500,7 @@ process_cmdline(void)
 		goto out;
 	}
 	s += 2;
-	while (*s && isspace(*s))
+	while (*s && isspace((unsigned)*s))
 		s++;
 
 	if (sscanf(s, "%5[0-9]:%255[^:]:%5[0-9]",
Index: match.c
===================================================================
RCS file: /cvs/openssh/match.c,v
retrieving revision 1.18
diff -u -p -r1.18 match.c
--- match.c	5 Mar 2002 01:42:43 -0000	1.18
+++ match.c	2 Aug 2002 12:13:39 -0000
@@ -135,7 +135,7 @@ match_pattern_list(const char *string, c
 		for (subi = 0;
 		    i < len && subi < sizeof(sub) - 1 && pattern[i] != ',';
 		    subi++, i++)
-			sub[subi] = dolower && isupper(pattern[i]) ?
+			sub[subi] = dolower && isupper((unsigned)pattern[i]) ?
 			    tolower(pattern[i]) : pattern[i];
 		/* If subpattern too long, return failure (no match). */
 		if (subi >= sizeof(sub) - 1)
Index: scp.c
===================================================================
RCS file: /cvs/openssh/scp.c,v
retrieving revision 1.97
diff -u -p -r1.97 scp.c
--- scp.c	21 Jun 2002 00:41:52 -0000	1.97
+++ scp.c	2 Aug 2002 12:13:43 -0000
@@ -755,7 +755,7 @@ sink(argc, argv)
 		if (*cp++ != ' ')
 			SCREWUP("mode not delimited");
 
-		for (size = 0; isdigit(*cp);)
+		for (size = 0; isdigit((unsigned)*cp);)
 			size = size * 10 + (*cp++ - '0');
 		if (*cp++ != ' ')
 			SCREWUP("size not delimited");
Index: sshconnect.c
===================================================================
RCS file: /cvs/openssh/sshconnect.c,v
retrieving revision 1.99
diff -u -p -r1.99 sshconnect.c
--- sshconnect.c	1 Aug 2002 01:26:30 -0000	1.99
+++ sshconnect.c	2 Aug 2002 12:13:44 -0000
@@ -831,7 +831,7 @@ ssh_login(Sensitive *sensitive, const ch
 	/* Convert the user-supplied hostname into all lowercase. */
 	host = xstrdup(orighost);
 	for (cp = host; *cp; cp++)
-		if (isupper(*cp))
+		if (isupper((unsigned)*cp))
 			*cp = tolower(*cp);
 
 	/* Exchange protocol version identification strings with the server. */
Index: openbsd-compat/inet_aton.c
===================================================================
RCS file: /cvs/openssh/openbsd-compat/inet_aton.c,v
retrieving revision 1.4
diff -u -p -r1.4 inet_aton.c
--- openbsd-compat/inet_aton.c	12 Apr 2002 03:35:40 -0000	1.4
+++ openbsd-compat/inet_aton.c	2 Aug 2002 12:13:44 -0000
@@ -103,7 +103,7 @@ inet_aton(const char *cp, struct in_addr
 {
 	register u_int32_t val;
 	register int base, n;
-	register char c;
+	register unsigned char c;
 	unsigned int parts[4];
 	register unsigned int *pp = parts;
 
Index: openbsd-compat/mktemp.c
===================================================================
RCS file: /cvs/openssh/openbsd-compat/mktemp.c,v
retrieving revision 1.2
diff -u -p -r1.2 mktemp.c
--- openbsd-compat/mktemp.c	13 Feb 2002 05:00:16 -0000	1.2
+++ openbsd-compat/mktemp.c	2 Aug 2002 12:13:44 -0000
@@ -165,7 +165,7 @@ _gettemp(path, doopen, domkdir, slen)
 					return (0);
 				*trv++ = 'a';
 			} else {
-				if (isdigit(*trv))
+				if (isdigit((unsigned)*trv))
 					*trv = 'a';
 				else if (*trv == 'z')	/* inc from z to A */
 					*trv = 'A';
Index: openbsd-compat/readpassphrase.c
===================================================================
RCS file: /cvs/openssh/openbsd-compat/readpassphrase.c,v
retrieving revision 1.8
diff -u -p -r1.8 readpassphrase.c
--- openbsd-compat/readpassphrase.c	1 May 2002 12:00:22 -0000	1.8
+++ openbsd-compat/readpassphrase.c	2 Aug 2002 12:13:44 -0000
@@ -120,7 +120,7 @@ restart:
 		if (p < end) {
 			if ((flags & RPP_SEVENBIT))
 				ch &= 0x7f;
-			if (isalpha(ch)) {
+			if (isalpha((unsigned)ch)) {
 				if ((flags & RPP_FORCELOWER))
 					ch = tolower(ch);
 				if ((flags & RPP_FORCEUPPER))



More information about the openssh-unix-dev mailing list