Skip to content

Commit

Permalink
Fix #53, Opaque CFE_SB_MsgId_t values
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jphickey committed May 5, 2020
1 parent af9b210 commit e691304
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void SAMPLE_ProcessCommandPacket( CFE_SB_MsgPtr_t Msg )
CFE_EVS_SendEvent(SAMPLE_INVALID_MSGID_ERR_EID,
CFE_EVS_EventType_ERROR,
"SAMPLE: invalid command packet,MID = 0x%x",
MsgId);
(unsigned int)CFE_SB_MsgIdToValue(MsgId));
break;
}

Expand Down Expand Up @@ -488,7 +488,7 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength )
CFE_EVS_SendEvent(SAMPLE_LEN_ERR_EID,
CFE_EVS_EventType_ERROR,
"Invalid Msg length: ID = 0x%X, CC = %d, Len = %d, Expected = %d",
MessageID,
(unsigned int)CFE_SB_MsgIdToValue(MessageID),
CommandCode,
ActualLength,
ExpectedLength);
Expand Down
2 changes: 1 addition & 1 deletion unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void Test_SAMPLE_ProcessCommandPacket(void)
SAMPLE_ProcessCommandPacket(&TestMsg.Base);

/* invalid message id */
TestMsgId = 0;
TestMsgId = CFE_SB_INVALID_MSG_ID;
UT_SetDataBuffer(UT_KEY(CFE_SB_GetMsgId), &TestMsgId,
sizeof(TestMsgId), false);
SAMPLE_ProcessCommandPacket(&TestMsg.Base);
Expand Down

0 comments on commit e691304

Please sign in to comment.