Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #78, Align use of Table/Tbl mnemonics #191

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int32 SAMPLE_APP_Init(void)
}
else
{
status = CFE_TBL_Load(SAMPLE_APP_Data.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_TABLE_FILE);
status = CFE_TBL_Load(SAMPLE_APP_Data.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_TBL_FILE);
}

CFE_EVS_SendEvent(SAMPLE_APP_STARTUP_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE App Initialized.%s",
Expand Down Expand Up @@ -352,7 +352,7 @@ int32 SAMPLE_APP_Process(const SAMPLE_APP_ProcessCmd_t *Msg)
{
int32 status;
SAMPLE_APP_Table_t *TblPtr;
const char * TableName = "SAMPLE_APP.SampleAppTable";
const char * TblName = "SAMPLE_APP.SampleAppTable";

/* Sample Use of Table */

Expand All @@ -366,7 +366,7 @@ int32 SAMPLE_APP_Process(const SAMPLE_APP_ProcessCmd_t *Msg)

CFE_ES_WriteToSysLog("Sample App: Table Value 1: %d Value 2: %d", TblPtr->Int1, TblPtr->Int2);

SAMPLE_APP_GetCrc(TableName);
SAMPLE_APP_GetCrc(TblName);

status = CFE_TBL_ReleaseAddress(SAMPLE_APP_Data.TblHandles[0]);
if (status != CFE_SUCCESS)
Expand Down Expand Up @@ -432,7 +432,7 @@ int32 SAMPLE_APP_TblValidationFunc(void *TblData)
if (TblDataPtr->Int1 > SAMPLE_APP_TBL_ELEMENT_1_MAX)
{
/* First element is out of range, return an appropriate error code */
ReturnCode = SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE;
ReturnCode = SAMPLE_APP_TBL_OUT_OF_RANGE_ERR_CODE;
}

return ReturnCode;
Expand All @@ -443,13 +443,13 @@ int32 SAMPLE_APP_TblValidationFunc(void *TblData)
/* Output CRC */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SAMPLE_APP_GetCrc(const char *TableName)
void SAMPLE_APP_GetCrc(const char *TblName)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
{
int32 status;
uint32 Crc;
CFE_TBL_Info_t TblInfoPtr;

status = CFE_TBL_GetInfo(&TblInfoPtr, TableName);
status = CFE_TBL_GetInfo(&TblInfoPtr, TblName);
if (status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Error Getting Table Info");
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/sample_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
#define SAMPLE_APP_NUMBER_OF_TABLES 1 /* Number of Table(s) */

/* Define filenames of default data images for tables */
#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl"
#define SAMPLE_APP_TBL_FILE "/cf/sample_app_tbl.tbl"

#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1
#define SAMPLE_APP_TBL_OUT_OF_RANGE_ERR_CODE -1

#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10
/************************************************************************
Expand Down Expand Up @@ -103,7 +103,7 @@ int32 SAMPLE_APP_ReportHousekeeping(const CFE_MSG_CommandHeader_t *Msg);
int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCountersCmd_t *Msg);
int32 SAMPLE_APP_Process(const SAMPLE_APP_ProcessCmd_t *Msg);
int32 SAMPLE_APP_Noop(const SAMPLE_APP_NoopCmd_t *Msg);
void SAMPLE_APP_GetCrc(const char *TableName);
void SAMPLE_APP_GetCrc(const char *TblName);

int32 SAMPLE_APP_TblValidationFunc(void *TblData);

Expand Down
6 changes: 3 additions & 3 deletions unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,16 +564,16 @@ void Test_SAMPLE_APP_TblValidationFunc(void)
/* nominal case (0) should succeed */
UtAssert_INT32_EQ(SAMPLE_APP_TblValidationFunc(&TestTblData), CFE_SUCCESS);

/* error case should return SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE */
/* error case should return SAMPLE_APP_TBL_OUT_OF_RANGE_ERR_CODE */
TestTblData.Int1 = 1 + SAMPLE_APP_TBL_ELEMENT_1_MAX;
UtAssert_INT32_EQ(SAMPLE_APP_TblValidationFunc(&TestTblData), SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE);
UtAssert_INT32_EQ(SAMPLE_APP_TblValidationFunc(&TestTblData), SAMPLE_APP_TBL_OUT_OF_RANGE_ERR_CODE);
}

void Test_SAMPLE_APP_GetCrc(void)
{
/*
* Test Case For:
* void SAMPLE_APP_GetCrc( const char *TableName )
* void SAMPLE_APP_GetCrc( const char *TblName )
*/

/*
Expand Down