mirror of https://github.com/OpenTTD/OpenTTD
Fix: SkipGarbage() skipped all multi-byte utf-8 characters. (#13032)
`char` is signed so `str[0] < '0'` applies to all characters higher than 127.pull/12996/head
parent
1191efa581
commit
bb8a0c7641
|
@ -551,7 +551,7 @@ char *strcasestr(const char *haystack, const char *needle)
|
||||||
*/
|
*/
|
||||||
static std::string_view SkipGarbage(std::string_view str)
|
static std::string_view SkipGarbage(std::string_view str)
|
||||||
{
|
{
|
||||||
while (!str.empty() && (str[0] < '0' || IsInsideMM(str[0], ';', '@' + 1) || IsInsideMM(str[0], '[', '`' + 1) || IsInsideMM(str[0], '{', '~' + 1))) str.remove_prefix(1);
|
while (!str.empty() && (static_cast<uint8_t>(str[0]) < '0' || IsInsideMM(str[0], ';', '@' + 1) || IsInsideMM(str[0], '[', '`' + 1) || IsInsideMM(str[0], '{', '~' + 1))) str.remove_prefix(1);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue