Skip to content

Commit

Permalink
Fix nasa#89, correct format spec strings and data 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 73285e9 commit de4391e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions fsw/src/mm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ CFE_Status_t MM_AppInit(void)
Status = CFE_SB_CreatePipe(&MM_AppData.CmdPipe, MM_CMD_PIPE_DEPTH, "MM_CMD_PIPE");
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MM_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Error Creating SB Pipe, RC = 0x%08X", Status);
CFE_EVS_SendEvent(MM_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Error Creating SB Pipe, RC = 0x%08X", (unsigned int)Status);
return Status;
}

Expand All @@ -181,7 +181,7 @@ CFE_Status_t MM_AppInit(void)
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MM_HK_SUB_ERR_EID, CFE_EVS_EventType_ERROR, "Error Subscribing to HK Request, RC = 0x%08X",
Status);
(unsigned int)Status);
return Status;
}

Expand All @@ -192,7 +192,7 @@ CFE_Status_t MM_AppInit(void)
if (Status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(MM_CMD_SUB_ERR_EID, CFE_EVS_EventType_ERROR, "Error Subscribing to MM Command, RC = 0x%08X",
Status);
(unsigned int)Status);
return Status;
}

Expand Down
14 changes: 7 additions & 7 deletions fsw/src/mm_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ bool MM_PeekMem(const MM_PeekCmd_t *CmdPtr, cpuaddr SrcAddress)
else
{
CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR,
"PSP read memory error: RC=%d, Address=%p, MemType=MEM%u", PSP_Status, (void *)SrcAddress,
"PSP read memory error: RC=%d, Address=%p, MemType=MEM%u", (int)PSP_Status, (void *)SrcAddress,
(unsigned int)DataSize);
}

Expand Down Expand Up @@ -395,7 +395,7 @@ bool MM_DumpMemToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadD
{
BytesRemaining = 0;
CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR,
"OS_write error received: RC = %d, Expected = %u, File = '%s'", OS_Status,
"OS_write error received: RC = %d, Expected = %u, File = '%s'", (int)OS_Status,
(unsigned int)SegmentSize, FileName);
}
}
Expand Down Expand Up @@ -434,7 +434,7 @@ bool MM_WriteFileHeaders(const char *FileName, osal_id_t FileHandle, CFE_FS_Head
/* We either got an error or didn't write as much data as expected */
Valid = false;
CFE_EVS_SendEvent(MM_CFE_FS_WRITEHDR_ERR_EID, CFE_EVS_EventType_ERROR,
"CFE_FS_WriteHeader error received: RC = %d Expected = %d File = '%s'", OS_Status,
"CFE_FS_WriteHeader error received: RC = %d Expected = %d File = '%s'", (int)OS_Status,
(int)sizeof(CFE_FS_Header_t), FileName);

} /* end CFE_FS_WriteHeader if */
Expand All @@ -449,7 +449,7 @@ bool MM_WriteFileHeaders(const char *FileName, osal_id_t FileHandle, CFE_FS_Head
/* We either got an error or didn't read as much data as expected */
Valid = false;
CFE_EVS_SendEvent(MM_OS_WRITE_EXP_ERR_EID, CFE_EVS_EventType_ERROR,
"OS_write error received: RC = %d Expected = %u File = '%s'", OS_Status,
"OS_write error received: RC = %d Expected = %u File = '%s'", (int)OS_Status,
(unsigned int)sizeof(MM_LoadDumpFileHeader_t), FileName);

} /* end OS_write if */
Expand Down Expand Up @@ -593,7 +593,7 @@ bool MM_FillDumpInEventBuffer(cpuaddr SrcAddress, const MM_DumpInEventCmd_t *Cmd
/* CFE_PSP_MemRead32 error */
Valid = false;
CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR,
"PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM32", PSP_Status,
"PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM32", (int)PSP_Status,
(void *)SrcAddress, (void *)DumpBuffer);
/* Stop load dump buffer loop */
break;
Expand All @@ -617,7 +617,7 @@ bool MM_FillDumpInEventBuffer(cpuaddr SrcAddress, const MM_DumpInEventCmd_t *Cmd
/* CFE_PSP_MemRead16 error */
Valid = false;
CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR,
"PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM16", PSP_Status,
"PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM16", (int)PSP_Status,
(void *)SrcAddress, (void *)DumpBuffer);
/* Stop load dump buffer loop */
break;
Expand All @@ -641,7 +641,7 @@ bool MM_FillDumpInEventBuffer(cpuaddr SrcAddress, const MM_DumpInEventCmd_t *Cmd
/* CFE_PSP_MemRead8 error */
Valid = false;
CFE_EVS_SendEvent(MM_PSP_READ_ERR_EID, CFE_EVS_EventType_ERROR,
"PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM8", PSP_Status,
"PSP read memory error: RC=%d, Src=%p, Tgt=%p, Type=MEM8", (int)PSP_Status,
(void *)SrcAddress, (void *)DumpBuffer);
/* Stop load dump buffer loop */
break;
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/mm_mem16.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ bool MM_FillMem16(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
NewBytesRemaining = BytesRemaining - (BytesRemaining % 2);
CFE_EVS_SendEvent(MM_FILL_MEM16_ALIGN_WARN_INF_EID, CFE_EVS_EventType_INFORMATION,
"MM_FillMem16 NumOfBytes not multiple of 2. Reducing from %d to %d.", BytesRemaining,
NewBytesRemaining);
"MM_FillMem16 NumOfBytes not multiple of 2. Reducing from %u to %u.", (unsigned int)BytesRemaining,
(unsigned int)NewBytesRemaining);
BytesRemaining = NewBytesRemaining;
}

Expand Down
6 changes: 3 additions & 3 deletions fsw/src/mm_mem32.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool MM_LoadMem32FromFile(osal_id_t FileHandle, const char *FileName, const MM_L
/* CFE_PSP_MemWrite32 error */
BytesRemaining = 0;
CFE_EVS_SendEvent(MM_PSP_WRITE_ERR_EID, CFE_EVS_EventType_ERROR,
"PSP write memory error: RC=%d, Address=%p, MemType=MEM32", PSP_Status,
"PSP write memory error: RC=%d, Address=%p, MemType=MEM32", (int)PSP_Status,
(void *)DataPointer32);
/* Stop load segment loop */
break;
Expand Down Expand Up @@ -236,8 +236,8 @@ bool MM_FillMem32(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
NewBytesRemaining = BytesRemaining - (BytesRemaining % 4);
CFE_EVS_SendEvent(MM_FILL_MEM32_ALIGN_WARN_INF_EID, CFE_EVS_EventType_INFORMATION,
"MM_FillMem32 NumOfBytes not multiple of 4. Reducing from %d to %d.", BytesRemaining,
NewBytesRemaining);
"MM_FillMem32 NumOfBytes not multiple of 4. Reducing from %d to %d.", (int)BytesRemaining,
(int)NewBytesRemaining);
BytesRemaining = NewBytesRemaining;
}

Expand Down

0 comments on commit de4391e

Please sign in to comment.