diff --git a/include/misc.h b/include/misc.h index 48a891c..fa5402a 100644 --- a/include/misc.h +++ b/include/misc.h @@ -74,7 +74,7 @@ extern LastMsg last_sent_ctcp[2]; int check_split (char *, char *); void BX_userage (char *, char *); void stats_k_grep_end (void); - char *stripansicodes (const unsigned char *); + char *stripansicodes (const char *); char *stripansi (unsigned char *); NickTab *BX_gettabkey (int, int, char *); void BX_addtabkey (char *, char *, int); diff --git a/source/misc.c b/source/misc.c index c357158..8d5c563 100644 --- a/source/misc.c +++ b/source/misc.c @@ -1026,19 +1026,21 @@ struct { #endif /* Borrowed with permission from FLiER */ -char *stripansicodes(const unsigned char *line) +char *stripansicodes(const char *line) { -register unsigned char *tstr; -register unsigned char *nstr; -int gotansi=0; + const char *tstr = line; + char *nstr = (char *)newline1; + int gotansi = 0; - tstr=(char *)line; - nstr=newline1; while (*tstr) { - if (*tstr==0x1B || *tstr == 0x9b) - gotansi=1; - if (gotansi && isalpha(*tstr)) + /* Note that we use '\x9b' here, rather than 0x9b, because the + * former will have the correct value whether or not char is + * signed. + */ + if (*tstr == '\x1b' || *tstr == '\x9b') + gotansi = 1; + if (gotansi && isalpha((unsigned char)*tstr)) gotansi = 0; else if (!gotansi) { @@ -1051,7 +1053,7 @@ int gotansi=0; return (char *)newline1; } #else -char *stripansicodes(const unsigned char *line) +char *stripansicodes(const char *line) { return line; } diff --git a/source/status.c b/source/status.c index c260dab..cac5479 100644 --- a/source/status.c +++ b/source/status.c @@ -935,7 +935,7 @@ void make_status(Window *win) strcmp(buffer, win->wset->status_line[status_line])) { - unsigned char *st = NULL; + char *st = NULL; malloc_strcpy(&win->wset->status_line[status_line], buffer); output_screen = win->screen; st = cparse((line==3)?FORMAT_STATUS3_FSET:(line==2)?FORMAT_STATUS2_FSET:(line==1)?FORMAT_STATUS1_FSET:FORMAT_STATUS_FSET, buffer);