forked from alterware/iw6-mod
Fixed two bugs in the old color strip function.
This commit is contained in:
parent
e5a547650c
commit
50aa4097bb
@ -115,13 +115,13 @@ namespace utils::string
|
|||||||
|
|
||||||
void strip(const char* in, char* out, size_t max)
|
void strip(const char* in, char* out, size_t max)
|
||||||
{
|
{
|
||||||
if (!in || !out) return;
|
if (!in || !out || !max) return;
|
||||||
|
|
||||||
max--;
|
max--;
|
||||||
auto current = 0u;
|
auto current = 0u;
|
||||||
while (*in != 0 && current < max)
|
while (*in != 0 && current < max)
|
||||||
{
|
{
|
||||||
const auto color_index = (*(in + 1) - 48) >= 0xC ? 7 : (*(in + 1) - 48);
|
const auto color_index = (static_cast<size_t>(*(in + 1) - 48)) >= 0xC ? 7 : (*(in + 1) - 48);
|
||||||
|
|
||||||
if (*in == '^' && (color_index != 7 || *(in + 1) == '7'))
|
if (*in == '^' && (color_index != 7 || *(in + 1) == '7'))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user