Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
0beda607
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0beda607
编写于
3月 25, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
3月 25, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2501 from zhaojuntao/fix-rt_vsnprintf-bug
[src/kservice.c] 修复 rt_vsnprintf 函数 bug
上级
c9493837
0f673df0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
23 deletion
+29
-23
src/kservice.c
src/kservice.c
+29
-23
未找到文件。
src/kservice.c
浏览文件 @
0beda607
...
...
@@ -668,7 +668,7 @@ static char *print_number(char *buf,
while
(
size
--
>
0
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
' '
;
++
buf
;
}
...
...
@@ -676,11 +676,11 @@ static char *print_number(char *buf,
if
(
sign
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
{
*
buf
=
sign
;
--
size
;
}
--
size
;
++
buf
;
}
...
...
@@ -689,16 +689,16 @@ static char *print_number(char *buf,
{
if
(
base
==
8
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
'0'
;
++
buf
;
}
else
if
(
base
==
16
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
'0'
;
++
buf
;
if
(
buf
<
=
end
)
if
(
buf
<
end
)
{
*
buf
=
type
&
LARGE
?
'X'
:
'x'
;
}
...
...
@@ -712,7 +712,7 @@ static char *print_number(char *buf,
{
while
(
size
--
>
0
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
c
;
++
buf
;
}
...
...
@@ -721,7 +721,7 @@ static char *print_number(char *buf,
#ifdef RT_PRINTF_PRECISION
while
(
i
<
precision
--
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
'0'
;
++
buf
;
}
...
...
@@ -730,14 +730,14 @@ static char *print_number(char *buf,
/* put number in the temporary buffer */
while
(
i
--
>
0
&&
(
precision_bak
!=
0
))
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
tmp
[
i
];
++
buf
;
}
while
(
size
--
>
0
)
{
if
(
buf
<
=
end
)
if
(
buf
<
end
)
*
buf
=
' '
;
++
buf
;
}
...
...
@@ -769,7 +769,7 @@ rt_int32_t rt_vsnprintf(char *buf,
#endif
str
=
buf
;
end
=
buf
+
size
-
1
;
end
=
buf
+
size
;
/* Make sure end is always >= buf */
if
(
end
<
buf
)
...
...
@@ -782,7 +782,7 @@ rt_int32_t rt_vsnprintf(char *buf,
{
if
(
*
fmt
!=
'%'
)
{
if
(
str
<
=
end
)
if
(
str
<
end
)
*
str
=
*
fmt
;
++
str
;
continue
;
...
...
@@ -863,20 +863,20 @@ rt_int32_t rt_vsnprintf(char *buf,
{
while
(
--
field_width
>
0
)
{
if
(
str
<
=
end
)
*
str
=
' '
;
if
(
str
<
end
)
*
str
=
' '
;
++
str
;
}
}
/* get character */
c
=
(
rt_uint8_t
)
va_arg
(
args
,
int
);
if
(
str
<
=
end
)
*
str
=
c
;
if
(
str
<
end
)
*
str
=
c
;
++
str
;
/* put width */
while
(
--
field_width
>
0
)
{
if
(
str
<
=
end
)
*
str
=
' '
;
if
(
str
<
end
)
*
str
=
' '
;
++
str
;
}
continue
;
...
...
@@ -894,21 +894,21 @@ rt_int32_t rt_vsnprintf(char *buf,
{
while
(
len
<
field_width
--
)
{
if
(
str
<
=
end
)
*
str
=
' '
;
if
(
str
<
end
)
*
str
=
' '
;
++
str
;
}
}
for
(
i
=
0
;
i
<
len
;
++
i
)
{
if
(
str
<
=
end
)
*
str
=
*
s
;
if
(
str
<
end
)
*
str
=
*
s
;
++
str
;
++
s
;
}
while
(
len
<
field_width
--
)
{
if
(
str
<
=
end
)
*
str
=
' '
;
if
(
str
<
end
)
*
str
=
' '
;
++
str
;
}
continue
;
...
...
@@ -931,7 +931,7 @@ rt_int32_t rt_vsnprintf(char *buf,
continue
;
case
'%'
:
if
(
str
<
=
end
)
*
str
=
'%'
;
if
(
str
<
end
)
*
str
=
'%'
;
++
str
;
continue
;
...
...
@@ -953,12 +953,12 @@ rt_int32_t rt_vsnprintf(char *buf,
break
;
default:
if
(
str
<
=
end
)
*
str
=
'%'
;
if
(
str
<
end
)
*
str
=
'%'
;
++
str
;
if
(
*
fmt
)
{
if
(
str
<
=
end
)
*
str
=
*
fmt
;
if
(
str
<
end
)
*
str
=
*
fmt
;
++
str
;
}
else
...
...
@@ -995,8 +995,14 @@ rt_int32_t rt_vsnprintf(char *buf,
#endif
}
if
(
str
<=
end
)
*
str
=
'\0'
;
else
*
end
=
'\0'
;
if
(
size
>
0
)
{
if
(
str
<
end
)
*
str
=
'\0'
;
else
{
end
[
-
1
]
=
'\0'
;
}
}
/* the trailing null byte doesn't count towards the total
* ++str;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录