Misc: Pass string_view by value

This commit is contained in:
Stenzek
2024-05-05 20:21:54 +10:00
parent e4d940a476
commit ca3cfbaa99
111 changed files with 543 additions and 542 deletions

View File

@ -18,7 +18,7 @@ IsoReader::IsoReader() = default;
IsoReader::~IsoReader() = default;
std::string_view IsoReader::RemoveVersionIdentifierFromPath(const std::string_view& path)
std::string_view IsoReader::RemoveVersionIdentifierFromPath(std::string_view path)
{
const std::string_view::size_type pos = path.find(';');
return (pos != std::string_view::npos) ? path.substr(0, pos) : path;
@ -82,7 +82,7 @@ bool IsoReader::ReadPVD(Error* error)
return false;
}
std::optional<IsoReader::ISODirectoryEntry> IsoReader::LocateFile(const std::string_view& path, Error* error)
std::optional<IsoReader::ISODirectoryEntry> IsoReader::LocateFile(std::string_view path, Error* error)
{
const ISODirectoryEntry* root_de = reinterpret_cast<const ISODirectoryEntry*>(m_pvd.root_directory_entry);
if (path.empty() || path == "/" || path == "\\")
@ -125,7 +125,7 @@ std::string_view IsoReader::GetDirectoryEntryFileName(const u8* sector, u32 de_s
return std::string_view(str, length_without_version);
}
std::optional<IsoReader::ISODirectoryEntry> IsoReader::LocateFile(const std::string_view& path, u8* sector_buffer,
std::optional<IsoReader::ISODirectoryEntry> IsoReader::LocateFile(std::string_view path, u8* sector_buffer,
u32 directory_record_lba, u32 directory_record_size,
Error* error)
{
@ -206,7 +206,7 @@ std::optional<IsoReader::ISODirectoryEntry> IsoReader::LocateFile(const std::str
return std::nullopt;
}
std::vector<std::string> IsoReader::GetFilesInDirectory(const std::string_view& path, Error* error)
std::vector<std::string> IsoReader::GetFilesInDirectory(std::string_view path, Error* error)
{
std::string base_path(path);
u32 directory_record_lsn;
@ -268,7 +268,7 @@ std::vector<std::string> IsoReader::GetFilesInDirectory(const std::string_view&
}
std::vector<std::pair<std::string, IsoReader::ISODirectoryEntry>>
IsoReader::GetEntriesInDirectory(const std::string_view& path, Error* error /*= nullptr*/)
IsoReader::GetEntriesInDirectory(std::string_view path, Error* error /*= nullptr*/)
{
std::string base_path(path);
u32 directory_record_lsn;
@ -329,7 +329,7 @@ IsoReader::GetEntriesInDirectory(const std::string_view& path, Error* error /*=
return files;
}
bool IsoReader::FileExists(const std::string_view& path, Error* error)
bool IsoReader::FileExists(std::string_view path, Error* error)
{
auto de = LocateFile(path, error);
if (!de)
@ -338,7 +338,7 @@ bool IsoReader::FileExists(const std::string_view& path, Error* error)
return (de->flags & ISODirectoryEntryFlag_Directory) == 0;
}
bool IsoReader::DirectoryExists(const std::string_view& path, Error* error)
bool IsoReader::DirectoryExists(std::string_view path, Error* error)
{
auto de = LocateFile(path, error);
if (!de)
@ -347,7 +347,7 @@ bool IsoReader::DirectoryExists(const std::string_view& path, Error* error)
return (de->flags & ISODirectoryEntryFlag_Directory) == ISODirectoryEntryFlag_Directory;
}
bool IsoReader::ReadFile(const std::string_view& path, std::vector<u8>* data, Error* error)
bool IsoReader::ReadFile(std::string_view path, std::vector<u8>* data, Error* error)
{
auto de = LocateFile(path, error);
if (!de)