Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
55e3d212
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
1 年多 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
55e3d212
编写于
8月 07, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
!1008 修复代码书写不规范的问题
Merge pull request !1008 from zzulilyw/master
上级
af895a6e
9e2e59c8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
6 deletion
+10
-6
porting/linux/user/src/network/getnameinfo.c
porting/linux/user/src/network/getnameinfo.c
+5
-3
porting/linux/user/src/network/lookup_name.c
porting/linux/user/src/network/lookup_name.c
+5
-3
未找到文件。
porting/linux/user/src/network/getnameinfo.c
浏览文件 @
55e3d212
...
...
@@ -16,8 +16,10 @@
#define RR_PTR 12
#define BREAK 0
#define CONTINUE 1
#define FIXED_HOSTS_MAX_LENGTH 2
#define FIXED_HOSTS_STR_MAX_LENGTH 23
extern
char
fixed_hosts
[
][
23
];
extern
char
fixed_hosts
[
FIXED_HOSTS_MAX_LENGTH
][
FIXED_HOSTS_STR_MAX_LENGTH
];
static
char
*
itoa
(
char
*
p
,
unsigned
x
)
{
p
+=
3
*
sizeof
(
int
);
...
...
@@ -51,7 +53,7 @@ static inline int get_hosts_str(char *line, int length, FILE *f, int *i)
if
(
f
)
{
return
fgets
(
line
,
sizeof
line
,
f
);
}
if
(
*
i
<
2
)
{
if
(
*
i
<
FIXED_HOSTS_MAX_LENGTH
)
{
memcpy
(
line
,
fixed_hosts
[
*
i
],
strlen
(
fixed_hosts
[
*
i
]));
(
*
i
)
++
;
return
1
;
...
...
@@ -71,7 +73,7 @@ static void reverse_hosts(char *buf, const unsigned char *a, unsigned scopeid, i
a
=
atmp
;
}
int
i
=
0
;
while
(
i
<
2
&&
get_hosts_str
(
line
,
sizeof
line
,
f
,
&
i
))
{
while
(
i
<
FIXED_HOSTS_MAX_LENGTH
&&
get_hosts_str
(
line
,
sizeof
line
,
f
,
&
i
))
{
if
((
p
=
strchr
(
line
,
'#'
)))
*
p
++=
'\n'
,
*
p
=
0
;
for
(
p
=
line
;
*
p
&&
!
isspace
(
*
p
);
p
++
);
...
...
porting/linux/user/src/network/lookup_name.c
浏览文件 @
55e3d212
...
...
@@ -19,8 +19,10 @@
#if OHOS_PERMISSION_INTERNET
uint8_t
is_allow_internet
(
void
);
#endif
#define FIXED_HOSTS_MAX_LENGTH 2
#define FIXED_HOSTS_STR_MAX_LENGTH 23
char
fixed_hosts
[][
23
]
=
{
char
fixed_hosts
[][
FIXED_HOSTS_STR_MAX_LENGTH
]
=
{
"127.0.0.1 localhost
\r\n\0
"
,
"::1 ip6-localhost
\r\n\0
"
};
...
...
@@ -61,7 +63,7 @@ static inline int get_hosts_str(char *line, int length, FILE *f, int *i)
if
(
f
)
{
return
fgets
(
line
,
sizeof
line
,
f
);
}
if
(
*
i
<
2
)
{
if
(
*
i
<
FIXED_HOSTS_MAX_LENGTH
)
{
memcpy
(
line
,
fixed_hosts
[
*
i
],
strlen
(
fixed_hosts
[
*
i
]));
(
*
i
)
++
;
return
1
;
...
...
@@ -77,7 +79,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati
unsigned
char
_buf
[
1032
];
FILE
_f
,
*
f
=
__fopen_rb_ca
(
"/etc/hosts"
,
&
_f
,
_buf
,
sizeof
_buf
);
int
i
=
0
;
while
(
i
<
2
&&
get_hosts_str
(
line
,
sizeof
line
,
f
,
&
i
)
&&
cnt
<
MAXADDRS
)
{
while
(
i
<
FIXED_HOSTS_MAX_LENGTH
&&
get_hosts_str
(
line
,
sizeof
line
,
f
,
&
i
)
&&
cnt
<
MAXADDRS
)
{
char
*
p
,
*
z
;
if
((
p
=
strchr
(
line
,
'#'
)))
*
p
++=
'\n'
,
*
p
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录