17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 03:59:19 +02:00

refactor(sonar): use std::size for array lengths (cpp:S7127)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 16:22:49 +02:00
parent 6445ef728a
commit 22c7c33a63
3 changed files with 10 additions and 10 deletions

View File

@@ -6892,7 +6892,7 @@ bool TMoverParameters::AutoRelayCheck(void)
// return ARC;// bbylo exit; //Ra: to powoduje, że EN57 nie wyłącza się przy IminLo
}
// main bez samoczynnego rozruchu
if (MainCtrlActualPos < sizeof(RList) / sizeof(TScheme) - 1 // crude guard against running out of current fixed table
if (MainCtrlActualPos < std::size(RList) - 1 // crude guard against running out of current fixed table
&& (RList[MainCtrlActualPos].Relay < MainCtrlPos || (RList[MainCtrlActualPos + 1].Relay == MainCtrlPos && MainCtrlActualPos < RlistSize) ||
(TrainType == dt_ET22 && DelayCtrlFlag)))
{
@@ -9231,7 +9231,7 @@ bool TMoverParameters::readRList(std::string const &Input)
return false;
}
auto idx = LISTLINE++;
if (idx >= sizeof(RList) / sizeof(TScheme))
if (idx >= std::size(RList))
{
WriteLog("Read RList: number of entries exceeded capacity of the data table");
return false;
@@ -9256,7 +9256,7 @@ bool TMoverParameters::readUCList(std::string const &line)
cParser parser(line);
parser.getTokens(10, false);
auto idx = LISTLINE++;
if (idx >= sizeof(UniCtrlList) / sizeof(TUniversalCtrl))
if (idx >= std::size(UniCtrlList))
{
WriteLog("Read UCList: number of entries exceeded capacity of the data table");
return false;
@@ -9274,7 +9274,7 @@ bool TMoverParameters::readDList(std::string const &line)
cParser parser(line);
parser.getTokens(3, false);
auto idx = LISTLINE++;
if (idx >= sizeof(RList) / sizeof(TScheme))
if (idx >= std::size(RList))
{
WriteLog("Read DList: number of entries exceeded capacity of the data table");
return false;
@@ -9374,7 +9374,7 @@ bool TMoverParameters::readFFList(std::string const &line)
return false;
}
int idx = LISTLINE++;
if (idx >= sizeof(FFlist) / sizeof(TFFScheme))
if (idx >= std::size(FFlist))
{
WriteLog("Read FList: number of entries exceeded capacity of the data table");
return false;
@@ -9394,7 +9394,7 @@ bool TMoverParameters::readFFEDList(std::string const &line)
return false;
}
int idx = LISTLINE++;
if (idx >= sizeof(FFEDlist) / sizeof(TFFScheme))
if (idx >= std::size(FFEDlist))
{
WriteLog("Read FList: number of entries exceeded capacity of the data table");
return false;
@@ -9414,7 +9414,7 @@ bool TMoverParameters::readWiperList(std::string const &line)
return false;
}
int idx = LISTLINE++;
if (idx >= sizeof(WiperList) / sizeof(TWiperScheme))
if (idx >= std::size(WiperList))
{
WriteLog("Read WiperList: number of entries exceeded capacity of the data table");
return false;
@@ -9450,7 +9450,7 @@ bool TMoverParameters::readWWList(std::string const &line)
return false;
}
int idx = LISTLINE++;
if (idx >= sizeof(DElist) / sizeof(TDEScheme))
if (idx >= std::size(DElist))
{
WriteLog("Read WWList: number of entries exceeded capacity of the data table");
return false;

View File

@@ -47,7 +47,7 @@ void gl::buffer::unbind(targets target)
void gl::buffer::unbind()
{
for (size_t i = 0; i < sizeof(binding_points) / sizeof(GLuint); i++)
for (size_t i = 0; i < std::size(binding_points); i++)
unbind((targets)i);
}

View File

@@ -28,7 +28,7 @@ const char* uart_baudrates_list[] = {
"2000000"
};
const size_t uart_baudrates_list_num = sizeof(uart_baudrates_list) / sizeof(uart_baudrates_list[0]);
const size_t uart_baudrates_list_num = std::size(uart_baudrates_list);
void uart_status::reset_stats() {
packets_sent = 0;