Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/sdiff sdiff: fix undefined behavior for ctype functions
details: https://anonhg.NetBSD.org/src/rev/350b726e38d8
branches: trunk
changeset: 1023143:350b726e38d8
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Aug 27 17:38:57 2021 +0000
description:
sdiff: fix undefined behavior for ctype functions
lint says: warning: argument to 'function from <ctype.h>' must be cast
to 'unsigned char', not to 'int' [342]
diffstat:
usr.bin/sdiff/sdiff.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r a6ad432a4215 -r 350b726e38d8 usr.bin/sdiff/sdiff.c
--- a/usr.bin/sdiff/sdiff.c Fri Aug 27 17:36:37 2021 +0000
+++ b/usr.bin/sdiff/sdiff.c Fri Aug 27 17:38:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdiff.c,v 1.2 2009/04/13 07:19:55 lukem Exp $ */
+/* $NetBSD: sdiff.c,v 1.3 2021/08/27 17:38:57 rillig Exp $ */
/* $OpenBSD: sdiff.c,v 1.20 2006/09/19 05:52:23 otto Exp $ */
/*
@@ -423,7 +423,7 @@
const char *p;
/* Skip leading whitespace. */
- for (p = cmd; isspace((int)(*p)); ++p)
+ for (p = cmd; isspace((unsigned char)(*p)); ++p)
;
switch (*p) {
@@ -579,7 +579,7 @@
p = line;
/* Go to character after line number. */
- while (isdigit((int)(*p)))
+ while (isdigit((unsigned char)(*p)))
++p;
c = *p;
*p++ = 0;
@@ -592,7 +592,7 @@
q = p;
/* Go to character after file2end. */
- while (isdigit((int)(*p)))
+ while (isdigit((unsigned char)(*p)))
++p;
c = *p;
*p++ = 0;
@@ -612,7 +612,7 @@
q = p;
/* Go to character after line number. */
- while (isdigit((int)(*p)))
+ while (isdigit((unsigned char)(*p)))
++p;
c = *p;
*p++ = 0;
Home |
Main Index |
Thread Index |
Old Index