diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-25 11:45:00 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-25 11:45:00 -0600 |
commit | c9b18b049b09580260188349bb32e91b59f74965 (patch) | |
tree | 14929ed18bf0cfc14d32d78825b3f3a47ae7d589 /apps/examples/ostest | |
parent | b756c4b51f51427339bf3649430f8470f64d7a8d (diff) | |
download | nuttx-c9b18b049b09580260188349bb32e91b59f74965.tar.gz nuttx-c9b18b049b09580260188349bb32e91b59f74965.tar.bz2 nuttx-c9b18b049b09580260188349bb32e91b59f74965.zip |
More fixes to issues noted by cppcheck
Diffstat (limited to 'apps/examples/ostest')
-rw-r--r-- | apps/examples/ostest/mqueue.c | 2 | ||||
-rw-r--r-- | apps/examples/ostest/mutex.c | 4 | ||||
-rw-r--r-- | apps/examples/ostest/sighand.c | 12 | ||||
-rw-r--r-- | apps/examples/ostest/timedmqueue.c | 4 |
4 files changed, 7 insertions, 15 deletions
diff --git a/apps/examples/ostest/mqueue.c b/apps/examples/ostest/mqueue.c index b5f1ffb56..4f1c48807 100644 --- a/apps/examples/ostest/mqueue.c +++ b/apps/examples/ostest/mqueue.c @@ -403,7 +403,7 @@ void mqueue_test(void) pthread_join(receiver, &result); if (result != expected) { - printf("mqueue_test: ERROR receiver thread should have exited with %d\n", + printf("mqueue_test: ERROR receiver thread should have exited with %p\n", expected); printf(" ERROR Instead exited with nerrors=%d\n", (int)result); diff --git a/apps/examples/ostest/mutex.c b/apps/examples/ostest/mutex.c index 0b7f70daa..1951a4039 100644 --- a/apps/examples/ostest/mutex.c +++ b/apps/examples/ostest/mutex.c @@ -137,6 +137,6 @@ void mutex_test(void) #endif printf("\t\tThread1\tThread2\n"); - printf("\tLoops\t%ld\t%ld\n", nloops[0], nloops[1]); - printf("\tErrors\t%ld\t%ld\n", nerrors[0], nerrors[1]); + printf("\tLoops\t%lu\t%lu\n", nloops[0], nloops[1]); + printf("\tErrors\t%lu\t%lu\n", nerrors[0], nerrors[1]); } diff --git a/apps/examples/ostest/sighand.c b/apps/examples/ostest/sighand.c index ab1c15c0e..4f42dcff1 100644 --- a/apps/examples/ostest/sighand.c +++ b/apps/examples/ostest/sighand.c @@ -204,7 +204,7 @@ static int waiter_main(int argc, char *argv[]) /* Detach the signal handler */ act.sa_sigaction = SIG_DFL; - status = sigaction(WAKEUP_SIGNAL, &act, &oact); + (void)sigaction(WAKEUP_SIGNAL, &act, &oact); printf("waiter_main: done\n" ); FFLUSH(); @@ -223,7 +223,6 @@ void sighand_test(void) struct sched_param param; union sigval sigvalue; pid_t waiterpid; - int policy; int status; printf("sighand_test: Initializing semaphore to 0\n" ); @@ -265,13 +264,6 @@ void sighand_test(void) param.sched_priority = PTHREAD_DEFAULT_PRIORITY; } - policy = sched_getscheduler(0); - if (policy == ERROR) - { - printf("sighand_test: ERROR sched_getscheduler() failed\n" ); - policy = SCHED_FIFO; - } - waiterpid = task_create("waiter", param.sched_priority, PTHREAD_STACK_DEFAULT, waiter_main, NULL); if (waiterpid == ERROR) @@ -326,7 +318,7 @@ void sighand_test(void) #ifdef CONFIG_SCHED_HAVE_PARENT act.sa_sigaction = SIG_DFL; - status = sigaction(SIGCHLD, &act, &oact); + (void)sigaction(SIGCHLD, &act, &oact); #endif printf("sighand_test: done\n" ); diff --git a/apps/examples/ostest/timedmqueue.c b/apps/examples/ostest/timedmqueue.c index 24dd0bc34..5792b426e 100644 --- a/apps/examples/ostest/timedmqueue.c +++ b/apps/examples/ostest/timedmqueue.c @@ -124,7 +124,7 @@ static void *sender_thread(void *arg) */ g_send_mqfd = mq_open("timedmq", O_WRONLY|O_CREAT, 0666, &attr); - if (g_send_mqfd < 0) + if (g_send_mqfd == (mqd_t)-1) { printf("sender_thread: ERROR mq_open failed\n"); pthread_exit((pthread_addr_t)1); @@ -221,7 +221,7 @@ static void *receiver_thread(void *arg) */ g_recv_mqfd = mq_open("timedmq", O_RDONLY|O_CREAT, 0666, &attr); - if (g_recv_mqfd < 0) + if (g_recv_mqfd == (mqd_t)-1) { printf("receiver_thread: ERROR mq_open failed\n"); pthread_exit((pthread_addr_t)1); |