17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 05:09:20 +02: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)
This commit is contained in:
jerrrrycho
2026-10-10 17:50:12 +02:00
parent ce450012b6
commit ba6840b6ba
16 changed files with 28 additions and 29 deletions

View File

@@ -245,7 +245,7 @@ public:
e[i + 2] = f; // zamiana Y i Z
}
};
inline float4x4 &Rotation(float const angle, float3 const &axis);
float4x4 &Rotation(float const angle, float3 const &axis);
inline bool IdentityIs() const
{ // sprawdzenie jednostkowości
for (int i = 0; i < 16; ++i)

View File

@@ -207,7 +207,7 @@ void Error(const std::string &asMessage, bool /*box*/)
{
// if (box)
// MessageBox(NULL, asMessage.c_str(), string("EU07 " + Global.asRelease).c_str(), MB_OK);
ErrorLog(asMessage.c_str());
ErrorLog(asMessage);
}
void Error(const char *&asMessage, bool /*box*/)

View File

@@ -195,7 +195,7 @@ uart_input::recall_bindings() {
if (fs::path appPath = user_config_path("eu07_input-uart.ini"); !appPath.empty() && fs::exists(appPath))
filePath = appPath.string();
cParser bindingparser(filePath.c_str(), cParser::buffer_FILE);
cParser bindingparser(filePath, cParser::buffer_FILE);
if (false == bindingparser.ok())
{
return false;
@@ -282,7 +282,7 @@ void uart_input::poll()
}
/* handle port change */
if(status->available_ports.size() > 0 && status->selected_port_index >= 0 && status->active_port_index != status->selected_port_index) {
if(!status->available_ports.empty() && status->selected_port_index >= 0 && status->active_port_index != status->selected_port_index) {
status->port_name = status->available_ports[status->selected_port_index];
status->active_port_index = status->selected_port_index;
status->reset_stats();