mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 11:23:21 +00:00
Fix: SkipGarbage() skipped all multi-byte utf-8 characters. (#13032)
`char` is signed so `str[0] < '0'` applies to all characters higher than 127.
This commit is contained in:
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user