Skip to content

Commit 05cb142

Browse files
authoredJan 18, 2024
Merge pull request #65 from jphickey/fix-64-formats
Fix #64, correct printf format strings and conversions
2 parents 0c7c6d4 + 0ec0368 commit 05cb142

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed
 

‎fsw/src/hk_utils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int32 HK_ValidateHkCopyTable(void *TblPtr)
123123
HKStatus = HK_ERROR;
124124

125125
CFE_EVS_SendEvent(HK_NEWCPYTBL_HK_FAILED_EID, CFE_EVS_EventType_ERROR,
126-
"HK Validate: table contents has size %d > %d\n", sumBytes, HK_MAX_COMBINED_PACKET_SIZE);
126+
"HK Validate: table contents has size %d > %d\n", (int)sumBytes, HK_MAX_COMBINED_PACKET_SIZE);
127127
}
128128
else
129129
{

‎unit-test/hk_utils_tests.c

+13-16
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,15 @@ void Test_HK_ProcessIncomingHkData_MessageError(void)
301301
void Test_HK_ValidateHkCopyTable_Success(void)
302302
{
303303
/* Arrange */
304-
hk_copy_table_entry_t CopyTblPtr[HK_COPY_TABLE_ENTRIES];
304+
hk_copy_table_entry_t CopyTblPtr[HK_COPY_TABLE_ENTRIES];
305305

306306
HK_Test_InitGoodCopyTable(CopyTblPtr);
307307

308308
/* Act */
309309
int32 ReturnValue = HK_ValidateHkCopyTable(CopyTblPtr);
310310

311311
/* Assert */
312-
UtAssert_True(ReturnValue == HK_SUCCESS, "HK_ValidateHkCopyTable returned %d, expected %d (HK_SUCCESS)",
313-
ReturnValue, HK_SUCCESS);
312+
UtAssert_INT32_EQ(ReturnValue, HK_SUCCESS);
314313
}
315314

316315
/*
@@ -322,16 +321,15 @@ void Test_HK_ValidateHkCopyTable_Success(void)
322321
void Test_HK_ValidateHkCopyTable_Error(void)
323322
{
324323
/* Arrange */
325-
hk_copy_table_entry_t CopyTblPtr[HK_COPY_TABLE_ENTRIES];
324+
hk_copy_table_entry_t CopyTblPtr[HK_COPY_TABLE_ENTRIES];
326325

327326
HK_Test_InitOverflowCopyTable(CopyTblPtr);
328327

329328
/* Act */
330329
int32 ReturnValue = HK_ValidateHkCopyTable(CopyTblPtr);
331330

332331
/* Assert */
333-
UtAssert_True(ReturnValue == HK_ERROR, "HK_ValidateHkCopyTable returned %d, expected %d (HK_ERROR)",
334-
ReturnValue, HK_ERROR);
332+
UtAssert_INT32_EQ(ReturnValue, HK_ERROR);
335333
}
336334

337335
/**********************************************************************/
@@ -422,7 +420,7 @@ void Test_HK_ProcessNewCopyTable_PoolBufFail(void)
422420
CFE_Status_t ReturnValue;
423421
int32 i;
424422
int32 ExtraSubscribes = 0;
425-
int32 strCmpResult;
423+
int strCmpResult;
426424

427425
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
428426

@@ -457,7 +455,7 @@ void Test_HK_ProcessNewCopyTable_PoolBufFail(void)
457455
strCmpResult =
458456
strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[i].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
459457

460-
UtAssert_True(strCmpResult == 0, "Event #%d string matched expected result, '%s'", i,
458+
UtAssert_True(strCmpResult == 0, "Event #%d string matched expected result, '%s'", (int)i,
461459
context_CFE_EVS_SendEvent[i].Spec);
462460
}
463461

@@ -486,7 +484,7 @@ void Test_HK_ProcessNewCopyTable_SubscribeFail(void)
486484
{
487485
/* Arrange */
488486
CFE_Status_t ReturnValue;
489-
int32 strCmpResult;
487+
int strCmpResult;
490488
int32 i;
491489
int32 SubscriptionCount = 0;
492490

@@ -522,7 +520,7 @@ void Test_HK_ProcessNewCopyTable_SubscribeFail(void)
522520
strCmpResult =
523521
strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[i].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
524522

525-
UtAssert_True(strCmpResult == 0, "Event #%d string matched expected result, '%s'", i,
523+
UtAssert_True(strCmpResult == 0, "Event #%d string matched expected result, '%s'", (int)i,
526524
context_CFE_EVS_SendEvent[i].Spec);
527525
}
528526

@@ -867,7 +865,7 @@ void Test_HK_TearDownOldCopyTable_PoolFreeFail(void)
867865
/* Arrange */
868866
CFE_Status_t ReturnValue;
869867
int32 i;
870-
int32 strCmpResult;
868+
int strCmpResult;
871869

872870
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
873871

@@ -901,7 +899,7 @@ void Test_HK_TearDownOldCopyTable_PoolFreeFail(void)
901899
strCmpResult =
902900
strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[i].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
903901

904-
UtAssert_True(strCmpResult == 0, "Event #%d string matched expected result, '%s'", i,
902+
UtAssert_True(strCmpResult == 0, "Event #%d string matched expected result, '%s'", (int)i,
905903
context_CFE_EVS_SendEvent[i].Spec);
906904
}
907905
}
@@ -938,7 +936,7 @@ void Test_HK_TearDownOldCopyTable_Success(void)
938936

939937
for (i = 0; i < 5; i++)
940938
{
941-
UtAssert_True(RtTblPtr[i].OutputPktAddr == NULL, "RtTblPtr[%d].OutputPktAddr == NULL", i);
939+
UtAssert_True(RtTblPtr[i].OutputPktAddr == NULL, "RtTblPtr[%d].OutputPktAddr == NULL", (int)i);
942940
UtAssert_INT32_EQ(RtTblPtr[i].InputMidSubscribed, HK_INPUTMID_NOT_SUBSCRIBED);
943941
}
944942
}
@@ -1019,7 +1017,7 @@ void Test_HK_TearDownOldCopyTable_Success2(void)
10191017

10201018
for (i = 0; i < 5; i++)
10211019
{
1022-
UtAssert_True(RtTblPtr[i].OutputPktAddr == NULL, "RtTblPtr[%d].OutputPktAddr == NULL", i);
1020+
UtAssert_True(RtTblPtr[i].OutputPktAddr == NULL, "RtTblPtr[%d].OutputPktAddr == NULL", (int)i);
10231021
UtAssert_INT32_EQ(RtTblPtr[i].InputMidSubscribed, HK_INPUTMID_NOT_SUBSCRIBED);
10241022
}
10251023
}
@@ -1955,8 +1953,7 @@ void UtTest_Setup(void)
19551953
/* Test functions for HK_VaidateHkCopyTable */
19561954
UtTest_Add(Test_HK_ValidateHkCopyTable_Success, HK_Test_Setup, HK_Test_TearDown,
19571955
"Test_HK_ValidateHkCopyTable_Success");
1958-
UtTest_Add(Test_HK_ValidateHkCopyTable_Error, HK_Test_Setup, HK_Test_TearDown,
1959-
"Test_HK_ValidateHkCopyTable_Error");
1956+
UtTest_Add(Test_HK_ValidateHkCopyTable_Error, HK_Test_Setup, HK_Test_TearDown, "Test_HK_ValidateHkCopyTable_Error");
19601957

19611958
/* Test functions for HK_ProcessNewCopyTable */
19621959
UtTest_Add(Test_HK_ProcessNewCopyTable_EmptyTable, HK_Test_Setup, HK_Test_TearDown,

0 commit comments

Comments
 (0)