mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-12 02:08:45 +00:00
Misc: Use compareNoCase instead of Strncasecmp
Strncasecmp("a", "ab", 1) returns true, which isn't what we want
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user