Skip to content

Commit 3c513ed

Browse files
committed
Fix #84, Remove side-effects and superfluous initializations
1 parent f958cc0 commit 3c513ed

17 files changed

+607
-561
lines changed

Diff for: .github/workflows/codeql-build.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
pull_request:
66

7-
87
jobs:
98
codeql:
109
name: Codeql Analysis

Diff for: fsw/inc/cs_tbldefs.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionT
339339
* \param [in] SizeofDefinitionTableEntry The sizeof an entry in the
340340
* definition table
341341
*
342-
* \param [in] SizeofResultsTableEntry The size of an enrty in the
342+
* \param [in] SizeofResultsTableEntry The size of an entry in the
343343
* results table
344344
*
345345
* \param [in] CallBackFunction A pointer to a function used to
@@ -367,7 +367,7 @@ CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handl
367367
void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table,
368368
const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries,
369369
const char *DefinitionTableFileName, const void *DefaultDefTableAddress,
370-
const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry,
370+
const size_t SizeofDefinitionTableEntry, const size_t SizeofResultsTableEntry,
371371
const CFE_TBL_CallbackFuncPtr_t CallBackFunction);
372372

373373
/**

Diff for: fsw/src/cs_app.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CS_AppData_t CS_AppData;
5858
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5959
void CS_AppMain(void)
6060
{
61-
CFE_Status_t Result = 0;
61+
CFE_Status_t Result;
6262
CFE_SB_Buffer_t *BufPtr = NULL;
6363

6464
/* Performance Log (start time counter) */
@@ -147,7 +147,7 @@ void CS_AppMain(void)
147147
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
148148
CFE_Status_t CS_AppInit(void)
149149
{
150-
CFE_Status_t Result = CFE_SUCCESS;
150+
CFE_Status_t Result;
151151

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

265265
void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
266266
{
267-
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
268-
uint16 CommandCode = 0;
267+
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
268+
CFE_MSG_FcnCode_t CommandCode = 0;
269269

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

Diff for: fsw/src/cs_app_cmds.c

+139-123
Large diffs are not rendered by default.

Diff for: fsw/src/cs_compute.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32
125125
uint32 NewChecksumValue = 0;
126126
CFE_Status_t Status = CFE_SUCCESS;
127127
CFE_Status_t Result = CFE_SUCCESS;
128-
CFE_Status_t ResultShare = 0;
129-
CFE_Status_t ResultGetInfo = 0;
130-
CFE_Status_t ResultGetAddress = 0;
128+
CFE_Status_t ResultShare = 0;
129+
CFE_Status_t ResultGetInfo = 0;
130+
CFE_Status_t ResultGetAddress = 0;
131131

132132
/* variables to get the table address */
133133
CFE_TBL_Handle_t LocalTblHandle = CFE_TBL_BAD_TABLE_HANDLE;
@@ -313,7 +313,7 @@ CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *Compu
313313
uint32 NewChecksumValue = 0;
314314
CFE_Status_t Status = CFE_SUCCESS;
315315
CFE_Status_t Result;
316-
CFE_Status_t ResultGetResourceID = CS_ERROR;
316+
CFE_Status_t ResultGetResourceID;
317317
CFE_Status_t ResultGetResourceInfo = CS_ERROR;
318318
bool ResultAddressValid = false;
319319

@@ -780,11 +780,11 @@ void CS_RecomputeTablesChildTask(void)
780780
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
781781
void CS_OneShotChildTask(void)
782782
{
783-
uint32 NewChecksumValue = 0;
784-
uint32 NumBytesRemainingCycles = 0;
785-
uint32 NumBytesThisCycle = 0;
786-
cpuaddr FirstAddrThisCycle = 0;
787-
uint32 MaxBytesPerCycle = 0;
783+
uint32 NewChecksumValue;
784+
uint32 NumBytesRemainingCycles;
785+
uint32 NumBytesThisCycle;
786+
cpuaddr FirstAddrThisCycle;
787+
uint32 MaxBytesPerCycle;
788788

789789
NewChecksumValue = 0;
790790
NumBytesRemainingCycles = CS_AppData.HkPacket.Payload.LastOneShotSize;

Diff for: fsw/src/cs_compute.h

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
* function is used to compute checksums for EEPROM, Memory, the
4141
* OS code segment and the cFE core code segment
4242
*
43-
*
4443
* \par Assumptions, External Events, and Notes:
4544
* None
4645
*

0 commit comments

Comments
 (0)