From de4391ef5b2556d7aecd81b716e389647043c6e2 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 11 Jan 2024 09:02:41 -0500 Subject: [PATCH] Fix #89, correct format spec strings and data types Resolves mismatches between format strings and the data types --- fsw/src/mm_app.c | 6 +++--- fsw/src/mm_dump.c | 14 +++++++------- fsw/src/mm_mem16.c | 4 ++-- fsw/src/mm_mem32.c | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fsw/src/mm_app.c b/fsw/src/mm_app.c index 7e506ef..146a483 100644 --- a/fsw/src/mm_app.c +++ b/fsw/src/mm_app.c @@ -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; } @@ -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; } @@ -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; } diff --git a/fsw/src/mm_dump.c b/fsw/src/mm_dump.c index 27f2ce4..7676708 100644 --- a/fsw/src/mm_dump.c +++ b/fsw/src/mm_dump.c @@ -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); } @@ -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); } } @@ -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 */ @@ -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 */ @@ -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; @@ -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; @@ -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; diff --git a/fsw/src/mm_mem16.c b/fsw/src/mm_mem16.c index 9b777f8..1c5a261 100644 --- a/fsw/src/mm_mem16.c +++ b/fsw/src/mm_mem16.c @@ -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; } diff --git a/fsw/src/mm_mem32.c b/fsw/src/mm_mem32.c index a531b9e..4293843 100644 --- a/fsw/src/mm_mem32.c +++ b/fsw/src/mm_mem32.c @@ -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; @@ -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; }