Misc: Remove StringUtil::{Starts,Ends}With, use C++20
This commit is contained in:
@ -306,7 +306,7 @@ std::string ProcessPacket(const std::string_view& data)
|
||||
// Try to invoke packet command.
|
||||
bool processed = false;
|
||||
for (const auto& command : COMMANDS) {
|
||||
if (StringUtil::StartsWith(packet->data(), command.first)) {
|
||||
if (packet->starts_with(command.first)) {
|
||||
Log_DebugPrintf("Processing command '%s'", command.first);
|
||||
|
||||
// Invoke command, remove command name from payload.
|
||||
|
||||
@ -775,7 +775,7 @@ bool MemoryCardImage::ImportSave(DataArray* data, const char* filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (StringUtil::EndsWith(filename, ".mcs"))
|
||||
if (std::string_view(filename).ends_with(".mcs"))
|
||||
{
|
||||
return ImportSaveWithDirectoryFrame(data, filename, sd);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ static std::string ResolveHostPath(const std::string& path)
|
||||
const std::string& root = g_settings.pcdrv_root;
|
||||
std::string canonicalized_path = Path::Canonicalize(Path::Combine(root, path));
|
||||
if (canonicalized_path.length() < root.length() || // Length has to be longer (a file),
|
||||
!StringUtil::StartsWith(canonicalized_path, root) || // and start with the host root,
|
||||
!canonicalized_path.starts_with(root) || // and start with the host root,
|
||||
canonicalized_path[root.length()] != FS_OSPATH_SEPARATOR_CHARACTER) // and we can't access a sibling.
|
||||
{
|
||||
Log_ErrorPrintf("Denying access to path outside of PCDrv directory. Requested path: '%s', "
|
||||
|
||||
Reference in New Issue
Block a user