Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party CJSON
提交
b056d7cb
T
Third Party CJSON
项目概览
OpenHarmony
/
Third Party CJSON
大约 1 年 前同步成功
通知
6
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party CJSON
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b056d7cb
编写于
3月 01, 2017
作者:
M
Max Bruckner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add -Wcomma compiler flag
上级
899529e8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
13 deletion
+14
-13
CMakeLists.txt
CMakeLists.txt
+1
-0
cJSON.c
cJSON.c
+2
-2
cJSON_Utils.c
cJSON_Utils.c
+9
-9
tests/parse_array.c
tests/parse_array.c
+1
-1
tests/parse_object.c
tests/parse_object.c
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
b056d7cb
...
...
@@ -40,6 +40,7 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS)
-Wconversion
-Wc++-compat
-fstack-protector-strong
-Wcomma
)
endif
()
...
...
cJSON.c
浏览文件 @
b056d7cb
...
...
@@ -68,7 +68,7 @@ static int cJSON_strcasecmp(const unsigned char *s1, const unsigned char *s2)
{
return
1
;
}
for
(;
tolower
(
*
s1
)
==
tolower
(
*
s2
);
++
s1
,
++
s2
)
for
(;
tolower
(
*
s1
)
==
tolower
(
*
s2
);
(
void
)
++
s1
,
++
s2
)
{
if
(
*
s1
==
'\0'
)
{
...
...
@@ -731,7 +731,7 @@ static unsigned char *print_string_ptr(const unsigned char * const input, printb
output
[
0
]
=
'\"'
;
output_pointer
=
output
+
1
;
/* copy the string */
for
(
input_pointer
=
input
;
*
input_pointer
!=
'\0'
;
input_pointer
++
,
output_pointer
++
)
for
(
input_pointer
=
input
;
*
input_pointer
!=
'\0'
;
(
void
)
input_pointer
++
,
output_pointer
++
)
{
if
((
*
input_pointer
>
31
)
&&
(
*
input_pointer
!=
'\"'
)
&&
(
*
input_pointer
!=
'\\'
))
{
...
...
cJSON_Utils.c
浏览文件 @
b056d7cb
...
...
@@ -31,7 +31,7 @@ static int cJSONUtils_strcasecmp(const unsigned char *s1, const unsigned char *s
{
return
1
;
}
for
(;
tolower
(
*
s1
)
==
tolower
(
*
s2
);
++
s1
,
++
s2
)
for
(;
tolower
(
*
s1
)
==
tolower
(
*
s2
);
(
void
)
++
s1
,
++
s2
)
{
if
(
*
s1
==
0
)
{
...
...
@@ -49,7 +49,7 @@ static int cJSONUtils_Pstrcasecmp(const unsigned char *a, const unsigned char *e
{
return
(
a
==
e
)
?
0
:
1
;
/* both NULL? */
}
for
(;
*
a
&&
*
e
&&
(
*
e
!=
'/'
);
a
++
,
e
++
)
/* compare until next '/' */
for
(;
*
a
&&
*
e
&&
(
*
e
!=
'/'
);
(
void
)
a
++
,
e
++
)
/* compare until next '/' */
{
if
(
*
e
==
'~'
)
{
...
...
@@ -81,7 +81,7 @@ static int cJSONUtils_Pstrcasecmp(const unsigned char *a, const unsigned char *e
static
size_t
cJSONUtils_PointerEncodedstrlen
(
const
unsigned
char
*
s
)
{
size_t
l
=
0
;
for
(;
*
s
;
s
++
,
l
++
)
for
(;
*
s
;
(
void
)
s
++
,
l
++
)
{
if
((
*
s
==
'~'
)
||
(
*
s
==
'/'
))
{
...
...
@@ -127,7 +127,7 @@ CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(cJSON *object, cJSON *ta
}
/* recursively search all children of the object */
for
(
obj
=
object
->
child
;
obj
;
obj
=
obj
->
next
,
c
++
)
for
(
obj
=
object
->
child
;
obj
;
(
void
)(
obj
=
obj
->
next
)
,
c
++
)
{
unsigned
char
*
found
=
(
unsigned
char
*
)
cJSONUtils_FindPointerFromObjectTo
(
obj
,
target
);
if
(
found
)
...
...
@@ -226,7 +226,7 @@ static void cJSONUtils_InplaceDecodePointerString(unsigned char *string)
return
;
}
for
(;
*
string
;
s2
++
,
string
++
)
for
(;
*
string
;
(
void
)
s2
++
,
string
++
)
{
*
s2
=
(
*
string
!=
'~'
)
?
(
*
string
)
...
...
@@ -298,7 +298,7 @@ static int cJSONUtils_Compare(cJSON *a, cJSON *b)
/* string mismatch. */
return
(
strcmp
(
a
->
valuestring
,
b
->
valuestring
)
!=
0
)
?
-
3
:
0
;
case
cJSON_Array
:
for
(
a
=
a
->
child
,
b
=
b
->
child
;
a
&&
b
;
a
=
a
->
next
,
b
=
b
->
next
)
for
(
(
void
)(
a
=
a
->
child
),
b
=
b
->
child
;
a
&&
b
;
(
void
)(
a
=
a
->
next
)
,
b
=
b
->
next
)
{
int
err
=
cJSONUtils_Compare
(
a
,
b
);
if
(
err
)
...
...
@@ -589,7 +589,7 @@ static void cJSONUtils_CompareToPatch(cJSON *patches, const unsigned char *path,
size_t
c
=
0
;
unsigned
char
*
newpath
=
(
unsigned
char
*
)
malloc
(
strlen
((
const
char
*
)
path
)
+
23
);
/* Allow space for 64bit int. */
/* generate patches for all array elements that exist in "from" and "to" */
for
(
c
=
0
,
from
=
from
->
child
,
to
=
to
->
child
;
from
&&
to
;
from
=
from
->
next
,
to
=
to
->
next
,
c
++
)
for
(
(
void
)(
c
=
0
),
(
void
)(
from
=
from
->
child
),
to
=
to
->
child
;
from
&&
to
;
(
void
)(
from
=
from
->
next
),
(
void
)(
to
=
to
->
next
)
,
c
++
)
{
/* check if conversion to unsigned long is valid
* This should be eliminated at compile time by dead code elimination
...
...
@@ -603,7 +603,7 @@ static void cJSONUtils_CompareToPatch(cJSON *patches, const unsigned char *path,
cJSONUtils_CompareToPatch
(
patches
,
newpath
,
from
,
to
);
}
/* remove leftover elements from 'from' that are not in 'to' */
for
(;
from
;
from
=
from
->
next
,
c
++
)
for
(;
from
;
(
void
)(
from
=
from
->
next
)
,
c
++
)
{
/* check if conversion to unsigned long is valid
* This should be eliminated at compile time by dead code elimination
...
...
@@ -617,7 +617,7 @@ static void cJSONUtils_CompareToPatch(cJSON *patches, const unsigned char *path,
cJSONUtils_GeneratePatch
(
patches
,
(
const
unsigned
char
*
)
"remove"
,
path
,
newpath
,
0
);
}
/* add new elements in 'to' that were not in 'from' */
for
(;
to
;
to
=
to
->
next
,
c
++
)
for
(;
to
;
(
void
)(
to
=
to
->
next
)
,
c
++
)
{
cJSONUtils_GeneratePatch
(
patches
,
(
const
unsigned
char
*
)
"add"
,
path
,
(
const
unsigned
char
*
)
"-"
,
to
);
}
...
...
tests/parse_array.c
浏览文件 @
b056d7cb
...
...
@@ -124,7 +124,7 @@ static void parse_array_should_parse_arrays_with_multiple_elements(void)
i
=
0
;
(
i
<
(
sizeof
(
expected_types
)
/
sizeof
(
int
)))
&&
(
node
!=
NULL
);
i
++
,
node
=
node
->
next
)
(
void
)
i
++
,
node
=
node
->
next
)
{
TEST_ASSERT_BITS
(
0xFF
,
expected_types
[
i
],
node
->
type
);
}
...
...
tests/parse_object.c
浏览文件 @
b056d7cb
...
...
@@ -134,7 +134,7 @@ static void parse_object_should_parse_objects_with_multiple_elements(void)
i
=
0
;
(
i
<
(
sizeof
(
expected_types
)
/
sizeof
(
int
)))
&&
(
node
!=
NULL
);
i
++
,
node
=
node
->
next
)
(
void
)
i
++
,
node
=
node
->
next
)
{
assert_is_child
(
node
,
expected_names
[
i
],
expected_types
[
i
]);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录