1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +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:
2024-10-26 21:01:33 +01:00
committed by GitHub
parent 1191efa581
commit bb8a0c7641

View File

@@ -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;
}