Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
7b4099f3
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
1 年多 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7b4099f3
编写于
6月 27, 2018
作者:
E
Ebrahim Byagowi
提交者:
GitHub
6月 27, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor, rename blob to data on blob_from_file
上级
fa090ed4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
9 deletion
+9
-9
src/hb-blob.cc
src/hb-blob.cc
+9
-9
未找到文件。
src/hb-blob.cc
浏览文件 @
7b4099f3
...
...
@@ -593,10 +593,10 @@ fail_without_close:
#endif
// The following tries to read a file without knowing its size beforehand
// It's used
for systems without mmap concept
or to read from pipes
// It's used
as a fallback for systems without mmap
or to read from pipes
unsigned
long
len
=
0
,
allocated
=
BUFSIZ
*
16
;
char
*
blob
=
(
char
*
)
malloc
(
allocated
);
if
(
unlikely
(
blob
==
nullptr
))
return
hb_blob_get_empty
();
char
*
data
=
(
char
*
)
malloc
(
allocated
);
if
(
unlikely
(
data
==
nullptr
))
return
hb_blob_get_empty
();
FILE
*
fp
=
fopen
(
file_name
,
"rb"
);
if
(
unlikely
(
fp
==
nullptr
))
goto
fread_fail_without_close
;
...
...
@@ -609,12 +609,12 @@ fail_without_close:
// Don't allocate and go more than ~536MB, our mmap reader still
// can cover files like that but lets limit our fallback reader
if
(
unlikely
(
allocated
>
(
2
<<
28
)))
goto
fread_fail
;
char
*
new_
blob
=
(
char
*
)
realloc
(
blob
,
allocated
);
if
(
unlikely
(
new_
blob
==
nullptr
))
goto
fread_fail
;
blob
=
new_blob
;
char
*
new_
data
=
(
char
*
)
realloc
(
data
,
allocated
);
if
(
unlikely
(
new_
data
==
nullptr
))
goto
fread_fail
;
data
=
new_data
;
}
unsigned
long
addition
=
fread
(
blob
+
len
,
1
,
allocated
-
len
,
fp
);
unsigned
long
addition
=
fread
(
data
+
len
,
1
,
allocated
-
len
,
fp
);
int
err
=
ferror
(
fp
);
if
(
unlikely
(
err
==
EINTR
))
continue
;
...
...
@@ -623,12 +623,12 @@ fail_without_close:
len
+=
addition
;
}
return
hb_blob_create
(
blob
,
len
,
HB_MEMORY_MODE_WRITABLE
,
blob
,
return
hb_blob_create
(
data
,
len
,
HB_MEMORY_MODE_WRITABLE
,
data
,
(
hb_destroy_func_t
)
free
);
fread_fail:
fclose
(
fp
);
fread_fail_without_close:
free
(
blob
);
free
(
data
);
return
hb_blob_get_empty
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录