Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
a82ef7a8
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看板
提交
a82ef7a8
编写于
5月 10, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove CastP completely
上级
40cbefe8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
22 deletion
+17
-22
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+17
-22
未找到文件。
src/hb-open-type-private.hh
浏览文件 @
a82ef7a8
...
...
@@ -41,14 +41,6 @@
* Casts
*/
/* Cast to "const char *" and "char *" */
template
<
typename
Type
>
inline
const
char
*
CharP
(
const
Type
*
X
)
{
return
reinterpret_cast
<
const
char
*>
(
X
);
}
template
<
typename
Type
>
inline
char
*
CharP
(
Type
*
X
)
{
return
reinterpret_cast
<
char
*>
(
X
);
}
/* Cast to struct T, reference to reference */
template
<
typename
Type
,
typename
TObject
>
inline
const
Type
&
CastR
(
const
TObject
&
X
)
...
...
@@ -69,10 +61,10 @@ inline Type* CastP(TObject *X)
* location pointed to by P plus Ofs bytes. */
template
<
typename
Type
>
inline
const
Type
&
StructAtOffset
(
const
void
*
P
,
unsigned
int
offset
)
{
return
*
reinterpret_cast
<
const
Type
*>
(
CharP
(
P
)
+
offset
);
}
{
return
*
reinterpret_cast
<
const
Type
*>
(
(
const
char
*
)
P
+
offset
);
}
template
<
typename
Type
>
inline
Type
&
StructAtOffset
(
void
*
P
,
unsigned
int
offset
)
{
return
*
reinterpret_cast
<
Type
*>
(
CharP
(
P
)
+
offset
);
}
{
return
*
reinterpret_cast
<
Type
*>
(
(
char
*
)
P
+
offset
);
}
/* StructAfter<T>(X) returns the struct T& that is placed after X.
* Works with X of variable size also. X must implement get_size() */
...
...
@@ -216,15 +208,16 @@ struct hb_sanitize_context_t
inline
bool
check_range
(
const
void
*
base
,
unsigned
int
len
)
const
{
bool
ret
=
this
->
start
<=
base
&&
base
<=
this
->
end
&&
(
unsigned
int
)
(
this
->
end
-
CharP
(
base
))
>=
len
;
const
char
*
p
=
(
const
char
*
)
base
;
bool
ret
=
this
->
start
<=
p
&&
p
<=
this
->
end
&&
(
unsigned
int
)
(
this
->
end
-
p
)
>=
len
;
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
\
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> range [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
p
,
this
->
debug_depth
,
this
->
debug_depth
,
base
,
CharP
(
base
)
+
len
,
len
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
,
ret
?
"pass"
:
"FAIL"
);
...
...
@@ -233,13 +226,14 @@ struct hb_sanitize_context_t
inline
bool
check_array
(
const
void
*
base
,
unsigned
int
record_size
,
unsigned
int
len
)
const
{
const
char
*
p
=
(
const
char
*
)
base
;
bool
overflows
=
len
>=
((
unsigned
int
)
-
1
)
/
record_size
;
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
p
,
this
->
debug_depth
,
this
->
debug_depth
,
base
,
CharP
(
base
)
+
(
record_size
*
len
),
record_size
,
len
,
(
unsigned
long
)
record_size
*
len
,
p
,
p
+
(
record_size
*
len
),
record_size
,
len
,
(
unsigned
long
)
record_size
*
len
,
this
->
start
,
this
->
end
,
!
overflows
?
"does not overflow"
:
"OVERFLOWS FAIL"
);
...
...
@@ -254,14 +248,15 @@ struct hb_sanitize_context_t
inline
bool
can_edit
(
const
void
*
base
HB_UNUSED
,
unsigned
int
len
HB_UNUSED
)
{
const
char
*
p
=
(
const
char
*
)
base
;
this
->
edit_count
++
;
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
\
base
,
p
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
edit_count
,
base
,
CharP
(
base
)
+
len
,
len
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
,
this
->
writable
?
"granted"
:
"REJECTED"
);
...
...
@@ -389,7 +384,7 @@ struct IntType
TRACE_SANITIZE
();
return
context
->
check_struct
(
this
);
}
pr
ivate
:
pr
otected
:
BEInt
<
Type
,
sizeof
(
Type
)
>
v
;
public:
DEFINE_SIZE_STATIC
(
sizeof
(
Type
));
...
...
@@ -405,8 +400,8 @@ typedef IntType<int32_t> LONG; /* 32-bit signed integer. */
struct
Tag
:
ULONG
{
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline
operator
const
char
*
(
void
)
const
{
return
CharP
(
this
);
}
inline
operator
char
*
(
void
)
{
return
CharP
(
this
);
}
inline
operator
const
char
*
(
void
)
const
{
return
reinterpret_cast
<
const
char
*>
(
&
this
->
v
);
}
inline
operator
char
*
(
void
)
{
return
reinterpret_cast
<
char
*>
(
&
this
->
v
);
}
public:
DEFINE_SIZE_STATIC
(
4
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录