summaryrefslogtreecommitdiffstats
path: root/core/resource/image.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-09-11 13:48:31 +0500
committeruntodesu <kirill@untode.su>2025-09-11 13:48:31 +0500
commitaaed751bf4430bf4b9b30cef532b8753b9f639ce (patch)
tree16bc751c272ba27ad53ec48dbdd3a6d9e6a8d4c2 /core/resource/image.cc
parent96bd73ae020ecca1f94698744c77498a89ad19f7 (diff)
downloadvoxelius-aaed751bf4430bf4b9b30cef532b8753b9f639ce.tar.bz2
voxelius-aaed751bf4430bf4b9b30cef532b8753b9f639ce.zip
Replace most of C strings with string_view
Diffstat (limited to 'core/resource/image.cc')
-rw-r--r--core/resource/image.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/resource/image.cc b/core/resource/image.cc
index 9ff0206..8b570e4 100644
--- a/core/resource/image.cc
+++ b/core/resource/image.cc
@@ -23,16 +23,16 @@ static int stbi_physfs_eof(void* context)
}
template<>
-resource_ptr<Image> resource::load<Image>(const char* name, unsigned int flags)
+resource_ptr<Image> resource::load<Image>(std::string_view name, unsigned int flags)
{
- auto it = resource_map.find(name);
+ auto it = resource_map.find(std::string(name));
if(it != resource_map.cend()) {
// Return an existing resource
return it->second;
}
- auto file = PHYSFS_openRead(name);
+ auto file = PHYSFS_openRead(std::string(name).c_str());
if(file == nullptr) {
spdlog::warn("resource: {}: {}", name, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
@@ -74,7 +74,7 @@ resource_ptr<Image> resource::load<Image>(const char* name, unsigned int flags)
return nullptr;
}
- return resource_map.insert_or_assign(name, new_resource).first->second;
+ return resource_map.insert_or_assign(std::string(name), new_resource).first->second;
}
template<>