Skip to content

Commit

Permalink
Fix strcat in for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
MSECode committed Jun 29, 2023
1 parent b355931 commit e9f35d1
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/libraries/icubmod/embObjLib/diagnosticInfoParsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,12 +1108,14 @@ void SysParser::parseInfo()
{
if ( (lostMaskcan1 & (1<<i)) == (1<<i))
{
snprintf(lostCanBoards1, sizeof(lostCanBoards1), "%d ", i);
strcat(lostCanBoards1, std::to_string(i));
strcat(lostCanBoards1, " ");
}

if ( (lostMaskcan2 & (1<<i)) == (1<<i))
{
snprintf(lostCanBoards2, sizeof(lostCanBoards2), "%d ", i);
strcat(lostCanBoards2, std::to_string(i));
strcat(lostCanBoards2, " ");
}
}

Expand Down Expand Up @@ -1157,12 +1159,14 @@ void SysParser::parseInfo()
{
if ( (foundMaskcan1 & (1<<i)) == (1<<i))
{
snprintf(foundCanBoards1, sizeof(foundCanBoards1), "%d ", i);
strcat(foundCanBoards1, std::to_string(i));
strcat(foundCanBoards1, " ");
}

if ( (foundMaskcan2 & (1<<i)) == (1<<i))
{
snprintf(foundCanBoards2, sizeof(foundCanBoards2), "%d ", i);
strcat(foundCanBoards2, std::to_string(i));
strcat(foundCanBoards2, " ");
}
}

Expand All @@ -1188,12 +1192,14 @@ void SysParser::parseInfo()
{
if ( (lostMaskcan1 & (1<<i)) == (1<<i))
{
snprintf(lostCanBoards1, sizeof(lostCanBoards1), "%d ", i);
strcat(lostCanBoards1, std::to_string(i));
strcat(lostCanBoards1, " ");
}

if ( (lostMaskcan2 & (1<<i)) == (1<<i))
{
snprintf(lostCanBoards2, sizeof(lostCanBoards2), "%d ", i);
strcat(lostCanBoards2, std::to_string(i));
strcat(lostCanBoards2, " ");
}
}

Expand Down Expand Up @@ -1221,15 +1227,14 @@ void SysParser::parseInfo()
{
if ( (lostMaskcan1 & (1<<i)) == (1<<i))
{
snprintf(lostCanBoards1, sizeof(lostCanBoards1), "%d ", i);
strcat(lostCanBoards1, std::to_string(i));
strcat(lostCanBoards1, " ");
}
}

for(i=1; i<15; i++)
{
if ( (lostMaskcan2 & (1<<i)) == (1<<i))
{
snprintf(lostCanBoards2, sizeof(lostCanBoards2), "%d ", i);
strcat(lostCanBoards2, std::to_string(i));
strcat(lostCanBoards2, " ");
}
}

Expand Down

0 comments on commit e9f35d1

Please sign in to comment.