17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-25 17:25:13 +01:00

refactor(sonar): assorted small fixes

- empty() instead of size() comparisons (cpp:S1155)
- member initialisers in declaration order (cpp:S3229)
- no redundant c_str() when a std::string is accepted (cpp:S7121)
- contains() on associative containers (cpp:S6171)
- const reference instead of a copying range-for (cpp:S6032)
- starts_with() for prefix checks (cpp:S6178)
- no std::move on temporaries (cpp:S5274)
- has_value() on std::optional (cpp:S7172)
- bool literals for bool members (cpp:S5820)
- inline only on the definition (cpp:S3548)
- explicit base access specifier (cpp:S5965)
- explicit element access instead of dereferencing an array (cpp:S7116)
- rely on the C++20 rewritten operator!= (cpp:S6186)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 17:50:12 +02:00
parent 2e92076e21
commit b6186ced21
16 changed files with 28 additions and 29 deletions

View File

@@ -213,7 +213,7 @@ void gl::shader::parse_texture_entries(std::string &str)
{
std::string comp;
token_ss >> comp;
if (components_mapping.find(comp) == components_mapping.end())
if (!components_mapping.contains(comp))
log_error("unknown components: " + comp);
else
conf.components = components_mapping[comp];
@@ -271,7 +271,7 @@ void gl::shader::parse_param_entries(std::string &str)
{
std::string tok;
token_ss >> tok;
if (defaultparams_mapping.find(tok) == defaultparams_mapping.end())
if (!defaultparams_mapping.contains(tok))
log_error("unknown param default: " + tok);
conf.defaultparam = defaultparams_mapping[tok];
}
@@ -337,7 +337,7 @@ void gl::program::init()
{
bind();
for (auto [texturename, textureentry] : texture_conf)
for (auto const &[texturename, textureentry] : texture_conf)
{
shader::texture_entry const &e = textureentry;
GLuint loc = glGetUniformLocation(*this, texturename.c_str());