Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
9aebfb41
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看板
提交
9aebfb41
编写于
12月 18, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[serialize] Streamline error propagation
上级
969ff3c7
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
37 addition
and
14 deletion
+37
-14
src/hb-buffer.hh
src/hb-buffer.hh
+2
-0
src/hb-machinery.hh
src/hb-machinery.hh
+26
-9
src/hb-map.hh
src/hb-map.hh
+2
-0
src/hb-ot-layout-common.hh
src/hb-ot-layout-common.hh
+2
-2
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+2
-2
src/hb-set.hh
src/hb-set.hh
+2
-0
src/hb-subset.cc
src/hb-subset.cc
+1
-1
未找到文件。
src/hb-buffer.hh
浏览文件 @
9aebfb41
...
...
@@ -137,6 +137,8 @@ struct hb_buffer_t
/* Methods */
bool
in_error
()
const
{
return
!
successful
;
}
void
allocate_var
(
unsigned
int
start
,
unsigned
int
count
)
{
#ifndef HB_NDEBUG
...
...
src/hb-machinery.hh
浏览文件 @
9aebfb41
...
...
@@ -508,14 +508,31 @@ struct hb_serialize_context_t
reset
();
}
bool
in_error
()
const
{
return
!
this
->
successful
;
}
void
reset
()
{
this
->
ran_out_of_room
=
fals
e
;
this
->
successful
=
tru
e
;
this
->
head
=
this
->
start
;
this
->
debug_depth
=
0
;
}
bool
err
(
bool
e
)
{
return
this
->
ran_out_of_room
=
this
->
ran_out_of_room
||
e
;
}
bool
propagate_error
(
bool
e
)
{
return
this
->
successful
=
this
->
successful
&&
e
;
}
template
<
typename
T
>
bool
propagate_error
(
const
T
&
obj
)
{
return
this
->
successful
=
this
->
successful
&&
!
obj
.
in_error
();
}
template
<
typename
T
>
bool
propagate_error
(
const
T
*
obj
)
{
return
this
->
successful
=
this
->
successful
&&
!
obj
->
in_error
();
}
template
<
typename
T1
,
typename
T2
>
bool
propagate_error
(
T1
&
o1
,
T2
&
o2
)
{
return
propagate_error
(
o1
)
&&
propagate_error
(
o2
);
}
template
<
typename
T1
,
typename
T2
>
bool
propagate_error
(
T1
*
o1
,
T2
*
o2
)
{
return
propagate_error
(
o1
)
&&
propagate_error
(
o2
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
bool
propagate_error
(
T1
&
o1
,
T2
&
o2
,
T3
&
o3
)
{
return
propagate_error
(
o1
)
&&
propagate_error
(
o2
,
o3
);
}
template
<
typename
T1
,
typename
T2
,
typename
T3
>
bool
propagate_error
(
T1
*
o1
,
T2
*
o2
,
T3
*
o3
)
{
return
propagate_error
(
o1
)
&&
propagate_error
(
o2
,
o3
);
}
/* To be called around main operation. */
template
<
typename
Type
>
...
...
@@ -534,7 +551,7 @@ struct hb_serialize_context_t
"end [%p..%p] serialized %d bytes; %s"
,
this
->
start
,
this
->
end
,
(
int
)
(
this
->
head
-
this
->
start
),
this
->
ran_out_of_room
?
"RAN OUT OF ROOM"
:
"did not ran out of room
"
);
this
->
successful
?
"successful"
:
"UNSUCCESSFUL
"
);
}
unsigned
int
length
()
const
{
return
this
->
head
-
this
->
start
;
}
...
...
@@ -556,8 +573,8 @@ struct hb_serialize_context_t
template
<
typename
Type
>
Type
*
allocate_size
(
unsigned
int
size
)
{
if
(
unlikely
(
this
->
ran_out_of_room
||
this
->
end
-
this
->
head
<
ptrdiff_t
(
size
)))
{
this
->
ran_out_of_room
=
tru
e
;
if
(
unlikely
(
!
this
->
successful
||
this
->
end
-
this
->
head
<
ptrdiff_t
(
size
)))
{
this
->
successful
=
fals
e
;
return
nullptr
;
}
memset
(
this
->
head
,
0
,
size
);
...
...
@@ -602,7 +619,7 @@ struct hb_serialize_context_t
template
<
typename
Type
>
Type
*
copy
()
const
{
assert
(
!
this
->
ran_out_of_room
);
assert
(
this
->
successful
);
unsigned
int
len
=
this
->
head
-
this
->
start
;
void
*
p
=
malloc
(
len
);
if
(
p
)
...
...
@@ -611,7 +628,7 @@ struct hb_serialize_context_t
}
hb_bytes_t
copy_bytes
()
const
{
assert
(
!
this
->
ran_out_of_room
);
assert
(
this
->
successful
);
unsigned
int
len
=
this
->
head
-
this
->
start
;
void
*
p
=
malloc
(
len
);
if
(
p
)
...
...
@@ -622,7 +639,7 @@ struct hb_serialize_context_t
}
hb_blob_t
*
copy_blob
()
const
{
assert
(
!
this
->
ran_out_of_room
);
assert
(
this
->
successful
);
return
hb_blob_create
(
this
->
start
,
this
->
head
-
this
->
start
,
HB_MEMORY_MODE_DUPLICATE
,
...
...
@@ -632,7 +649,7 @@ struct hb_serialize_context_t
public:
unsigned
int
debug_depth
;
char
*
start
,
*
end
,
*
head
;
bool
ran_out_of_room
;
bool
successful
;
};
...
...
src/hb-map.hh
浏览文件 @
9aebfb41
...
...
@@ -90,6 +90,8 @@ struct hb_map_t
fini_shallow
();
}
bool
in_error
()
const
{
return
!
successful
;
}
bool
resize
()
{
if
(
unlikely
(
!
successful
))
return
false
;
...
...
src/hb-ot-layout-common.hh
浏览文件 @
9aebfb41
...
...
@@ -1254,7 +1254,7 @@ struct ClassDefFormat1
glyphs
.
push
()
->
set
(
glyph_map
[
g
]);
klasses
.
push
()
->
set
(
value
);
}
c
->
serializer
->
err
(
glyphs
.
in_error
()
||
klasses
.
in_error
()
);
c
->
serializer
->
propagate_error
(
glyphs
,
klasses
);
hb_supplier_t
<
GlyphID
>
glyphs_supplier
(
glyphs
);
hb_supplier_t
<
HBUINT16
>
klasses_supplier
(
klasses
);
...
...
@@ -1413,7 +1413,7 @@ struct ClassDefFormat2
klasses
.
push
()
->
set
(
value
);
}
}
c
->
serializer
->
err
(
glyphs
.
in_error
()
||
klasses
.
in_error
()
);
c
->
serializer
->
propagate_error
(
glyphs
,
klasses
);
hb_supplier_t
<
GlyphID
>
glyphs_supplier
(
glyphs
);
hb_supplier_t
<
HBUINT16
>
klasses_supplier
(
klasses
);
...
...
src/hb-ot-layout-gsub-table.hh
浏览文件 @
9aebfb41
...
...
@@ -120,7 +120,7 @@ struct SingleSubstFormat1
from
.
push
()
->
set
(
glyph_map
[
iter
.
get_glyph
()]);
to
.
push
()
->
set
(
glyph_map
[(
iter
.
get_glyph
()
+
delta
)
&
0xFFFF
]);
}
c
->
serializer
->
err
(
from
.
in_error
()
||
to
.
in_error
()
);
c
->
serializer
->
propagate_error
(
from
,
to
);
hb_supplier_t
<
GlyphID
>
from_supplier
(
from
);
hb_supplier_t
<
GlyphID
>
to_supplier
(
to
);
...
...
@@ -225,7 +225,7 @@ struct SingleSubstFormat2
from
.
push
()
->
set
(
glyph_map
[
iter
.
get_glyph
()]);
to
.
push
()
->
set
(
glyph_map
[
substitute
[
iter
.
get_coverage
()]]);
}
c
->
serializer
->
err
(
from
.
in_error
()
||
to
.
in_error
()
);
c
->
serializer
->
propagate_error
(
from
,
to
);
hb_supplier_t
<
GlyphID
>
from_supplier
(
from
);
hb_supplier_t
<
GlyphID
>
to_supplier
(
to
);
...
...
src/hb-set.hh
浏览文件 @
9aebfb41
...
...
@@ -213,6 +213,8 @@ struct hb_set_t
fini_shallow
();
}
bool
in_error
()
const
{
return
!
successful
;
}
bool
resize
(
unsigned
int
count
)
{
if
(
unlikely
(
!
successful
))
return
false
;
...
...
src/hb-subset.cc
浏览文件 @
9aebfb41
...
...
@@ -83,7 +83,7 @@ _subset2 (hb_subset_plan_t *plan)
hb_serialize_context_t
serializer
((
void
*
)
buf
,
buf_size
);
hb_subset_context_t
c
(
plan
,
&
serializer
);
result
=
table
->
subset
(
&
c
);
if
(
serializer
.
ran_out_of_room
)
if
(
serializer
.
in_error
()
)
{
buf_size
+=
(
buf_size
>>
1
)
+
32
;
DEBUG_MSG
(
SUBSET
,
nullptr
,
"OT::%c%c%c%c ran out of room; reallocating to %u bytes."
,
HB_UNTAG
(
tag
),
buf_size
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录