From 40d827aa3efeebee5d3d8b51d9bf135012cf4325 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 2 May 2006 09:38:40 +0000 Subject: [PATCH] Fix ctype carelessnesses. (Thanks to Solaris gcc for bothering to warn me about them. No thanks for Debian for being over-clever as usual.) git-svn-id: svn://svn.tartarus.org/sgt/tweak@6645 cda61777-01e9-0310-a592-d414129be87e --- main.c | 7 ++++--- rcfile.c | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 9875d5a..9940e30 100644 --- a/main.c +++ b/main.c @@ -571,9 +571,9 @@ int get_str (char *prompt, char *buf, int highlight) { p++; if (p=r || !isxdigit (*p)) + else if (p>=r || !isxdigit ((unsigned char)*p)) display_set_colour(COL_INVALID); - else if (p+1>=r || !isxdigit (p[1])) + else if (p+1>=r || !isxdigit ((unsigned char)p[1])) p++, display_set_colour(COL_INVALID); else p+=2, display_set_colour(COL_ESCAPE); @@ -641,7 +641,8 @@ int parse_quoted (char *buffer) { p++; if (*p == '\\') *q++ = *p++; - else if (p[1] && isxdigit(*p) && isxdigit(p[1])) { + else if (p[1] && isxdigit((unsigned char)*p) && + isxdigit((unsigned char)p[1])) { char buf[3]; buf[0] = *p++; buf[1] = *p++; diff --git a/rcfile.c b/rcfile.c index 6f5de8f..68469b6 100644 --- a/rcfile.c +++ b/rcfile.c @@ -207,14 +207,14 @@ void read_rc (void) { * really come from. Process it. */ q = rcbuffer; - while (*q && isspace(*q)) + while (*q && isspace((unsigned char)*q)) q++; if (!*q || *q == '#') continue; /* comment or blank line */ r = q; - while (*r && !isspace(*r)) + while (*r && !isspace((unsigned char)*r)) r++; if (*r) *r++ = '\0'; @@ -231,11 +231,11 @@ void read_rc (void) { */ keyact action; - while (*r && isspace(*r)) + while (*r && isspace((unsigned char)*r)) r++; q = r; - while (*q && !isspace(*q)) + while (*q && !isspace((unsigned char)*q)) q++; if (*q) *q++ = '\0'; @@ -268,7 +268,8 @@ void read_rc (void) { errors_here = TRUE; } else if (*q == '\\' || *q == '^') { *s++ = *q++; - } else if (isxdigit(*q) && q[1] && isxdigit(q[1])) { + } else if (isxdigit((unsigned char)*q) && + q[1] && isxdigit((unsigned char)q[1])) { char buf[3]; buf[0] = *q++; buf[1] = *q++; -- 2.11.0