Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Iniparser
提交
e3296f21
T
Third Party Iniparser
项目概览
OpenHarmony
/
Third Party Iniparser
大约 1 年 前同步成功
通知
0
Star
24
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Iniparser
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e3296f21
编写于
7月 29, 2016
作者:
L
linghuazaii
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change int64_t to long int and delete exclude stdint.h
上级
861c4a85
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
19 deletion
+14
-19
src/iniparser.c
src/iniparser.c
+9
-12
src/iniparser.h
src/iniparser.h
+2
-3
test/CuTest.c
test/CuTest.c
+1
-1
test/CuTest.h
test/CuTest.h
+1
-2
test/test_iniparser.c
test/test_iniparser.c
+1
-1
未找到文件。
src/iniparser.c
浏览文件 @
e3296f21
...
...
@@ -390,7 +390,7 @@ const char * iniparser_getstring(const dictionary * d, const char * key, const c
/*-------------------------------------------------------------------------*/
/**
@brief Get the string associated to a key, convert to an int
@brief Get the string associated to a key, convert to an
long
int
@param d Dictionary to search
@param key Key string to look for
@param notfound Value to return in case of error
...
...
@@ -411,22 +411,21 @@ const char * iniparser_getstring(const dictionary * d, const char * key, const c
Warning: the conversion may overflow in various ways. Conversion is
totally outsourced to strtol(), see the associated man page for overflow
handling.
Credits: Thanks to A. Becker for suggesting strtol()
*/
/*--------------------------------------------------------------------------*/
int
iniparser_getint
(
const
dictionary
*
d
,
const
char
*
key
,
int
notfound
)
long
int
iniparser_getlongint
(
const
dictionary
*
d
,
const
char
*
key
,
long
int
notfound
)
{
const
char
*
str
;
str
=
iniparser_getstring
(
d
,
key
,
INI_INVALID_KEY
);
if
(
str
==
INI_INVALID_KEY
)
return
notfound
;
return
(
int
)
strtol
(
str
,
NULL
,
0
);
return
strtol
(
str
,
NULL
,
0
);
}
/*-------------------------------------------------------------------------*/
/**
@brief Get the string associated to a key, convert to an int
64_t
@brief Get the string associated to a key, convert to an int
@param d Dictionary to search
@param key Key string to look for
@param notfound Value to return in case of error
...
...
@@ -447,15 +446,13 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound)
Warning: the conversion may overflow in various ways. Conversion is
totally outsourced to strtol(), see the associated man page for overflow
handling.
Credits: Thanks to A. Becker for suggesting strtol()
*/
/*--------------------------------------------------------------------------*/
int
64_t
iniparser_getlongint
(
const
dictionary
*
d
,
const
char
*
key
,
int64_
t
notfound
)
int
iniparser_getint
(
const
dictionary
*
d
,
const
char
*
key
,
in
t
notfound
)
{
const
char
*
str
;
str
=
iniparser_getstring
(
d
,
key
,
INI_INVALID_KEY
);
if
(
str
==
INI_INVALID_KEY
)
return
notfound
;
return
strtol
(
str
,
NULL
,
0
);
return
(
int
)
iniparser_getlongint
(
d
,
key
,
notfound
);
}
/*-------------------------------------------------------------------------*/
...
...
src/iniparser.h
浏览文件 @
e3296f21
...
...
@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
/*
* The following #include is necessary on many Unixes but not Linux.
...
...
@@ -193,7 +192,7 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound);
/*-------------------------------------------------------------------------*/
/**
@brief Get the string associated to a key, convert to an
int64_
t
@brief Get the string associated to a key, convert to an
long in
t
@param d Dictionary to search
@param key Key string to look for
@param notfound Value to return in case of error
...
...
@@ -216,7 +215,7 @@ int iniparser_getint(const dictionary * d, const char * key, int notfound);
handling.
*/
/*--------------------------------------------------------------------------*/
int64_t
iniparser_getlongint
(
const
dictionary
*
d
,
const
char
*
key
,
int64_
t
notfound
);
long
int
iniparser_getlongint
(
const
dictionary
*
d
,
const
char
*
key
,
long
in
t
notfound
);
/*-------------------------------------------------------------------------*/
...
...
test/CuTest.c
浏览文件 @
e3296f21
...
...
@@ -212,7 +212,7 @@ void CuAssertIntEquals_LineMsg(CuTest* tc, const char* file, int line, const cha
}
void
CuAssertLongIntEquals_LineMsg
(
CuTest
*
tc
,
const
char
*
file
,
int
line
,
const
char
*
message
,
int64_t
expected
,
int64_
t
actual
)
long
int
expected
,
long
in
t
actual
)
{
char
buf
[
STRING_MAX
];
if
(
expected
==
actual
)
return
;
...
...
test/CuTest.h
浏览文件 @
e3296f21
...
...
@@ -3,7 +3,6 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stdint.h>
#define CUTEST_VERSION "CuTest 1.5"
...
...
@@ -67,7 +66,7 @@ void CuAssertIntEquals_LineMsg(CuTest* tc,
int
expected
,
int
actual
);
void
CuAssertLongIntEquals_LineMsg
(
CuTest
*
tc
,
const
char
*
file
,
int
line
,
const
char
*
message
,
int64_t
expected
,
int64_
t
actual
);
long
int
expected
,
long
in
t
actual
);
void
CuAssertDblEquals_LineMsg
(
CuTest
*
tc
,
const
char
*
file
,
int
line
,
const
char
*
message
,
double
expected
,
double
actual
,
double
delta
);
...
...
test/test_iniparser.c
浏览文件 @
e3296f21
...
...
@@ -343,7 +343,7 @@ void Test_iniparser_getlongint(CuTest *tc)
unsigned
i
;
char
key_name
[
64
];
dictionary
*
dic
;
const
struct
{
int64_
t
num
;
const
char
*
value
;
}
good_val
[]
=
{
const
struct
{
long
in
t
num
;
const
char
*
value
;
}
good_val
[]
=
{
{
0
,
"0"
},
{
1
,
"1"
},
{
-
1
,
"-1"
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录