Misc: Use compareNoCase instead of Strncasecmp

Strncasecmp("a", "ab", 1) returns true, which isn't what we want
This commit is contained in:
TellowKrinkle
2026-10-07 14:10:46 -04:00
committed by Ty
parent d3d48a757b
commit d3a1eee5e7
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ static const FormatHandler* GetFormatHandler(const std::string_view extension)
{
for (const FormatHandler& handler : s_format_handlers)
{
if (StringUtil::Strncasecmp(extension.data(), handler.extension, extension.size()) == 0)
if (StringUtil::compareNoCase(extension, handler.extension))
return &handler;
}
@@ -36,7 +36,7 @@ GSTextureReplacements::ReplacementTextureLoader GSTextureReplacements::GetLoader
for (const LoaderDefinition& defn : s_loaders)
{
if (StringUtil::Strncasecmp(extension.data(), defn.extension, extension.size()) == 0)
if (StringUtil::compareNoCase(extension, defn.extension))
return defn.loader;
}
@@ -451,7 +451,7 @@ void GSTextureReplacements::ReloadReplacementMap()
// file format we can handle?
const char* filename = Path::GetFileName(fd.FileName).data(); // GetFileName takes a substring from the end, so the null terminator is preserved
std::string_view ext = Path::GetExtension(filename);
if (ext.size() == 3 && 0 == StringUtil::Strncasecmp(ext.data(), "zip", 3))
if (StringUtil::compareNoCase(ext, "zip"))
{
zip_error_t ze = {};
auto zf = zip_open_managed(fd.FileName.c_str(), ZIP_RDONLY, &ze);