Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
20f31347
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看板
提交
20f31347
编写于
4月 23, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use variadic templates in OffsetTo<> and various ArrayOf<>s
上级
64ca2ffa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
96 deletion
+49
-96
src/hb-open-type.hh
src/hb-open-type.hh
+49
-96
未找到文件。
src/hb-open-type.hh
浏览文件 @
20f31347
...
...
@@ -284,8 +284,8 @@ struct OffsetTo : Offset<OffsetType, has_null>
return
*
(
Type
*
)
Offset
<
OffsetType
>::
serialize
(
c
,
base
);
}
template
<
typename
T
>
bool
serialize_subset
(
hb_subset_context_t
*
c
,
const
T
&
src
,
const
void
*
base
)
template
<
typename
T
,
typename
...
Ts
>
bool
serialize_subset
(
hb_subset_context_t
*
c
,
const
T
&
src
,
const
void
*
base
,
Ts
...
ds
)
{
*
this
=
0
;
if
(
has_null
&&
&
src
==
&
Null
(
T
))
...
...
@@ -295,7 +295,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
s
->
push
();
bool
ret
=
src
.
subset
(
c
);
bool
ret
=
src
.
subset
(
c
,
ds
...
);
if
(
ret
||
!
has_null
)
s
->
add_link
(
*
this
,
s
->
pop_pack
(),
base
);
...
...
@@ -314,39 +314,13 @@ struct OffsetTo : Offset<OffsetType, has_null>
return_trace
(
true
);
}
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
sanitize_shallow
(
c
,
base
)
&&
(
this
->
is_null
()
||
StructAtOffset
<
Type
>
(
base
,
*
this
).
sanitize
(
c
)
||
neuter
(
c
)));
}
template
<
typename
T1
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T1
d1
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
sanitize_shallow
(
c
,
base
)
&&
(
this
->
is_null
()
||
StructAtOffset
<
Type
>
(
base
,
*
this
).
sanitize
(
c
,
d1
)
||
neuter
(
c
)));
}
template
<
typename
T1
,
typename
T2
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T1
d1
,
T2
d2
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
sanitize_shallow
(
c
,
base
)
&&
(
this
->
is_null
()
||
StructAtOffset
<
Type
>
(
base
,
*
this
).
sanitize
(
c
,
d1
,
d2
)
||
neuter
(
c
)));
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T1
d1
,
T2
d2
,
T3
d3
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
Ts
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
sanitize_shallow
(
c
,
base
)
&&
(
this
->
is_null
()
||
StructAtOffset
<
Type
>
(
base
,
*
this
).
sanitize
(
c
,
d
1
,
d2
,
d3
)
||
StructAtOffset
<
Type
>
(
base
,
*
this
).
sanitize
(
c
,
d
s
...
)
||
neuter
(
c
)));
}
...
...
@@ -430,29 +404,26 @@ struct UnsizedArrayOf
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* pointed to do have a simple sanitize() as well as an
* assignment opreator. This ensures that they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
arrayZ
[
0
].
sanitize
(
c
));
if
(
false
)
{
arrayZ
[
0
].
sanitize
(
c
);
Type
v
;
v
=
arrayZ
[
0
];
}
return_trace
(
true
);
}
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
,
T
user_data
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
,
Ts
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
user_data
)))
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
ds
...
)))
return_trace
(
false
);
return_trace
(
true
);
}
...
...
@@ -492,17 +463,12 @@ struct UnsizedOffsetListOf : UnsizedOffsetArrayOf<Type, OffsetType, has_null>
return
this
+*
p
;
}
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
Ts
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
,
has_null
>::
sanitize
(
c
,
count
,
this
)));
}
template
<
typename
T
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
,
has_null
>::
sanitize
(
c
,
count
,
this
,
user_data
)));
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
,
has_null
>
::
sanitize
(
c
,
count
,
this
,
ds
...)));
}
};
...
...
@@ -622,24 +588,14 @@ struct ArrayOf
return_trace
(
true
);
}
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T
user_data
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
Ts
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
user_data
)))
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
ds
...
)))
return_trace
(
false
);
return_trace
(
true
);
}
...
...
@@ -706,16 +662,11 @@ struct OffsetListOf : OffsetArrayOf<Type>
return_trace
(
true
);
}
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
OffsetArrayOf
<
Type
>::
sanitize
(
c
,
this
));
}
template
<
typename
T
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
T
user_data
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
Ts
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
OffsetArrayOf
<
Type
>::
sanitize
(
c
,
this
,
user_data
));
return_trace
(
OffsetArrayOf
<
Type
>::
sanitize
(
c
,
this
,
ds
...
));
}
};
...
...
@@ -763,10 +714,16 @@ struct HeadlessArrayOf
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* pointed to do have a simple sanitize() as well as an
* assignment opreator. This ensures that they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
arrayZ
[
0
].
sanitize
(
c
));
if
(
false
)
{
arrayZ
[
0
].
sanitize
(
c
);
Type
v
;
v
=
arrayZ
[
0
];
}
return_trace
(
true
);
}
...
...
@@ -807,14 +764,14 @@ struct ArrayOfM1
unsigned
int
get_size
()
const
{
return
lenM1
.
static_size
+
(
lenM1
+
1
)
*
Type
::
static_size
;
}
template
<
typename
T
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T
user_data
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T
s
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
unsigned
int
count
=
lenM1
+
1
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
user_data
)))
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
ds
...
)))
return_trace
(
false
);
return_trace
(
true
);
}
...
...
@@ -999,31 +956,27 @@ struct VarSizedBinSearchArrayOf
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* pointed to do have a simple sanitize() as well as an
* assignment opreator. This ensures that they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
StructAtOffset
<
Type
>
(
&
bytesZ
,
0
).
sanitize
(
c
));
if
(
false
)
{
(
*
this
)[
0
].
sanitize
(
c
);
Type
v
;
v
=
(
*
this
)[
0
];
}
return_trace
(
true
);
}
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
unsigned
int
count
=
get_length
();
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
(
*
this
)[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
T
user_data
)
const
template
<
typename
...
Ts
>
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
Ts
...
ds
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return_trace
(
false
);
unsigned
int
count
=
get_length
();
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
(
*
this
)[
i
].
sanitize
(
c
,
base
,
user_data
)))
if
(
unlikely
(
!
(
*
this
)[
i
].
sanitize
(
c
,
base
,
ds
...
)))
return_trace
(
false
);
return_trace
(
true
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录