Cleanup: remove str_strip_colours; StrMakeValid also removes the colours

Essentially str_strip_colours followed by StrMakeValid makes the calling of
str_strip_colours useless, as StrMakeValid would have removed them too.
This commit is contained in:
Rubidium
2023-06-08 17:05:57 +02:00
committed by rubidium42
parent 35ef6c1723
commit e762855201
3 changed files with 0 additions and 25 deletions

View File

@@ -423,29 +423,6 @@ bool StrEqualsIgnoreCase(const std::string_view str1, const std::string_view str
return StrCompareIgnoreCase(str1, str2) == 0;
}
/** Scans the string for colour codes and strips them */
void str_strip_colours(char *str)
{
char *dst = str;
WChar c;
size_t len;
for (len = Utf8Decode(&c, str); c != '\0'; len = Utf8Decode(&c, str)) {
if (c < SCC_BLUE || c > SCC_BLACK) {
/* Copy the character back. Even if dst is current the same as str
* (i.e. no characters have been changed) this is quicker than
* moving the pointers ahead by len */
do {
*dst++ = *str++;
} while (--len != 0);
} else {
/* Just skip (strip) the colour codes */
str += len;
}
}
*dst = '\0';
}
/**
* Get the length of an UTF-8 encoded string in number of characters
* and thus not the number of bytes that the encoded string contains.