Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
e901b954
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,发现更多精彩内容 >>
提交
e901b954
编写于
8月 29, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[OT] Start adding serialize() API
上级
965c280d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
77 addition
and
0 deletion
+77
-0
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+77
-0
未找到文件。
src/hb-open-type-private.hh
浏览文件 @
e901b954
...
@@ -327,6 +327,83 @@ struct Sanitizer
...
@@ -327,6 +327,83 @@ struct Sanitizer
/*
* Serialize
*/
#ifndef HB_DEBUG_SERIALIZE
#define HB_DEBUG_SERIALIZE (HB_DEBUG+0)
#endif
#define TRACE_SERIALIZE() \
hb_auto_trace_t<HB_DEBUG_SERIALIZE> trace (&c->debug_depth, "SERIALIZE", this, HB_FUNC, "");
struct
hb_serialize_context_t
{
inline
void
init
(
void
*
start
,
unsigned
int
size
)
{
this
->
start
=
(
char
*
)
start
;
this
->
end
=
this
->
start
+
size
;
}
inline
void
start_processing
(
void
)
{
this
->
ran_out_of_room
=
false
;
this
->
head
=
this
->
start
;
this
->
debug_depth
=
0
;
DEBUG_MSG_LEVEL
(
SERIALIZE
,
this
->
start
,
0
,
+
1
,
"start [%p..%p] (%lu bytes)"
,
this
->
start
,
this
->
end
,
(
unsigned
long
)
(
this
->
end
-
this
->
start
));
}
inline
void
end_processing
(
void
)
{
DEBUG_MSG_LEVEL
(
SERIALIZE
,
this
->
start
,
0
,
-
1
,
"end [%p..%p] %s"
,
this
->
start
,
this
->
end
,
this
->
ran_out_of_room
?
"RAN OUT OF ROOM"
:
"did not ran out of room"
);
this
->
start
=
this
->
end
=
this
->
head
=
NULL
;
}
template
<
typename
Type
>
inline
Type
*
allocate
(
unsigned
int
size
=
-
1
,
unsigned
int
alignment
=
2
)
{
if
(
size
==
-
1
)
size
==
Type
::
static_size
;
unsigned
int
padding
=
(
alignment
-
(
this
->
head
-
this
->
start
)
%
alignment
)
%
alignment
;
/* TODO speedup */
if
(
unlikely
(
this
->
ran_out_of_room
||
this
->
end
-
this
->
head
>
padding
+
size
))
{
this
->
ran_out_of_room
=
true
;
return
NULL
;
}
this
->
head
+=
padding
;
const
char
*
ret
=
this
->
head
;
this
->
head
+=
size
;
return
reinterpret_cast
<
Type
*>
(
ret
);
}
template
<
typename
Type
>
inline
Type
*
embed
(
const
Type
&
obj
,
unsigned
int
alignment
=
2
)
{
return
allocate
(
obj
.
size
(),
alignment
);
}
inline
void
truncate
(
void
*
head
)
{
assert
(
this
->
start
<
head
&&
head
<=
this
->
head
);
this
->
head
=
(
char
*
)
head
;
}
unsigned
int
debug_depth
;
char
*
start
,
*
end
,
*
head
;
bool
ran_out_of_room
;
};
/*
/*
*
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录