if(*s == STRING_COLOR_TAG)
{
if(s[1] <= '9' && s[1] >= '0') // ^[0-9] found
- {
return 2;
- }
- else if(s[1] == STRING_COLOR_RGB_TAG_CHAR &&
- ((s[2] >= '0' && s[2] <= '9') || (s[2] >= 'a' && s[2] <= 'f') || (s[2] >= 'A' && s[2] <= 'F')) &&
- ((s[3] >= '0' && s[3] <= '9') || (s[3] >= 'a' && s[3] <= 'f') || (s[3] >= 'A' && s[3] <= 'F')) &&
- ((s[4] >= '0' && s[4] <= '9') || (s[4] >= 'a' && s[4] <= 'f') || (s[4] >= 'A' && s[4] <= 'F')))
- {
+ else if(s[1] == STRING_COLOR_RGB_TAG_CHAR && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]))
return 5;
- }
else if(s[1] == STRING_COLOR_TAG)
- {
return 1; // special case, do NOT call colorcode_skipwidth for next char
- }
}
return 0;
}
{
case 0:
if(valid)
- *valid = TRUE;
+ *valid = true;
return len;
case STRING_COLOR_TAG:
++s;
case 0: // ends with unfinished color code!
++len;
if(valid)
- *valid = FALSE;
+ *valid = false;
return len;
case STRING_COLOR_TAG: // escaped ^
++len;
{
// we CAN end up here, if an invalid char is between this one and the end of the string
if(valid)
- *valid = TRUE;
+ *valid = true;
return len;
}
{
// string length exceeded by new character
if(valid)
- *valid = TRUE;
+ *valid = true;
return len;
}