From 1eacca0f1a652dd59045ba9247365a5343f806ea Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 8 Jan 2020 15:13:32 -0500 Subject: [PATCH] Fix #45, Opaque CFE_SB_MsgId_t values Do not assume CFE_SB_MsgId_t is implicitly integral in nature. When an integer value is required for printing or backward compatibility, use the explicit conversion routine to get this. --- fsw/src/ci_lab_app.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fsw/src/ci_lab_app.c b/fsw/src/ci_lab_app.c index e804655..2b2c4c9 100644 --- a/fsw/src/ci_lab_app.c +++ b/fsw/src/ci_lab_app.c @@ -225,7 +225,7 @@ void CI_LAB_ProcessCommandPacket(void) CFE_SB_MsgId_t MsgId; MsgId = CFE_SB_GetMsgId(CI_LAB_Global.MsgPtr); - switch (MsgId) + switch (CFE_SB_MsgIdToValue(MsgId)) { case CI_LAB_CMD_MID: CI_LAB_ProcessGroundCommand(); @@ -238,7 +238,7 @@ void CI_LAB_ProcessCommandPacket(void) default: CI_LAB_Global.HkBuffer.HkTlm.Payload.CommandErrorCounter++; CFE_EVS_SendEvent(CI_LAB_COMMAND_ERR_EID, CFE_EVS_EventType_ERROR, "CI: invalid command packet,MID = 0x%x", - MsgId); + (unsigned int)CFE_SB_MsgIdToValue(MsgId)); break; } @@ -407,8 +407,9 @@ bool CI_LAB_VerifyCmdLength(CFE_SB_MsgPtr_t msg, uint16 ExpectedLength) uint16 CommandCode = CFE_SB_GetCmdCode(msg); CFE_EVS_SendEvent(CI_LAB_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid msg length: ID = 0x%X, CC = %d, Len = %d, Expected = %d", MessageID, CommandCode, - ActualLength, ExpectedLength); + "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (unsigned int)CommandCode, + (unsigned int)ActualLength, (unsigned int)ExpectedLength); result = false; CI_LAB_Global.HkBuffer.HkTlm.Payload.CommandErrorCounter++; }