Skip to content

Commit

Permalink
Fix #217, Convert remaining int32 CFE status variables to `CFE_Stat…
Browse files Browse the repository at this point in the history
…us_t`
  • Loading branch information
thnkslprpt committed Jan 31, 2024
1 parent 2dd3b1c commit 1e903fb
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 23 deletions.
13 changes: 6 additions & 7 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SAMPLE_APP_Data_t SAMPLE_APP_Data;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
void SAMPLE_APP_Main(void)
{
int32 status;
CFE_Status_t status;
CFE_SB_Buffer_t *SBBufPtr;

/*
Expand Down Expand Up @@ -107,10 +107,10 @@ void SAMPLE_APP_Main(void)
/* Initialization */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
int32 SAMPLE_APP_Init(void)
CFE_Status_t SAMPLE_APP_Init(void)

Check notice

Code scanning / CodeQL-coding-standard

Function too long Note

SAMPLE_APP_Init has too many lines (97, while 60 are allowed).

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
{
int32 status;
char VersionString[SAMPLE_APP_CFG_MAX_VERSION_STR_LEN];
CFE_Status_t status;
char VersionString[SAMPLE_APP_CFG_MAX_VERSION_STR_LEN];

/* Zero out the global data structure */
memset(&SAMPLE_APP_Data, 0, sizeof(SAMPLE_APP_Data));
Expand Down Expand Up @@ -173,7 +173,6 @@ int32 SAMPLE_APP_Init(void)
{
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08lX\n", (unsigned long)status);
}

}

if (status == CFE_SUCCESS)
Expand All @@ -192,8 +191,8 @@ int32 SAMPLE_APP_Init(void)
status = CFE_TBL_Load(SAMPLE_APP_Data.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_TABLE_FILE);
}

CFE_Config_GetVersionString(VersionString, SAMPLE_APP_CFG_MAX_VERSION_STR_LEN, "Sample App",
SAMPLE_APP_VERSION, SAMPLE_APP_BUILD_CODENAME, SAMPLE_APP_LAST_OFFICIAL);
CFE_Config_GetVersionString(VersionString, SAMPLE_APP_CFG_MAX_VERSION_STR_LEN, "Sample App", SAMPLE_APP_VERSION,
SAMPLE_APP_BUILD_CODENAME, SAMPLE_APP_LAST_OFFICIAL);

CFE_EVS_SendEvent(SAMPLE_APP_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "Sample App Initialized.%s",
VersionString);
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sample_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extern SAMPLE_APP_Data_t SAMPLE_APP_Data;
** Note: Except for the entry point (SAMPLE_APP_Main), these
** functions are not called from any other source module.
*/
void SAMPLE_APP_Main(void);
int32 SAMPLE_APP_Init(void);
void SAMPLE_APP_Main(void);
CFE_Status_t SAMPLE_APP_Init(void);

#endif /* SAMPLE_APP_H */
2 changes: 1 addition & 1 deletion fsw/src/sample_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Ms
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
{
int32 status;
CFE_Status_t status;
void * TblAddr;
SAMPLE_APP_ExampleTable_t *TblPtr;
const char * TableName = "SAMPLE_APP.ExampleTable";
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/sample_app_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
/* Verify contents of First Example Table buffer contents */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 SAMPLE_APP_TblValidationFunc(void *TblData)
CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData)
{
int32 ReturnCode = CFE_SUCCESS;
CFE_Status_t ReturnCode = CFE_SUCCESS;
SAMPLE_APP_ExampleTable_t *TblDataPtr = (SAMPLE_APP_ExampleTable_t *)TblData;

/*
Expand All @@ -58,7 +58,7 @@ int32 SAMPLE_APP_TblValidationFunc(void *TblData)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SAMPLE_APP_GetCrc(const char *TableName)
{
int32 status;
CFE_Status_t status;
uint32 Crc;
CFE_TBL_Info_t TblInfoPtr;

Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sample_app_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
#include "sample_app.h"

int32 SAMPLE_APP_TblValidationFunc(void *TblData);
void SAMPLE_APP_GetCrc(const char *TableName);
CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData);
void SAMPLE_APP_GetCrc(const char *TableName);

#endif /* SAMPLE_APP_UTILS_H */
2 changes: 1 addition & 1 deletion unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void Test_SAMPLE_APP_Init(void)
{
/*
* Test Case For:
* int32 SAMPLE_APP_Init( void )
* CFE_Status_t SAMPLE_APP_Init( void )
*/

/* nominal case should return CFE_SUCCESS */
Expand Down
2 changes: 1 addition & 1 deletion unit-test/coveragetest/coveragetest_sample_app_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void Test_SAMPLE_APP_TblValidationFunc(void)
{
/*
* Test Case For:
* int32 SAMPLE_APP_TblValidationFunc( void *TblData )
* CFE_Status_t SAMPLE_APP_TblValidationFunc( void *TblData )
*/
SAMPLE_APP_ExampleTable_t TestTblData;

Expand Down
6 changes: 3 additions & 3 deletions unit-test/stubs/sample_app_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
* Generated stub function for SAMPLE_APP_Init()
* ----------------------------------------------------
*/
int32 SAMPLE_APP_Init(void)
CFE_Status_t SAMPLE_APP_Init(void)
{
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_Init, int32);
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_Init, CFE_Status_t);

UT_GenStub_Execute(SAMPLE_APP_Init, Basic, NULL);

return UT_GenStub_GetReturnValue(SAMPLE_APP_Init, int32);
return UT_GenStub_GetReturnValue(SAMPLE_APP_Init, CFE_Status_t);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions unit-test/stubs/sample_app_utils_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ void SAMPLE_APP_GetCrc(const char *TableName)
* Generated stub function for SAMPLE_APP_TblValidationFunc()
* ----------------------------------------------------
*/
int32 SAMPLE_APP_TblValidationFunc(void *TblData)
CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData)
{
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_TblValidationFunc, int32);
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_TblValidationFunc, CFE_Status_t);

UT_GenStub_AddParam(SAMPLE_APP_TblValidationFunc, void *, TblData);

UT_GenStub_Execute(SAMPLE_APP_TblValidationFunc, Basic, NULL);

return UT_GenStub_GetReturnValue(SAMPLE_APP_TblValidationFunc, int32);
return UT_GenStub_GetReturnValue(SAMPLE_APP_TblValidationFunc, CFE_Status_t);
}

0 comments on commit 1e903fb

Please sign in to comment.