mirror of https://github.com/OpenRCT2/OpenRCT2.git
Replace strcasestr() with String::Contains()
This commit is contained in:
parent
aa01e21a55
commit
2f097e99c9
|
@ -785,7 +785,7 @@ private:
|
||||||
Formatter ft;
|
Formatter ft;
|
||||||
peep.FormatNameTo(ft);
|
peep.FormatNameTo(ft);
|
||||||
format_string(name, sizeof(name), STR_STRINGID, ft.Data());
|
format_string(name, sizeof(name), STR_STRINGID, ft.Data());
|
||||||
if (strcasestr(name, _filterName.c_str()) == nullptr)
|
if (!String::Contains(name, _filterName.c_str(), true))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,45 +336,6 @@ char* safe_strcat(char* destination, const char* source, size_t size)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
char* strcasestr(const char* haystack, const char* needle)
|
|
||||||
{
|
|
||||||
const char* p1 = haystack;
|
|
||||||
const char* p2 = needle;
|
|
||||||
const char* r = *p2 == 0 ? haystack : nullptr;
|
|
||||||
|
|
||||||
while (*p1 != 0 && *p2 != 0)
|
|
||||||
{
|
|
||||||
if (tolower(static_cast<unsigned char>(*p1)) == tolower(static_cast<unsigned char>(*p2)))
|
|
||||||
{
|
|
||||||
if (r == nullptr)
|
|
||||||
r = p1;
|
|
||||||
p2++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p2 = needle;
|
|
||||||
if (r != nullptr)
|
|
||||||
p1 = r + 1;
|
|
||||||
|
|
||||||
if (tolower(static_cast<unsigned char>(*p1)) == tolower(static_cast<unsigned char>(*p2)))
|
|
||||||
{
|
|
||||||
r = p1;
|
|
||||||
p2++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
r = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p1++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *p2 == 0 ? const_cast<char*>(r) : nullptr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool str_is_null_or_empty(const char* str)
|
bool str_is_null_or_empty(const char* str)
|
||||||
{
|
{
|
||||||
return str == nullptr || str[0] == 0;
|
return str == nullptr || str[0] == 0;
|
||||||
|
|
|
@ -33,9 +33,6 @@ int32_t bitcount(uint32_t source);
|
||||||
int32_t strlogicalcmp(char const* a, char const* b);
|
int32_t strlogicalcmp(char const* a, char const* b);
|
||||||
char* safe_strcpy(char* destination, const char* source, size_t num);
|
char* safe_strcpy(char* destination, const char* source, size_t num);
|
||||||
char* safe_strcat(char* destination, const char* source, size_t size);
|
char* safe_strcat(char* destination, const char* source, size_t size);
|
||||||
#if defined(_WIN32)
|
|
||||||
char* strcasestr(const char* haystack, const char* needle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool str_is_null_or_empty(const char* str);
|
bool str_is_null_or_empty(const char* str);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue