diff options
| author | Bernard Xiong <[email protected]> | 2014-04-13 08:35:09 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2014-04-13 08:35:09 +0800 |
| commit | 3022725f53b440d97e6c4f960f2abcc9cf4c5143 (patch) | |
| tree | 5dd94ddbce735341502845f32e5282e40578f6b5 /components | |
| parent | 0c4ac4bd1a93ac1406f87f1d108c54bf14f57d28 (diff) | |
| parent | 5ad58a59a4374e47a69a4d7d78e56a7b03de1156 (diff) | |
Merge pull request #262 from grissiom/misc-fix
Misc fix
Diffstat (limited to 'components')
| -rw-r--r-- | components/dfs/src/dfs_fs.c | 2 | ||||
| -rw-r--r-- | components/finsh/finsh_token.c | 10 | ||||
| -rw-r--r-- | components/finsh/msh.c | 4 | ||||
| -rw-r--r-- | components/libc/minilibc/string.c | 4 | ||||
| -rw-r--r-- | components/pthreads/mqueue.c | 3 | ||||
| -rw-r--r-- | components/pthreads/pthread_rwlock.c | 2 | ||||
| -rw-r--r-- | components/pthreads/semaphore.c | 2 |
7 files changed, 15 insertions, 12 deletions
diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c index 406403e51e..a41f36cf09 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 5ab29ad2aa..3ca21e60db 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 49a5d23591..e585b8d3a1 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 568e9795ef..4969ed2fc6 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 7b669dc367..c1303ae6b1 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 968c82b89f..3e009034cc 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 ae69e0d1bc..726246c95f 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); |
