Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
a47070cd
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a47070cd
编写于
4月 18, 2018
作者:
E
Ebrahim Byagowi
提交者:
GitHub
4月 18, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor, annotate the added tables with likely/unlikely (#997)
上级
1a309dcd
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
55 addition
and
46 deletion
+55
-46
src/hb-aat-fmtx-table.hh
src/hb-aat-fmtx-table.hh
+1
-1
src/hb-aat-gcid-table.hh
src/hb-aat-gcid-table.hh
+1
-1
src/hb-aat-layout-ankr-table.hh
src/hb-aat-layout-ankr-table.hh
+4
-3
src/hb-aat-layout-bsln-table.hh
src/hb-aat-layout-bsln-table.hh
+5
-4
src/hb-aat-layout-feat-table.hh
src/hb-aat-layout-feat-table.hh
+5
-5
src/hb-aat-layout-kerx-table.hh
src/hb-aat-layout-kerx-table.hh
+6
-6
src/hb-aat-layout-trak-table.hh
src/hb-aat-layout-trak-table.hh
+13
-8
src/hb-aat-ltag-table.hh
src/hb-aat-ltag-table.hh
+1
-1
src/hb-ot-color-colr-table.hh
src/hb-ot-color-colr-table.hh
+5
-5
src/hb-ot-color-cpal-table.hh
src/hb-ot-color-cpal-table.hh
+10
-8
src/hb-ot-color-sbix-table.hh
src/hb-ot-color-sbix-table.hh
+1
-1
src/hb-ot-color-svg-table.hh
src/hb-ot-color-svg-table.hh
+3
-3
未找到文件。
src/hb-aat-fmtx-table.hh
浏览文件 @
a47070cd
...
...
@@ -44,7 +44,7 @@ struct fmtx
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
));
}
FixedVersion
<>
version
;
/* Version (set to 0x00020000). */
...
...
src/hb-aat-gcid-table.hh
浏览文件 @
a47070cd
...
...
@@ -44,7 +44,7 @@ struct gcid
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
CIDs
.
sanitize
(
c
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
CIDs
.
sanitize
(
c
)
));
}
protected:
...
...
src/hb-aat-layout-ankr-table.hh
浏览文件 @
a47070cd
...
...
@@ -58,9 +58,10 @@ struct ankr
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
version
==
0
&&
lookupTable
.
sanitize
(
c
,
this
)
&&
anchors
.
sanitize
(
c
,
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
version
==
0
&&
lookupTable
.
sanitize
(
c
,
this
)
&&
anchors
.
sanitize
(
c
,
this
)));
}
protected:
...
...
src/hb-aat-layout-bsln-table.hh
浏览文件 @
a47070cd
...
...
@@ -42,7 +42,7 @@ struct BaselineTableFormat0Part
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
));
}
protected:
...
...
@@ -60,7 +60,8 @@ struct BaselineTableFormat1Part
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
lookupTable
.
sanitize
(
c
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
lookupTable
.
sanitize
(
c
)));
}
protected:
...
...
@@ -77,7 +78,7 @@ struct BaselineTableFormat2Part
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
));
}
protected:
...
...
@@ -120,7 +121,7 @@ struct bsln
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
!
(
c
->
check_struct
(
this
)
&&
defaultBaseline
<
32
))
if
(
unlikely
(
!
(
c
->
check_struct
(
this
)
&&
defaultBaseline
<
32
)
))
return_trace
(
false
);
switch
(
format
)
{
...
...
src/hb-aat-layout-feat-table.hh
浏览文件 @
a47070cd
...
...
@@ -42,7 +42,7 @@ struct SettingName
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
));
}
protected:
...
...
@@ -57,8 +57,8 @@ struct FeatureName
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
base
+
settingTable
).
sanitize
(
c
,
nSettings
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
(
base
+
settingTable
).
sanitize
(
c
,
nSettings
)
));
}
enum
{
...
...
@@ -98,8 +98,8 @@ struct feat
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
names
.
sanitize
(
c
,
featureNameCount
,
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
names
.
sanitize
(
c
,
featureNameCount
,
this
)
));
}
protected:
...
...
src/hb-aat-layout-kerx-table.hh
浏览文件 @
a47070cd
...
...
@@ -147,7 +147,7 @@ struct KerxSubTableFormat2
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
rowWidth
.
sanitize
(
c
)
&&
rowWidth
.
sanitize
(
c
)
&&
leftClassTable
.
sanitize
(
c
,
this
)
&&
rightClassTable
.
sanitize
(
c
,
this
)
&&
array
.
sanitize
(
c
,
this
));
...
...
@@ -174,7 +174,7 @@ struct KerxSubTableFormat4
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
rowWidth
.
sanitize
(
c
)
&&
rowWidth
.
sanitize
(
c
)
&&
leftClassTable
.
sanitize
(
c
,
this
)
&&
rightClassTable
.
sanitize
(
c
,
this
)
&&
array
.
sanitize
(
c
,
this
));
...
...
@@ -241,7 +241,7 @@ struct KerxTable
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
!
c
->
check_struct
(
this
))
if
(
unlikely
(
!
c
->
check_struct
(
this
)
))
return_trace
(
false
);
switch
(
format
)
{
...
...
@@ -301,18 +301,18 @@ struct kerx
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
!
(
c
->
check_struct
(
this
)))
if
(
unlikely
(
!
(
c
->
check_struct
(
this
)
)))
return_trace
(
false
);
/* TODO: Something like `morx`s ChainSubtable should be done here instead */
const
KerxTable
*
table
=
&
StructAfter
<
KerxTable
>
(
*
this
);
if
(
!
(
table
->
sanitize
(
c
)))
if
(
unlikely
(
!
(
table
->
sanitize
(
c
)
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
nTables
-
1
;
++
i
)
{
table
=
&
StructAfter
<
KerxTable
>
(
*
table
);
if
(
!
(
table
->
sanitize
(
c
)))
if
(
unlikely
(
!
(
table
->
sanitize
(
c
)
)))
return_trace
(
false
);
}
...
...
src/hb-aat-layout-trak-table.hh
浏览文件 @
a47070cd
...
...
@@ -44,12 +44,17 @@ namespace AAT {
struct
TrackTableEntry
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
unsigned
int
size
)
const
friend
struct
TrackData
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
unsigned
int
size
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
values
.
sanitize
(
c
,
base
,
size
)));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
(
valuesZ
.
sanitize
(
c
,
base
,
size
))));
}
private:
inline
float
get_track_value
()
const
{
return
track
.
to_float
();
...
...
@@ -57,14 +62,14 @@ struct TrackTableEntry
inline
int
get_value
(
const
void
*
base
,
unsigned
int
index
)
const
{
return
(
base
+
values
)[
index
];
return
(
base
+
values
Z
)[
index
];
}
protected:
Fixed
track
;
/* Track value for this record. */
NameID
trackNameID
;
/* The 'name' table index for this track */
OffsetTo
<
UnsizedArrayOf
<
FWORD
>
>
values
;
/* Offset from start of tracking table to
values
Z
;
/* Offset from start of tracking table to
* per-size tracking values for this track. */
public:
...
...
@@ -146,9 +151,9 @@ struct trak
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
horizData
.
sanitize
(
c
,
this
,
this
)
&&
vertData
.
sanitize
(
c
,
this
,
this
));
return_trace
(
unlikely
(
c
->
check_struct
(
this
)
&&
horizData
.
sanitize
(
c
,
this
,
this
)
&&
vertData
.
sanitize
(
c
,
this
,
this
)
));
}
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
...
...
@@ -156,7 +161,7 @@ struct trak
TRACE_APPLY
(
this
);
const
float
ptem
=
c
->
font
->
ptem
;
if
(
ptem
<=
0.
f
)
if
(
unlikely
(
ptem
<=
0.
f
)
)
return_trace
(
false
);
hb_buffer_t
*
buffer
=
c
->
buffer
;
...
...
src/hb-aat-ltag-table.hh
浏览文件 @
a47070cd
...
...
@@ -61,7 +61,7 @@ struct ltag
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
tagRanges
.
sanitize
(
c
,
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
tagRanges
.
sanitize
(
c
,
this
)
));
}
protected:
...
...
src/hb-ot-color-colr-table.hh
浏览文件 @
a47070cd
...
...
@@ -61,7 +61,7 @@ struct BaseGlyphRecord
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
));
}
inline
int
cmp
(
hb_codepoint_t
g
)
const
{
...
...
@@ -90,9 +90,9 @@ struct COLR
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
this
+
baseGlyphsZ
).
sanitize
(
c
,
numBaseGlyphs
)
&&
(
this
+
layersZ
).
sanitize
(
c
,
numLayers
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
(
this
+
baseGlyphsZ
).
sanitize
(
c
,
numBaseGlyphs
)
&&
(
this
+
layersZ
).
sanitize
(
c
,
numLayers
)
));
}
inline
bool
get_base_glyph_record
(
hb_codepoint_t
glyph_id
,
...
...
@@ -102,7 +102,7 @@ struct COLR
const
BaseGlyphRecord
*
record
;
record
=
(
BaseGlyphRecord
*
)
bsearch
(
&
glyph_id
,
&
(
this
+
baseGlyphsZ
),
numBaseGlyphs
,
sizeof
(
BaseGlyphRecord
),
compare_bgr
);
if
(
!
record
)
if
(
unlikely
(
!
record
)
)
return
false
;
*
first_layer
=
record
->
firstLayerIdx
;
...
...
src/hb-ot-color-cpal-table.hh
浏览文件 @
a47070cd
...
...
@@ -143,13 +143,14 @@ struct CPAL
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
!
(
c
->
check_struct
(
this
)
&&
// it checks colorRecordIndices also, see #get_size
(
this
+
colorRecordsZ
).
sanitize
(
c
,
numColorRecords
)))
if
(
unlikely
(
!
(
c
->
check_struct
(
this
)
&&
// it checks colorRecordIndices also
// see #get_size
(
this
+
colorRecordsZ
).
sanitize
(
c
,
numColorRecords
))))
return_trace
(
false
);
// Check for indices sanity so no need for doing it runtime
for
(
unsigned
int
i
=
0
;
i
<
numPalettes
;
++
i
)
if
(
colorRecordIndicesZ
[
i
]
+
numPaletteEntries
>
numColorRecords
)
if
(
unlikely
(
colorRecordIndicesZ
[
i
]
+
numPaletteEntries
>
numColorRecords
)
)
return_trace
(
false
);
// If version is zero, we are done here; otherwise we need to check tail also
...
...
@@ -157,7 +158,7 @@ struct CPAL
return_trace
(
true
);
const
CPALV1Tail
&
v1
=
StructAfter
<
CPALV1Tail
>
(
*
this
);
return_trace
(
v1
.
sanitize
(
c
,
this
,
numPalettes
));
return_trace
(
likely
(
v1
.
sanitize
(
c
,
this
,
numPalettes
)
));
}
inline
unsigned
int
get_size
(
void
)
const
...
...
@@ -167,7 +168,7 @@ struct CPAL
inline
hb_ot_color_palette_flags_t
get_palette_flags
(
unsigned
int
palette
)
const
{
if
(
version
==
0
||
palette
>=
numPalettes
)
if
(
unlikely
(
version
==
0
||
palette
>=
numPalettes
)
)
return
HB_OT_COLOR_PALETTE_FLAG_DEFAULT
;
const
CPALV1Tail
&
cpal1
=
StructAfter
<
CPALV1Tail
>
(
*
this
);
...
...
@@ -176,7 +177,7 @@ struct CPAL
inline
unsigned
int
get_palette_name_id
(
unsigned
int
palette
)
const
{
if
(
version
==
0
||
palette
>=
numPalettes
)
if
(
unlikely
(
version
==
0
||
palette
>=
numPalettes
)
)
return
0xFFFF
;
const
CPALV1Tail
&
cpal1
=
StructAfter
<
CPALV1Tail
>
(
*
this
);
...
...
@@ -191,11 +192,12 @@ struct CPAL
inline
hb_ot_color_t
get_color_record_argb
(
unsigned
int
color_index
,
unsigned
int
palette
)
const
{
if
(
color_index
>=
numPaletteEntries
||
palette
>=
numPalettes
)
if
(
unlikely
(
color_index
>=
numPaletteEntries
||
palette
>=
numPalettes
)
)
return
0
;
// No need for more range check as it is already done on #sanitize
return
(
this
+
colorRecordsZ
)[
colorRecordIndicesZ
[
palette
]
+
color_index
];
const
UnsizedArrayOf
<
BGRAColor
>&
color_records
=
this
+
colorRecordsZ
;
return
color_records
[
colorRecordIndicesZ
[
palette
]
+
color_index
];
}
protected:
...
...
src/hb-ot-color-sbix-table.hh
浏览文件 @
a47070cd
...
...
@@ -89,7 +89,7 @@ struct sbix
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
strikes
.
sanitize
(
c
,
this
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
strikes
.
sanitize
(
c
,
this
)
));
}
struct
accelerator_t
...
...
src/hb-ot-color-svg-table.hh
浏览文件 @
a47070cd
...
...
@@ -71,7 +71,7 @@ struct SVGDocumentIndex
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
entries
.
sanitize
(
c
,
this
));
entries
.
sanitize
(
c
,
this
));
}
protected:
...
...
@@ -88,8 +88,8 @@ struct SVG
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
this
+
svgDocIndex
).
sanitize
(
c
));
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
(
this
+
svgDocIndex
).
sanitize
(
c
)
));
}
struct
accelerator_t
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录