1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-30 20:06:40 +00:00

Use string_view for canOptimize

This commit is contained in:
elsid 2024-03-09 01:20:56 +01:00
parent a98ce7f76a
commit 3ea3eeb613
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -778,12 +778,12 @@ namespace Resource
}
};
bool canOptimize(const std::string& filename)
static bool canOptimize(std::string_view filename)
{
size_t slashpos = filename.find_last_of("\\/");
if (slashpos != std::string::npos && slashpos + 1 < filename.size())
const std::string_view::size_type slashpos = filename.find_last_of('/');
if (slashpos != std::string_view::npos && slashpos + 1 < filename.size())
{
std::string basename = filename.substr(slashpos + 1);
const std::string_view basename = filename.substr(slashpos + 1);
// xmesh.nif can not be optimized because there are keyframes added in post
if (!basename.empty() && basename[0] == 'x')
return false;
@ -796,7 +796,7 @@ namespace Resource
// For spell VFX, DummyXX nodes must remain intact. Not adding those to reservedNames to avoid being overly
// cautious - instead, decide on filename
if (filename.find("vfx_pattern") != std::string::npos)
if (filename.find("vfx_pattern") != std::string_view::npos)
return false;
return true;
}