Merge pull request #262 from grissiom/misc-fix

Misc fix
This commit is contained in:
Bernard Xiong 2014-04-13 08:35:09 +08:00
commit 3022725f53
11 changed files with 27 additions and 12 deletions

View File

@ -85,6 +85,8 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path)
prefixlen = 0; prefixlen = 0;
RT_ASSERT(path);
/* lock filesystem */ /* lock filesystem */
dfs_lock(); dfs_lock();

View File

@ -508,10 +508,10 @@ static void token_proc_number(struct finsh_token* self)
*p = '\0'; *p = '\0';
} }
else else if ( '0' <= ch && ch <= '7' )
{ {
b = 8; b = 8;
while ( is_digit(ch) ) while ( '0' <= ch && ch <= '7' )
{ {
*p++ = ch; *p++ = ch;
ch = token_next_char(self); ch = token_next_char(self);
@ -519,6 +519,12 @@ static void token_proc_number(struct finsh_token* self)
*p = '\0'; *p = '\0';
} }
else
{
/* Not a valid number */
token_prev_char(self);
return;
}
self->value.int_value = token_spec_number(buf, strlen(buf), b); self->value.int_value = token_spec_number(buf, strlen(buf), b);
self->current_token = finsh_token_type_value_int; self->current_token = finsh_token_type_value_int;

View File

@ -358,7 +358,6 @@ void msh_auto_complete_path(char *path)
full_path = (char*)rt_malloc(256); full_path = (char*)rt_malloc(256);
if (full_path == RT_NULL) return; /* out of memory */ if (full_path == RT_NULL) return; /* out of memory */
ptr = full_path;
if (*path != '/') if (*path != '/')
{ {
getcwd(full_path, 256); getcwd(full_path, 256);
@ -367,7 +366,8 @@ void msh_auto_complete_path(char *path)
} }
else *full_path = '\0'; else *full_path = '\0';
index = RT_NULL; ptr = path; index = RT_NULL;
ptr = path;
for (;;) for (;;)
{ {
if (*ptr == '/') index = ptr + 1; if (!*ptr) break; ptr ++; if (*ptr == '/') index = ptr + 1; if (!*ptr) break; ptr ++;

View File

@ -146,10 +146,10 @@ int strncasecmp ( const char* s1, const char* s2, size_t len )
x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32; x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32;
s1++; s2++; s1++; s2++;
if ((x2 != x1)) if (x2 != x1)
break; break;
if ((x1 == (unsigned int)-'A')) if (x1 == (unsigned int)-'A')
break; break;
} }

View File

@ -119,7 +119,6 @@ mqd_t mq_open(const char *name, int oflag, ...)
{ {
mqd_t mqdes; mqd_t mqdes;
va_list arg; va_list arg;
mode_t mode;
struct mq_attr *attr = RT_NULL; struct mq_attr *attr = RT_NULL;
/* lock posix mqueue list */ /* lock posix mqueue list */
@ -129,8 +128,6 @@ mqd_t mq_open(const char *name, int oflag, ...)
if (oflag & O_CREAT) if (oflag & O_CREAT)
{ {
va_start(arg, oflag); va_start(arg, oflag);
mode = (mode_t)va_arg(arg, unsigned int);
mode = mode;
attr = (struct mq_attr *)va_arg(arg, struct mq_attr *); attr = (struct mq_attr *)va_arg(arg, struct mq_attr *);
va_end(arg); va_end(arg);

View File

@ -101,7 +101,7 @@ int pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
{ {
result = EBUSY; result = EBUSY;
return(EBUSY); return result;
} }
else else
{ {

View File

@ -224,7 +224,6 @@ sem_t *sem_open(const char *name, int oflag, ...)
{ {
sem_t* sem; sem_t* sem;
va_list arg; va_list arg;
mode_t mode;
unsigned int value; unsigned int value;
sem = RT_NULL; sem = RT_NULL;
@ -234,7 +233,6 @@ sem_t *sem_open(const char *name, int oflag, ...)
if (oflag & O_CREAT) if (oflag & O_CREAT)
{ {
va_start(arg, oflag); va_start(arg, oflag);
mode = (mode_t) va_arg( arg, unsigned int); mode = mode;
value = va_arg( arg, unsigned int); value = va_arg( arg, unsigned int);
va_end(arg); va_end(arg);

View File

@ -7,6 +7,7 @@
* 线 (5) * 线 (5)
*/ */
#include <rtthread.h> #include <rtthread.h>
#include <time.h>
#include "tc_comm.h" #include "tc_comm.h"
/* 指向线程控制块的指针 */ /* 指向线程控制块的指针 */

View File

@ -60,6 +60,10 @@ static void thread3_entry(void* parameter)
while (1) while (1)
{ {
result = rt_mutex_take(mutex, RT_WAITING_FOREVER); 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); result = rt_mutex_take(mutex, RT_WAITING_FOREVER);
if (result != RT_EOK) if (result != RT_EOK)
{ {

View File

@ -178,8 +178,14 @@ static void worker_entry(void* parameter)
/* 持有信号量 */ /* 持有信号量 */
rt_sem_take(sem, RT_WAITING_FOREVER); rt_sem_take(sem, RT_WAITING_FOREVER);
/* 把数据放到环形buffer中 */ /* 把数据放到环形buffer中 */
result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM); result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM);
if (result == RT_FALSE)
{
rt_kprintf("put error\n");
}
/* 释放信号量 */ /* 释放信号量 */
rt_sem_release(sem); rt_sem_release(sem);

View File

@ -59,6 +59,7 @@ void consumer_thread_entry(void* parameter)
/* 第n个线程由入口参数传进来 */ /* 第n个线程由入口参数传进来 */
no = (rt_uint32_t)parameter; no = (rt_uint32_t)parameter;
sum = 0;
while(1) while(1)
{ {
/* 获取一个满位 */ /* 获取一个满位 */