From fee82a1a99b707661d95cc455eb8aef3643fc2b4 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sun, 16 Nov 2014 00:59:26 +0000 Subject: ctype macros/functions expect unsigned char values. Note that the lgetc() macro does the cast internally like getc() does, so its return should be put an in int for the same reason. based on a diff from Kamil Rytarowski (n54 (at) gmx.com) --- usr.bin/mg/cscope.c | 4 ++-- usr.bin/mg/extend.c | 4 ++-- usr.bin/mg/grep.c | 5 +++-- usr.bin/mg/tags.c | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/mg/cscope.c b/usr.bin/mg/cscope.c index 0deada3475c..a52a0a9e4f1 100644 --- a/usr.bin/mg/cscope.c +++ b/usr.bin/mg/cscope.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cscope.c,v 1.6 2014/04/10 14:03:57 jsg Exp $ */ +/* $OpenBSD: cscope.c,v 1.7 2014/11/16 00:59:25 guenther Exp $ */ /* * This file is in the public domain. @@ -557,7 +557,7 @@ prettyprint(struct buffer *bp, struct cstokens *t) const char * ltrim(const char *s) { - while (isblank(*s)) + while (isblank((unsigned char)*s)) s++; return s; } diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c index ef59d5f05a7..7a4f0c6a49b 100644 --- a/usr.bin/mg/extend.c +++ b/usr.bin/mg/extend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extend.c,v 1.55 2014/04/02 20:32:00 lum Exp $ */ +/* $OpenBSD: extend.c,v 1.56 2014/11/16 00:59:25 guenther Exp $ */ /* This file is in the public domain. */ @@ -446,7 +446,7 @@ dobindkey(KEYMAP *map, const char *func, const char *str) for (i = 0; *str && i < MAXKEY; i++) { /* XXX - convert numbers w/ strol()? */ if (*str == '^' && *(str + 1) != '\0') { - key.k_chars[i] = CCHR(toupper(*++str)); + key.k_chars[i] = CCHR(toupper((unsigned char)*++str)); } else if (*str == '\\' && *(str + 1) != '\0') { switch (*++str) { case '^': diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c index 6a4c1c4e4aa..fad1aba1fa9 100644 --- a/usr.bin/mg/grep.c +++ b/usr.bin/mg/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.40 2014/03/20 07:47:29 lum Exp $ */ +/* $OpenBSD: grep.c,v 1.41 2014/11/16 00:59:25 guenther Exp $ */ /* This file is in the public domain */ @@ -113,7 +113,8 @@ static int gid(int f, int n) { char command[NFILEN]; - char cprompt[NFILEN], c, *bufp; + char cprompt[NFILEN], *bufp; + int c; struct buffer *bp; struct mgwin *wp; int i, j, len; diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c index ec1f875907b..94a9c300559 100644 --- a/usr.bin/mg/tags.c +++ b/usr.bin/mg/tags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tags.c,v 1.9 2014/03/22 10:00:58 lum Exp $ */ +/* $OpenBSD: tags.c,v 1.10 2014/11/16 00:59:25 guenther Exp $ */ /* * This file is in the public domain. @@ -475,7 +475,7 @@ curtoken(int f, int n, char *token) /* strip away leading whitespace if any like emacs. */ while (ltext(curwp->w_dotp) && - isspace(curwp->w_dotp->l_text[tdoto])) + isspace(lgetc(curwp->w_dotp, tdoto))) tdoto++; size = curwp->w_doto - tdoto; -- cgit v1.2.3