Skip to content

Commit

Permalink
Fix nasa#84, Remove side-effects and superfluous initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Sep 5, 2023
1 parent d9c1034 commit 02e6368
Show file tree
Hide file tree
Showing 17 changed files with 607 additions and 561 deletions.
1 change: 0 additions & 1 deletion .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
pull_request:


jobs:
codeql:
name: Codeql Analysis
Expand Down
4 changes: 2 additions & 2 deletions fsw/inc/cs_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionT
* \param [in] SizeofDefinitionTableEntry The sizeof an entry in the
* definition table
*
* \param [in] SizeofResultsTableEntry The size of an enrty in the
* \param [in] SizeofResultsTableEntry The size of an entry in the
* results table
*
* \param [in] CallBackFunction A pointer to a function used to
Expand Down Expand Up @@ -367,7 +367,7 @@ CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handl
void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table,
const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries,
const char *DefinitionTableFileName, const void *DefaultDefTableAddress,
const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry,
const size_t SizeofDefinitionTableEntry, const size_t SizeofResultsTableEntry,
const CFE_TBL_CallbackFuncPtr_t CallBackFunction);

/**
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CS_AppData_t CS_AppData;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_AppMain(void)
{
CFE_Status_t Result = 0;
CFE_Status_t Result;
CFE_SB_Buffer_t *BufPtr = NULL;

/* Performance Log (start time counter) */
Expand Down Expand Up @@ -147,7 +147,7 @@ void CS_AppMain(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CFE_Status_t CS_AppInit(void)
{
CFE_Status_t Result = CFE_SUCCESS;
CFE_Status_t Result;

/* Register for event services */
Result = CFE_EVS_Register(NULL, 0, 0);
Expand Down Expand Up @@ -264,8 +264,8 @@ CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr)

void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
{
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
uint16 CommandCode = 0;
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
CFE_MSG_FcnCode_t CommandCode = 0;

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

Expand Down
262 changes: 139 additions & 123 deletions fsw/src/cs_app_cmds.c

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions fsw/src/cs_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result = CFE_SUCCESS;
CFE_Status_t ResultShare = 0;
CFE_Status_t ResultGetInfo = 0;
CFE_Status_t ResultGetAddress = 0;
CFE_Status_t ResultShare;
CFE_Status_t ResultGetInfo = 0;
CFE_Status_t ResultGetAddress = 0;

/* variables to get the table address */
CFE_TBL_Handle_t LocalTblHandle = CFE_TBL_BAD_TABLE_HANDLE;
Expand Down Expand Up @@ -313,7 +313,7 @@ CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *Compu
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result;
CFE_Status_t ResultGetResourceID = CS_ERROR;
CFE_Status_t ResultGetResourceID;
CFE_Status_t ResultGetResourceInfo = CS_ERROR;
int32 ResultAddressValid = false;

Expand Down Expand Up @@ -781,11 +781,11 @@ void CS_RecomputeTablesChildTask(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_OneShotChildTask(void)
{
uint32 NewChecksumValue = 0;
uint32 NumBytesRemainingCycles = 0;
uint32 NumBytesThisCycle = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 MaxBytesPerCycle = 0;
uint32 NewChecksumValue;
uint32 NumBytesRemainingCycles;
uint32 NumBytesThisCycle;
cpuaddr FirstAddrThisCycle;
uint32 MaxBytesPerCycle;

NewChecksumValue = 0;
NumBytesRemainingCycles = CS_AppData.HkPacket.Payload.LastOneShotSize;
Expand Down
1 change: 0 additions & 1 deletion fsw/src/cs_compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* function is used to compute checksums for EEPROM, Memory, the
* OS code segment and the cFE core code segment
*
*
* \par Assumptions, External Events, and Notes:
* None
*
Expand Down
Loading

0 comments on commit 02e6368

Please sign in to comment.