diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c index 406403e51e24b95c2b6cd57a135eb1984a569b9b..a41f36cf09a33347418e434b0f2c1995a4f62ef6 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 5ab29ad2aadbbc704935b53cf01b2e92692dae37..3ca21e60dbfed45efe57db83eac6a7cf9d709f5e 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 49a5d235914f7020dfc9b1fd7e5ad4aabd66ea0e..e585b8d3a1c9486cf6de4a3ce329b41dea8910c9 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 568e9795ef4a174b542f195538213c1656087141..4969ed2fc67ffbcf48047eb37efbf2255a8a1ea7 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 7b669dc3678093958fcb2b19fb4b35d478bdc6cb..c1303ae6b17afb841d02f67eb07121da3d142919 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 968c82b89f224b4da0b6315430480d3682935559..3e009034cc006b1914fb4c9f941a8885dc3b06a9 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 ae69e0d1bc7547c7a9019710c2907e610fd71632..726246c95f077c18bf20e76948371f11a125fe03 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 927ed928b836dfddad72c6da7e4b431a658b156b..e377e721bb22831a08b37f687409d6843ca99ad9 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 b84cef12bfbcdb5744d1b41a3c89cfc16d0561cc..afbab3a3e12131c0e55460bb715a3f5c6d902593 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 de4647576940bc93970c2c6d2551a4705d008459..db3285c74bff6458ccfae1104fdc31dccd3fdbbc 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 48da71430656c37701da612597c09c952c00f309..a240cfa8b2a369f2883b7f36d9c13bd3283cbec3 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) { /* 获取一个满位 */