diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c index 406403e51..a41f36cf0 100644 --- a/components/dfs/src/dfs_fs.c +++ b/components/dfs/src/dfs_fs.c @@ -85,6 +85,8 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path) prefixlen = 0; + RT_ASSERT(path); + /* lock filesystem */ dfs_lock(); diff --git a/components/finsh/finsh_token.c b/components/finsh/finsh_token.c index 5ab29ad2a..3ca21e60d 100644 --- a/components/finsh/finsh_token.c +++ b/components/finsh/finsh_token.c @@ -508,10 +508,10 @@ static void token_proc_number(struct finsh_token* self) *p = '\0'; } - else + else if ( '0' <= ch && ch <= '7' ) { b = 8; - while ( is_digit(ch) ) + while ( '0' <= ch && ch <= '7' ) { *p++ = ch; ch = token_next_char(self); @@ -519,6 +519,12 @@ static void token_proc_number(struct finsh_token* self) *p = '\0'; } + else + { + /* Not a valid number */ + token_prev_char(self); + return; + } self->value.int_value = token_spec_number(buf, strlen(buf), b); self->current_token = finsh_token_type_value_int; diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 49a5d2359..e585b8d3a 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -358,7 +358,6 @@ void msh_auto_complete_path(char *path) full_path = (char*)rt_malloc(256); if (full_path == RT_NULL) return; /* out of memory */ - ptr = full_path; if (*path != '/') { getcwd(full_path, 256); @@ -367,7 +366,8 @@ void msh_auto_complete_path(char *path) } else *full_path = '\0'; - index = RT_NULL; ptr = path; + index = RT_NULL; + ptr = path; for (;;) { if (*ptr == '/') index = ptr + 1; if (!*ptr) break; ptr ++; diff --git a/components/libc/minilibc/string.c b/components/libc/minilibc/string.c index 568e9795e..4969ed2fc 100644 --- a/components/libc/minilibc/string.c +++ b/components/libc/minilibc/string.c @@ -146,10 +146,10 @@ int strncasecmp ( const char* s1, const char* s2, size_t len ) x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32; s1++; s2++; - if ((x2 != x1)) + if (x2 != x1) break; - if ((x1 == (unsigned int)-'A')) + if (x1 == (unsigned int)-'A') break; } diff --git a/components/pthreads/mqueue.c b/components/pthreads/mqueue.c index 7b669dc36..c1303ae6b 100644 --- a/components/pthreads/mqueue.c +++ b/components/pthreads/mqueue.c @@ -119,7 +119,6 @@ mqd_t mq_open(const char *name, int oflag, ...) { mqd_t mqdes; va_list arg; - mode_t mode; struct mq_attr *attr = RT_NULL; /* lock posix mqueue list */ @@ -129,8 +128,6 @@ mqd_t mq_open(const char *name, int oflag, ...) if (oflag & O_CREAT) { va_start(arg, oflag); - mode = (mode_t)va_arg(arg, unsigned int); - mode = mode; attr = (struct mq_attr *)va_arg(arg, struct mq_attr *); va_end(arg); diff --git a/components/pthreads/pthread_rwlock.c b/components/pthreads/pthread_rwlock.c index 968c82b89..3e009034c 100644 --- a/components/pthreads/pthread_rwlock.c +++ b/components/pthreads/pthread_rwlock.c @@ -101,7 +101,7 @@ int pthread_rwlock_destroy (pthread_rwlock_t *rwlock) { result = EBUSY; - return(EBUSY); + return result; } else { diff --git a/components/pthreads/semaphore.c b/components/pthreads/semaphore.c index ae69e0d1b..726246c95 100644 --- a/components/pthreads/semaphore.c +++ b/components/pthreads/semaphore.c @@ -224,7 +224,6 @@ sem_t *sem_open(const char *name, int oflag, ...) { sem_t* sem; va_list arg; - mode_t mode; unsigned int value; sem = RT_NULL; @@ -234,7 +233,6 @@ sem_t *sem_open(const char *name, int oflag, ...) if (oflag & O_CREAT) { va_start(arg, oflag); - mode = (mode_t) va_arg( arg, unsigned int); mode = mode; value = va_arg( arg, unsigned int); va_end(arg); diff --git a/examples/kernel/event_simple.c b/examples/kernel/event_simple.c index 927ed928b..e377e721b 100644 --- a/examples/kernel/event_simple.c +++ b/examples/kernel/event_simple.c @@ -7,6 +7,7 @@ * 一个线程定时发送事件 (事件5) */ #include +#include #include "tc_comm.h" /* 指向线程控制块的指针 */ diff --git a/examples/kernel/mutex_simple.c b/examples/kernel/mutex_simple.c index b84cef12b..afbab3a3e 100644 --- a/examples/kernel/mutex_simple.c +++ b/examples/kernel/mutex_simple.c @@ -60,6 +60,10 @@ static void thread3_entry(void* parameter) while (1) { result = rt_mutex_take(mutex, RT_WAITING_FOREVER); + if (result != RT_EOK) + { + tc_stat(TC_STAT_END | TC_STAT_FAILED); + } result = rt_mutex_take(mutex, RT_WAITING_FOREVER); if (result != RT_EOK) { diff --git a/examples/kernel/semaphore_buffer_worker.c b/examples/kernel/semaphore_buffer_worker.c index de4647576..db3285c74 100644 --- a/examples/kernel/semaphore_buffer_worker.c +++ b/examples/kernel/semaphore_buffer_worker.c @@ -178,8 +178,14 @@ static void worker_entry(void* parameter) /* 持有信号量 */ rt_sem_take(sem, RT_WAITING_FOREVER); + /* 把数据放到环形buffer中 */ result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM); + if (result == RT_FALSE) + { + rt_kprintf("put error\n"); + } + /* 释放信号量 */ rt_sem_release(sem); diff --git a/examples/kernel/semaphore_producer_consumer.c b/examples/kernel/semaphore_producer_consumer.c index 48da71430..a240cfa8b 100644 --- a/examples/kernel/semaphore_producer_consumer.c +++ b/examples/kernel/semaphore_producer_consumer.c @@ -59,6 +59,7 @@ void consumer_thread_entry(void* parameter) /* 第n个线程,由入口参数传进来 */ no = (rt_uint32_t)parameter; + sum = 0; while(1) { /* 获取一个满位 */