1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Refactor to use string_view more properly

This commit is contained in:
skdltmxn
2021-01-07 01:22:22 +09:00
parent 017f7ef9e4
commit c093a50f3f
60 changed files with 197 additions and 203 deletions

View File

@@ -206,7 +206,7 @@ public:
return _items.data();
}
const ObjectRepositoryItem* FindObjectLegacy(const std::string_view& legacyIdentifier) const override
const ObjectRepositoryItem* FindObjectLegacy(std::string_view legacyIdentifier) const override
{
rct_object_entry entry = {};
entry.SetName(legacyIdentifier);
@@ -310,7 +310,7 @@ public:
}
}
void AddObjectFromFile(const std::string_view& objectName, const void* data, size_t dataSize) override
void AddObjectFromFile(std::string_view objectName, const void* data, size_t dataSize) override
{
log_verbose("Adding object: [%s]", std::string(objectName).c_str());
auto path = GetPathForNewObject(objectName);
@@ -448,7 +448,7 @@ private:
}
static void SaveObject(
const std::string_view& path, const rct_object_entry* entry, const void* data, size_t dataSize, bool fixChecksum = true)
std::string_view path, const rct_object_entry* entry, const void* data, size_t dataSize, bool fixChecksum = true)
{
if (fixChecksum)
{
@@ -554,7 +554,7 @@ private:
return salt;
}
std::string GetPathForNewObject(const std::string_view& name)
std::string GetPathForNewObject(std::string_view name)
{
// Get object directory and create it if it doesn't exist
auto userObjPath = _env->GetDirectoryPath(DIRBASE::USER, DIRID::OBJECT);
@@ -573,7 +573,7 @@ private:
return fullPath;
}
std::string GetFileNameForNewObject(const std::string_view& name)
std::string GetFileNameForNewObject(std::string_view name)
{
// Trim name
char normalisedName[9] = { 0 };