Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
dc9a5f88
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看板
提交
dc9a5f88
编写于
10月 23, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[name] Do record sanitization at run-time
上级
a53d301b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
37 deletion
+49
-37
src/hb-dsalgs.hh
src/hb-dsalgs.hh
+34
-28
src/hb-ot-name-table.hh
src/hb-ot-name-table.hh
+14
-8
src/hb-ot-name.cc
src/hb-ot-name.cc
+1
-1
未找到文件。
src/hb-dsalgs.hh
浏览文件 @
dc9a5f88
...
...
@@ -530,6 +530,35 @@ struct hb_auto_t : Type
void
fini
(
void
)
{}
};
struct
hb_bytes_t
{
inline
hb_bytes_t
(
void
)
:
arrayZ
(
nullptr
),
len
(
0
)
{}
inline
hb_bytes_t
(
const
char
*
bytes_
,
unsigned
int
len_
)
:
arrayZ
(
bytes_
),
len
(
len_
)
{}
inline
hb_bytes_t
(
const
void
*
bytes_
,
unsigned
int
len_
)
:
arrayZ
((
const
char
*
)
bytes_
),
len
(
len_
)
{}
template
<
typename
T
>
inline
hb_bytes_t
(
const
T
&
array
)
:
arrayZ
((
const
char
*
)
array
.
arrayZ
),
len
(
array
.
len
)
{}
inline
void
free
(
void
)
{
::
free
((
void
*
)
arrayZ
);
arrayZ
=
nullptr
;
len
=
0
;
}
inline
int
cmp
(
const
hb_bytes_t
&
a
)
const
{
if
(
len
!=
a
.
len
)
return
(
int
)
a
.
len
-
(
int
)
len
;
return
memcmp
(
a
.
arrayZ
,
arrayZ
,
len
);
}
static
inline
int
cmp
(
const
void
*
pa
,
const
void
*
pb
)
{
hb_bytes_t
*
a
=
(
hb_bytes_t
*
)
pa
;
hb_bytes_t
*
b
=
(
hb_bytes_t
*
)
pb
;
return
b
->
cmp
(
*
a
);
}
const
char
*
arrayZ
;
unsigned
int
len
;
};
template
<
typename
T
>
struct
hb_array_t
{
...
...
@@ -553,6 +582,11 @@ struct hb_array_t
return
hb_array_t
<
T
>
(
arrayZ
+
start_offset
,
count
);
}
inline
hb_bytes_t
as_bytes
(
void
)
const
{
return
hb_bytes_t
(
arrayZ
,
len
*
sizeof
(
T
));
}
inline
void
free
(
void
)
{
::
free
((
void
*
)
arrayZ
);
arrayZ
=
nullptr
;
len
=
0
;
}
T
*
arrayZ
;
...
...
@@ -561,34 +595,6 @@ struct hb_array_t
template
<
typename
T
>
static
inline
hb_array_t
<
T
>
hb_array
(
T
*
array
,
unsigned
int
len
)
{
return
hb_array_t
<
T
>
(
array
,
len
);
}
struct
hb_bytes_t
{
inline
hb_bytes_t
(
void
)
:
arrayZ
(
nullptr
),
len
(
0
)
{}
inline
hb_bytes_t
(
const
char
*
bytes_
,
unsigned
int
len_
)
:
arrayZ
(
bytes_
),
len
(
len_
)
{}
inline
hb_bytes_t
(
const
void
*
bytes_
,
unsigned
int
len_
)
:
arrayZ
((
const
char
*
)
bytes_
),
len
(
len_
)
{}
template
<
typename
T
>
inline
hb_bytes_t
(
const
T
&
array
)
:
arrayZ
((
const
char
*
)
array
.
arrayZ
),
len
(
array
.
len
)
{}
inline
void
free
(
void
)
{
::
free
((
void
*
)
arrayZ
);
arrayZ
=
nullptr
;
len
=
0
;
}
inline
int
cmp
(
const
hb_bytes_t
&
a
)
const
{
if
(
len
!=
a
.
len
)
return
(
int
)
a
.
len
-
(
int
)
len
;
return
memcmp
(
a
.
arrayZ
,
arrayZ
,
len
);
}
static
inline
int
cmp
(
const
void
*
pa
,
const
void
*
pb
)
{
hb_bytes_t
*
a
=
(
hb_bytes_t
*
)
pa
;
hb_bytes_t
*
b
=
(
hb_bytes_t
*
)
pb
;
return
b
->
cmp
(
*
a
);
}
const
char
*
arrayZ
;
unsigned
int
len
;
};
struct
HbOpOr
{
...
...
src/hb-ot-name-table.hh
浏览文件 @
dc9a5f88
...
...
@@ -152,13 +152,6 @@ struct name
{
static
const
hb_tag_t
tableTag
=
HB_OT_TAG_name
;
inline
hb_bytes_t
get_name
(
unsigned
int
idx
)
const
{
const
hb_array_t
<
const
NameRecord
>
all_names
(
nameRecordZ
.
arrayZ
,
count
);
const
NameRecord
&
record
=
all_names
[
idx
];
return
hb_bytes_t
((
const
char
*
)
(
this
+
stringOffset
).
arrayZ
+
record
.
offset
,
record
.
length
);
}
inline
unsigned
int
get_size
(
void
)
const
{
return
min_size
+
count
*
nameRecordZ
[
0
].
min_size
;
}
...
...
@@ -178,7 +171,7 @@ struct name
return_trace
(
c
->
check_struct
(
this
)
&&
likely
(
format
==
0
||
format
==
1
)
&&
c
->
check_array
(
nameRecordZ
.
arrayZ
,
count
)
&&
sanitize_records
(
c
));
c
->
check_range
(
this
,
stringOffset
));
}
struct
accelerator_t
...
...
@@ -187,6 +180,9 @@ struct name
{
this
->
blob
=
hb_sanitize_context_t
().
reference_table
<
name
>
(
face
);
this
->
table
=
this
->
blob
->
as
<
name
>
();
assert
(
this
->
blob
->
length
>=
this
->
table
->
stringOffset
);
this
->
pool
=
(
this
->
table
+
this
->
table
->
stringOffset
).
arrayZ
;
this
->
pool_len
=
this
->
blob
->
length
-
this
->
table
->
stringOffset
;
const
hb_array_t
<
const
NameRecord
>
all_names
(
this
->
table
->
nameRecordZ
.
arrayZ
,
this
->
table
->
count
);
...
...
@@ -246,8 +242,18 @@ struct name
return
entry
->
entry_index
;
}
inline
hb_bytes_t
get_name
(
unsigned
int
idx
)
const
{
const
hb_array_t
<
const
NameRecord
>
all_names
(
table
->
nameRecordZ
.
arrayZ
,
table
->
count
);
const
NameRecord
&
record
=
all_names
[
idx
];
const
hb_array_t
<
const
char
>
string_pool
((
const
char
*
)
pool
,
pool_len
);
return
string_pool
.
sub_array
(
record
.
offset
,
record
.
length
).
as_bytes
();
}
private:
hb_blob_t
*
blob
;
const
void
*
pool
;
unsigned
int
pool_len
;
public:
const
name
*
table
;
hb_vector_t
<
hb_ot_name_entry_t
>
names
;
...
...
src/hb-ot-name.cc
浏览文件 @
dc9a5f88
...
...
@@ -110,7 +110,7 @@ hb_ot_name_get_utf (hb_face_t *face,
int
idx
=
name
.
get_index
(
name_id
,
language
,
&
width
);
if
(
idx
!=
-
1
)
{
hb_bytes_t
bytes
=
name
.
table
->
get_name
(
idx
);
hb_bytes_t
bytes
=
name
.
get_name
(
idx
);
if
(
width
==
2
)
/* UTF16-BE */
return
hb_ot_name_convert_utf
<
hb_utf16_be_t
,
utf_t
>
(
&
bytes
,
text_size
,
text
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录