Skip to content

Commit

Permalink
Fix nasa#505, warnings in time base API test
Browse files Browse the repository at this point in the history
Add requisite cast to printf.
Also use sizeof() rather than hardcoded size of 12.
  • Loading branch information
jphickey committed Jun 16, 2020
1 parent 07fd022 commit cbaaf5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tests/time-base-api-test/time-base-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ void TestTimeBaseApi(void)
/* Checking OS_MAX_TIMEBASES + 1 */
for ( int i = 0; i < OS_MAX_TIMEBASES; i++ )
{
snprintf(TimeBaseIter[i], 12, "TimeBase%d", i);
snprintf(TimeBaseIter[i], sizeof(TimeBaseIter[i]), "TimeBase%d", i);
tbc_results[i] = OS_TimeBaseCreate(&tb_id[i], TimeBaseIter[i], 0);
}
TimeBaseNum = OS_MAX_TIMEBASES+1;
snprintf(overMaxTimeBase, 12, "TimeBase%d", TimeBaseNum);
snprintf(overMaxTimeBase, sizeof(overMaxTimeBase), "TimeBase%d", (int)TimeBaseNum);
expected = OS_ERR_NO_FREE_IDS;
actual= OS_TimeBaseCreate(&time_base_id, "overMaxTimeBase", 0);
UtAssert_True(actual == expected, "OS_TimeBaseCreate() (%ld) == OS_ERR_NO_FREE_IDS", (long)actual);
Expand Down

0 comments on commit cbaaf5a

Please sign in to comment.