From cb40a3d3525518eeb5f3f4584f4c87d935f00dc1 Mon Sep 17 00:00:00 2001 From: mmcc Date: Sat, 24 Oct 2015 18:49:39 +0000 Subject: [PATCH] Cast ctype functions' argument to unsigned char. ok guenther@ --- games/hack/hack.objnam.c | 10 +++++----- games/hack/hack.trap.c | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c index db58dafb13b..d336eca0323 100644 --- a/games/hack/hack.objnam.c +++ b/games/hack/hack.objnam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.objnam.c,v 1.9 2009/10/27 23:59:25 deraadt Exp $ */ +/* $OpenBSD: hack.objnam.c,v 1.10 2015/10/24 18:49:39 mmcc Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -449,9 +449,9 @@ readobjnam(char *bp, size_t len) cnt = 1; cp += 2; } - if(!cnt && isdigit(*cp)){ + if(!cnt && isdigit((unsigned char)*cp)){ cnt = atoi(cp); - while(isdigit(*cp)) cp++; + while(isdigit((unsigned char)*cp)) cp++; while(*cp == ' ') cp++; } if(!cnt) cnt = 1; /* %% what with "gems" etc. ? */ @@ -459,7 +459,7 @@ readobjnam(char *bp, size_t len) if(*cp == '+' || *cp == '-'){ spesgn = (*cp++ == '+') ? 1 : -1; spe = atoi(cp); - while(isdigit(*cp)) cp++; + while(isdigit((unsigned char)*cp)) cp++; while(*cp == ' ') cp++; } else { p = strrchr(cp, '('); @@ -468,7 +468,7 @@ readobjnam(char *bp, size_t len) else *p = 0; p++; spe = atoi(p); - while(isdigit(*p)) p++; + while(isdigit((unsigned char)*p)) p++; if(strcmp(p, ")")) spe = 0; else spesgn = 1; } diff --git a/games/hack/hack.trap.c b/games/hack/hack.trap.c index 24188d916aa..234055e336c 100644 --- a/games/hack/hack.trap.c +++ b/games/hack/hack.trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.trap.c,v 1.7 2009/10/27 23:59:25 deraadt Exp $ */ +/* $OpenBSD: hack.trap.c,v 1.8 2015/10/24 18:49:39 mmcc Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -476,7 +476,8 @@ level_tele() do { pline("To what level do you want to teleport? [type a number] "); getlin(buf); - } while(!isdigit(buf[0]) && (buf[0] != '-' || !isdigit(buf[1]))); + } while(!isdigit((unsigned char)buf[0]) && + (buf[0] != '-' || !isdigit((unsigned char)buf[1]))); newlevel = atoi(buf); } else { newlevel = 5 + rn2(20); /* 5 - 24 */ -- 2.20.1