Skip to content

Commit

Permalink
Fix #64, correct format spec strings and types
Browse files Browse the repository at this point in the history
Resolves mismatches between format strings and the data types
  • Loading branch information
jphickey committed Jan 11, 2024
1 parent 74b620b commit 624e72e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
32 changes: 16 additions & 16 deletions fsw/src/md_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void MD_AppMain(void)

if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("MD:Application Init Failed,RC=%d\n", Status);
CFE_ES_WriteToSysLog("MD:Application Init Failed,RC=%08x\n", (unsigned int)Status);
MD_AppData.RunStatus = CFE_ES_RunStatus_APP_ERROR;
}

Expand Down Expand Up @@ -97,7 +97,7 @@ void MD_AppMain(void)
** Exit on pipe read error
*/
CFE_EVS_SendEvent(MD_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
"SB Pipe Read Error, App will exit. Pipe Return Status = %d", Status);
"SB Pipe Read Error, App will exit. Pipe Return Status = %08x", (unsigned int)Status);

MD_AppData.RunStatus = CFE_ES_RunStatus_APP_ERROR;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ CFE_Status_t MD_AppInit(void)
}
else
{
CFE_ES_WriteToSysLog("MD_APP:Call to CFE_EVS_Register Failed:RC=%d\n", Status);
CFE_ES_WriteToSysLog("MD_APP:Call to CFE_EVS_Register Failed:RC=%d\n", (unsigned int)Status);
}

/*
Expand Down Expand Up @@ -280,12 +280,12 @@ CFE_Status_t MD_InitSoftwareBusServices(void)
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_SUB_HK_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to subscribe to HK requests RC = %d",
Status);
(unsigned int)Status);
}
}
else
{
CFE_EVS_SendEvent(MD_CREATE_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to create pipe. RC = %d", Status);
CFE_EVS_SendEvent(MD_CREATE_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to create pipe. RC = %d", (unsigned int)Status);
}

/*
Expand All @@ -298,7 +298,7 @@ CFE_Status_t MD_InitSoftwareBusServices(void)
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_SUB_CMD_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to subscribe to commands. RC = %d",
Status);
(unsigned int)Status);
}
}

Expand All @@ -312,7 +312,7 @@ CFE_Status_t MD_InitSoftwareBusServices(void)
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_SUB_WAKEUP_ERR_EID, CFE_EVS_EventType_ERROR,
"Failed to subscribe to wakeup messages. RC = %d", Status);
"Failed to subscribe to wakeup messages. RC = %08x", (unsigned int)Status);
}
}

Expand Down Expand Up @@ -348,7 +348,7 @@ CFE_Status_t MD_InitTableServices(void)
if (Status < 0)
{
CFE_EVS_SendEvent(MD_INIT_TBL_NAME_ERR_EID, CFE_EVS_EventType_ERROR,
"TableName could not be made. Err=0x%08X, Idx=%d", Status, TblIndex);
"TableName could not be made. Err=0x%08X, Idx=%u", (unsigned int)Status, (unsigned int)TblIndex);

TableInitValidFlag = false;

Expand All @@ -362,7 +362,7 @@ CFE_Status_t MD_InitTableServices(void)
if (Status < 0)
{
CFE_EVS_SendEvent(MD_INIT_TBL_FILENAME_ERR_EID, CFE_EVS_EventType_ERROR,
"TblFileName could not be made. Err=0x%08X, Idx=%d", Status, TblIndex);
"TblFileName could not be made. Err=0x%08X, Idx=%u", (unsigned int)Status, (unsigned int)TblIndex);

TableInitValidFlag = false;

Expand Down Expand Up @@ -433,7 +433,7 @@ CFE_Status_t MD_InitTableServices(void)
else if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MD_TBL_REGISTER_CRIT_EID, CFE_EVS_EventType_CRITICAL,
"CFE_TBL_Register error %d received for tbl#%d", Status, TblIndex + 1);
"CFE_TBL_Register error %08x received for tbl#%u", (unsigned int)Status, (unsigned int)TblIndex + 1);
TableInitValidFlag = false;
}
else
Expand All @@ -455,8 +455,8 @@ CFE_Status_t MD_InitTableServices(void)

if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("MD_APP: Error 0x%08X received loading tbl#%d\n", (unsigned int)Status,
TblIndex + 1);
CFE_ES_WriteToSysLog("MD_APP: Error 0x%08X received loading tbl#%u\n", (unsigned int)Status,
(unsigned int)TblIndex + 1);
TableInitValidFlag = false;
}
else
Expand All @@ -475,7 +475,7 @@ CFE_Status_t MD_InitTableServices(void)

/* Output init and recovery event message */
CFE_EVS_SendEvent(MD_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION,
"Dwell Tables Recovered: %d, Dwell Tables Initialized: %d", TblRecos, TblInits);
"Dwell Tables Recovered: %u, Dwell Tables Initialized: %u", TblRecos, TblInits);

if (TableInitValidFlag == true)
{
Expand Down Expand Up @@ -533,8 +533,8 @@ CFE_Status_t MD_ManageDwellTable(uint8 TblIndex)
else
{
CFE_EVS_SendEvent(MD_NO_TBL_COPY_ERR_EID, CFE_EVS_EventType_ERROR,
"Didn't update MD tbl #%d due to unexpected CFE_TBL_GetAddress return: %d",
TblIndex + 1, GetAddressResult);
"Didn't update MD tbl #%d due to unexpected CFE_TBL_GetAddress return: %u",
(unsigned int)TblIndex + 1, (unsigned int)GetAddressResult);
}

/* Unlock Table */
Expand All @@ -548,7 +548,7 @@ CFE_Status_t MD_ManageDwellTable(uint8 TblIndex)
else if ((Status & CFE_SEVERITY_BITMASK) == CFE_SEVERITY_ERROR)
{
CFE_EVS_SendEvent(MD_TBL_STATUS_ERR_EID, CFE_EVS_EventType_ERROR,
"Received unexpected error %d from CFE_TBL_GetStatus for tbl #%d", Status, TblIndex + 1);
"Received unexpected error %08x from CFE_TBL_GetStatus for tbl #%u", (unsigned int)Status, (unsigned int)TblIndex + 1);
FinishedManaging = true;
}

Expand Down
6 changes: 3 additions & 3 deletions fsw/src/md_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr)

CFE_EVS_SendEvent(MD_START_DWELL_ERR_EID, CFE_EVS_EventType_ERROR,
"Start Dwell Table for mask 0x%04X failed for %d of %d tables", Start->Payload.TableMask,
ErrorCount, NumTblInMask);
(int)ErrorCount, (int)NumTblInMask);
}
}
else /* No valid table id's specified in mask */
Expand Down Expand Up @@ -176,7 +176,7 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr)

CFE_EVS_SendEvent(MD_STOP_DWELL_ERR_EID, CFE_EVS_EventType_ERROR,
"Stop Dwell Table for mask 0x%04X failed for %d of %d tables", Stop->Payload.TableMask,
ErrorCount, NumTblInMask);
(int)ErrorCount, (int)NumTblInMask);
}
}
else
Expand Down Expand Up @@ -466,7 +466,7 @@ void MD_ProcessSignatureCmd(const CFE_SB_Buffer_t *BufPtr)
else
{
CFE_EVS_SendEvent(MD_SET_SIGNATURE_ERR_EID, CFE_EVS_EventType_ERROR,
"Failed to set signature for Dwell Tbl#%d. Update returned 0x%08X", TblId, Status);
"Failed to set signature for Dwell Tbl#%d. Update returned 0x%08X", (int)TblId, (unsigned int)Status);

MD_AppData.ErrCounter++;
}
Expand Down
14 changes: 7 additions & 7 deletions fsw/src/md_dwell_tbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ int32 MD_CheckTableEntries(MD_DwellTableLoad_t *TblPtr, uint16 *ErrorEntryArg)
/* Keep counting good,bad,unused, don't exit immediately */

CFE_EVS_SendEvent(MD_TBL_ENTRY_ERR_EID, CFE_EVS_EventType_ERROR,
"Table entry %d failed with status 0x%08X", EntryIndex, Status);
"Table entry %d failed with status 0x%08X", (int)EntryIndex, (unsigned int)Status);
}
}
}
Expand Down Expand Up @@ -343,8 +343,8 @@ CFE_Status_t MD_UpdateTableEnabledField(uint16 TableIndex, uint16 FieldValue)
if ((Status != CFE_SUCCESS) && (Status != CFE_TBL_INFO_UPDATED))
{
CFE_EVS_SendEvent(MD_UPDATE_TBL_EN_ERR_EID, CFE_EVS_EventType_ERROR,
"MD_UpdateTableEnabledField, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", TableIndex,
Status);
"MD_UpdateTableEnabledField, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", (int)TableIndex,
(unsigned int)Status);
}
else
{
Expand Down Expand Up @@ -375,8 +375,8 @@ CFE_Status_t MD_UpdateTableDwellEntry(uint16 TableIndex, uint16 EntryIndex, uint
if ((Status != CFE_SUCCESS) && (Status != CFE_TBL_INFO_UPDATED))
{
CFE_EVS_SendEvent(MD_UPDATE_TBL_DWELL_ERR_EID, CFE_EVS_EventType_ERROR,
"MD_UpdateTableDwellEntry, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", TableIndex,
Status);
"MD_UpdateTableDwellEntry, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", (int)TableIndex,
(unsigned int)Status);
}
else
{
Expand Down Expand Up @@ -420,8 +420,8 @@ CFE_Status_t MD_UpdateTableSignature(uint16 TableIndex, char NewSignature[MD_SIG
if ((Status != CFE_SUCCESS) && (Status != CFE_TBL_INFO_UPDATED))
{
CFE_EVS_SendEvent(MD_UPDATE_TBL_SIG_ERR_EID, CFE_EVS_EventType_ERROR,
"MD_UpdateTableSignature, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", TableIndex,
Status);
"MD_UpdateTableSignature, TableIndex %d: CFE_TBL_GetAddress Returned 0x%08x", (int)TableIndex,
(unsigned int)Status);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions unit-test/md_dwell_tbl_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ void MD_ValidTableEntry_Test_InvalidLength(void)
Result = MD_ValidTableEntry(&Entry);

/* Verify results */
UtAssert_True(Result == MD_INVALID_LEN_ERROR, "Result == MD_INVALID_LEN_ERROR 0x%x", Result);
UtAssert_INT32_EQ(Result, MD_INVALID_LEN_ERROR);

call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));

Expand Down Expand Up @@ -850,7 +850,7 @@ void MD_ValidTableEntry_Test_NotAligned16DwellLength2(void)
Result = MD_ValidTableEntry(&Entry);

/* Verify results */
UtAssert_True(Result == MD_NOT_ALIGNED_ERROR, "Result == MD_NOT_ALIGNED_ERROR 0x%x", Result);
UtAssert_INT32_EQ(Result, MD_NOT_ALIGNED_ERROR);

call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));

Expand Down

0 comments on commit 624e72e

Please sign in to comment.