From 69bbcfd83d00b36acdc5d71ae8a51a2c7c68ed46 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sun, 21 Jun 2015 00:18:03 +1000 Subject: [PATCH] Convert stripansi() from unsigned char to char This silences a few compiler warnings. This also cleans the function up by removing some always-true checks. I'm not convinced that this function makes a whole lot of sense, though. Will look into it further... --- include/misc.h | 2 +- source/misc.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/misc.h b/include/misc.h index ae9d5bf..33d73f7 100644 --- a/include/misc.h +++ b/include/misc.h @@ -75,7 +75,7 @@ extern LastMsg last_sent_ctcp[2]; void BX_userage (char *, char *); void stats_k_grep_end (void); char *stripansicodes (const char *); - char *stripansi (unsigned char *); + char *stripansi (const char *); NickTab *BX_gettabkey (int, int, char *); void BX_addtabkey (char *, char *, int); void clear_array (NickTab **, char *); diff --git a/source/misc.c b/source/misc.c index 6750895..0dcb7e7 100644 --- a/source/misc.c +++ b/source/misc.c @@ -1065,18 +1065,17 @@ char *mircansi(unsigned char *line) } #endif -char *stripansi(unsigned char *line) +char *stripansi(const char *line) { -register unsigned char *cp; -unsigned char *newline; - newline = m_strdup(line); - for (cp = newline; *cp; cp++) - if ((*cp < 31 && *cp > 13)) - if (*cp != 1 && *cp != 15 && *cp !=22 && *cp != 0x9b) - *cp = (*cp & 127) | 64; - return (char *)newline; -} + char *cp; + char *newline = m_strdup(line); + for (cp = newline; *cp; cp++) + if (*cp < 31 && *cp > 13 && *cp != 15 && *cp != 22) + *cp = (*cp & 127) | 64; + + return newline; +} int check_split(char *nick, char *reason) {