Skip to content

Commit

Permalink
Merge pull request #10 from skliper/fix9-static_analysis_workflow
Browse files Browse the repository at this point in the history
Fix #9, Resolve strict cppcheck warnings
  • Loading branch information
astrogeco authored May 11, 2022
2 parents a1a77b6 + f165ebb commit 25f3ae2
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions fsw/src/hk_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void HK_ProcessIncomingHkData(const CFE_SB_Buffer_t *BufPtr)
{
hk_copy_table_entry_t * StartOfCopyTable = NULL;
hk_copy_table_entry_t * StartOfCopyTable = HK_AppData.CopyTablePtr;
hk_copy_table_entry_t * CpyTblEntry = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = HK_AppData.RuntimeTablePtr;
hk_runtime_tbl_entry_t *RtTblEntry = NULL;
uint16 Loop = 0;
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
Expand All @@ -56,9 +56,6 @@ void HK_ProcessIncomingHkData(const CFE_SB_Buffer_t *BufPtr)
int32 MessageErrors = 0;
int32 LastByteAccessed = 0;

StartOfCopyTable = (hk_copy_table_entry_t *)HK_AppData.CopyTablePtr;
StartOfRtTable = (hk_runtime_tbl_entry_t *)HK_AppData.RuntimeTablePtr;

CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID);

/* Spin thru the entire table looking for matches */
Expand Down Expand Up @@ -368,15 +365,13 @@ int32 HK_TearDownOldCopyTable(hk_copy_table_entry_t *CpyTblPtr, hk_runtime_tbl_e
void HK_SendCombinedHkPacket(CFE_SB_MsgId_t WhichMidToSend)
{
bool PacketFound = false;
hk_runtime_tbl_entry_t *StartOfRtTable = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = HK_AppData.RuntimeTablePtr;
hk_runtime_tbl_entry_t *RtTblEntry = NULL;
int32 Loop = 0;
CFE_SB_MsgId_t ThisEntrysOutMid = CFE_SB_INVALID_MSG_ID;
CFE_SB_MsgId_t InputMidMissing = CFE_SB_INVALID_MSG_ID;
CFE_SB_Buffer_t * OutBuffer = NULL;

StartOfRtTable = (hk_runtime_tbl_entry_t *)HK_AppData.RuntimeTablePtr;

/* Look thru each item in this Table, but only send this packet once, at most */
for (Loop = 0; ((Loop < HK_COPY_TABLE_ENTRIES) && (PacketFound == false)); Loop++)
{
Expand Down Expand Up @@ -434,7 +429,7 @@ void HK_SendCombinedHkPacket(CFE_SB_MsgId_t WhichMidToSend)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 HK_CheckStatusOfTables(void)
{
int32 HKStatus = HK_ERROR; /* Assume failure */
int32 HKStatus;

HKStatus = HK_CheckStatusOfCopyTable();

Expand All @@ -454,7 +449,7 @@ int32 HK_CheckStatusOfTables(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 HK_CheckStatusOfCopyTable(void)
{
int32 Status = CFE_SUCCESS;
int32 Status;
int32 HKStatus = HK_ERROR; /* Assume failure */

/* Determine if the copy table has a validation or update that needs to be performed */
Expand All @@ -479,7 +474,7 @@ int32 HK_CheckStatusOfCopyTable(void)
If the runtime table pointer is bad, the process new copy table call later on will
flag the error. So we can ignore the return status at this point.
*/
Status = HK_TearDownOldCopyTable(HK_AppData.CopyTablePtr, HK_AppData.RuntimeTablePtr);
HK_TearDownOldCopyTable(HK_AppData.CopyTablePtr, HK_AppData.RuntimeTablePtr);

/* release address must be called for update to take. */
Status = CFE_TBL_ReleaseAddress(HK_AppData.CopyTableHandle);
Expand Down Expand Up @@ -553,7 +548,7 @@ int32 HK_CheckStatusOfCopyTable(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 HK_CheckStatusOfDumpTable(void)
{
int32 Status = CFE_SUCCESS;
int32 Status;
int32 HKStatus = HK_ERROR; /* Assume failure */

/* Determine if the runtime table has a dump pending */
Expand Down Expand Up @@ -598,14 +593,11 @@ int32 HK_CheckForMissingData(CFE_SB_MsgId_t OutPktToCheck, CFE_SB_MsgId_t *Missi
{
int32 Loop = 0;
int32 Status = HK_NO_MISSING_DATA;
hk_copy_table_entry_t * StartOfCopyTable = NULL;
hk_copy_table_entry_t * StartOfCopyTable = HK_AppData.CopyTablePtr;
hk_copy_table_entry_t * CpyTblEntry = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = HK_AppData.RuntimeTablePtr;
hk_runtime_tbl_entry_t *RtTblEntry = NULL;

StartOfCopyTable = (hk_copy_table_entry_t *)HK_AppData.CopyTablePtr;
StartOfRtTable = (hk_runtime_tbl_entry_t *)HK_AppData.RuntimeTablePtr;

/* Loop thru each item in the runtime table until end is reached or
* data-not-present detected */
do
Expand Down Expand Up @@ -637,14 +629,11 @@ int32 HK_CheckForMissingData(CFE_SB_MsgId_t OutPktToCheck, CFE_SB_MsgId_t *Missi
void HK_SetFlagsToNotPresent(CFE_SB_MsgId_t OutPkt)
{
int32 Loop = 0;
hk_copy_table_entry_t * StartOfCopyTable = NULL;
hk_copy_table_entry_t * StartOfCopyTable = HK_AppData.CopyTablePtr;
hk_copy_table_entry_t * CpyTblEntry = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = NULL;
hk_runtime_tbl_entry_t *StartOfRtTable = HK_AppData.RuntimeTablePtr;
hk_runtime_tbl_entry_t *RtTblEntry = NULL;

StartOfCopyTable = (hk_copy_table_entry_t *)HK_AppData.CopyTablePtr;
StartOfRtTable = (hk_runtime_tbl_entry_t *)HK_AppData.RuntimeTablePtr;

/* Look thru each item in the runtime table until end is reached */
for (Loop = 0; Loop < HK_COPY_TABLE_ENTRIES; Loop++)
{
Expand Down

0 comments on commit 25f3ae2

Please sign in to comment.