Apply modernize-use-starts-ends-with

This commit is contained in:
Nicolas van Kempen
2024-04-19 14:24:34 -04:00
parent 1805f6e381
commit 932645f245
4 changed files with 8 additions and 8 deletions

View File

@ -1017,11 +1017,11 @@ bool ESCore::IsIssuerCorrect(VerifyContainerType type, const ES::CertReader& iss
switch (type) switch (type)
{ {
case VerifyContainerType::TMD: case VerifyContainerType::TMD:
return issuer_cert.GetName().compare(0, 2, "CP") == 0; return issuer_cert.GetName().starts_with("CP");
case VerifyContainerType::Ticket: case VerifyContainerType::Ticket:
return issuer_cert.GetName().compare(0, 2, "XS") == 0; return issuer_cert.GetName().starts_with("XS");
case VerifyContainerType::Device: case VerifyContainerType::Device:
return issuer_cert.GetName().compare(0, 2, "MS") == 0; return issuer_cert.GetName().starts_with("MS");
default: default:
return false; return false;
} }

View File

@ -43,7 +43,7 @@ HostFileSystem::HostFilename HostFileSystem::BuildFilename(const std::string& wi
} }
} }
if (wii_path.compare(0, 1, "/") == 0) if (wii_path.starts_with("/"))
return HostFilename{m_root_path + Common::EscapePath(wii_path), false}; return HostFilename{m_root_path + Common::EscapePath(wii_path), false};
ASSERT_MSG(IOS_FS, false, "Invalid Wii path '{}' given to BuildFilename()", wii_path); ASSERT_MSG(IOS_FS, false, "Invalid Wii path '{}' given to BuildFilename()", wii_path);

View File

@ -673,16 +673,16 @@ std::optional<IPCReply> EmulationKernel::OpenDevice(OpenRequest& request)
request.fd = new_fd; request.fd = new_fd;
std::shared_ptr<Device> device; std::shared_ptr<Device> device;
if (request.path.find("/dev/usb/oh0/") == 0 && !GetDeviceByName(request.path) && if (request.path.starts_with("/dev/usb/oh0/") && !GetDeviceByName(request.path) &&
!HasFeature(GetVersion(), Feature::NewUSB)) !HasFeature(GetVersion(), Feature::NewUSB))
{ {
device = std::make_shared<OH0Device>(*this, request.path); device = std::make_shared<OH0Device>(*this, request.path);
} }
else if (request.path.find("/dev/") == 0) else if (request.path.starts_with("/dev/"))
{ {
device = GetDeviceByName(request.path); device = GetDeviceByName(request.path);
} }
else if (request.path.find('/') == 0) else if (request.path.starts_with('/'))
{ {
device = GetDeviceByName("/dev/fs"); device = GetDeviceByName("/dev/fs");
} }

View File

@ -88,7 +88,7 @@ ResourcePack::ResourcePack(const std::string& path) : m_path(path)
unzGetCurrentFileInfo64(file, &texture_info, filename.data(), static_cast<u16>(filename.size()), unzGetCurrentFileInfo64(file, &texture_info, filename.data(), static_cast<u16>(filename.size()),
nullptr, 0, nullptr, 0); nullptr, 0, nullptr, 0);
if (filename.compare(0, 9, "textures/") != 0 || texture_info.uncompressed_size == 0) if (!filename.starts_with("textures/") || texture_info.uncompressed_size == 0)
continue; continue;
// If a texture is compressed and the manifest doesn't state that, abort. // If a texture is compressed and the manifest doesn't state that, abort.