Skip to content

Commit

Permalink
FASTTRACK: Merge #291
Browse files Browse the repository at this point in the history
Fixes #287: cppcheck warnings
  • Loading branch information
skliper committed Nov 19, 2019
2 parents 710f8c6 + cc9e567 commit 0f10e0e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/os/posix/osapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Added SEM_VALUE_MAX Define
*/
#ifndef SEM_VALUE_MAX
#define SEM_VALUE_MAX (1 << 31)
#define SEM_VALUE_MAX (UINT32_MAX/2)
#endif

/*
Expand Down
2 changes: 1 addition & 1 deletion src/os/shared/osapi-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ int32 OS_TimerSet(uint32 timer_id, uint32 start_time, uint32 interval_time)

dedicated_timebase_id = 0;

if (start_time >= INT_MAX || interval_time >= INT_MAX)
if (start_time >= (UINT32_MAX/2) || interval_time >= (UINT32_MAX/2))
{
return OS_TIMER_ERR_INVALID_ARGS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/unit-test-coverage/shared/src/coveragetest-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void Test_OS_TimerSet(void)
memset(OS_timecb_table, 0, sizeof(OS_timecb_table));

expected = OS_TIMER_ERR_INVALID_ARGS;
actual = OS_TimerSet(2, 1 << 31, 1 << 31);
actual = OS_TimerSet(2, UINT32_MAX, UINT32_MAX);
UtAssert_True(actual == expected, "OS_TimerSet() (%ld) == OS_TIMER_ERR_INVALID_ARGS", (long)actual);

UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT));
Expand Down
2 changes: 1 addition & 1 deletion src/unit-test-coverage/shared/src/coveragetest-timebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void Test_OS_TimeBaseSet(void)

/* test error paths: overflow on input */
expected = OS_TIMER_ERR_INVALID_ARGS;
actual = OS_TimeBaseSet(1, 1 << 31, 1 << 31);
actual = OS_TimeBaseSet(1, UINT32_MAX, UINT32_MAX);
UtAssert_True(actual == expected, "OS_TimeBaseSet() (%ld) == OS_TIMER_ERR_INVALID_ARGS", (long)actual);

/* test error paths */
Expand Down
4 changes: 2 additions & 2 deletions src/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int OCS_rename (const char * old, const char * nw)
int OCS_snprintf (char * s, size_t maxlen, const char * format, ...)
{
int32 Status;
int actual;
int actual = 0;
va_list ap;

Status = UT_DEFAULT_IMPL(OCS_snprintf);
Expand All @@ -148,7 +148,7 @@ int OCS_snprintf (char * s, size_t maxlen, const char * format, ...)
int OCS_vsnprintf (char * s, size_t maxlen, const char * format, OCS_va_list arg)
{
int32 Status;
int actual;
int actual = 0;

Status = UT_DEFAULT_IMPL(OCS_vsnprintf);

Expand Down

0 comments on commit 0f10e0e

Please sign in to comment.