Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
196598bb
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,发现更多精彩内容 >>
提交
196598bb
编写于
8月 04, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Hb] Use reinterpret casts instead of direct casts to char *
上级
92b5dd8e
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
57 addition
and
50 deletion
+57
-50
src/hb-open-file-private.hh
src/hb-open-file-private.hh
+2
-2
src/hb-open-types-private.hh
src/hb-open-types-private.hh
+13
-6
src/hb-ot-layout-common-private.hh
src/hb-ot-layout-common-private.hh
+4
-4
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+6
-6
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsub-private.hh
+10
-10
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+22
-22
未找到文件。
src/hb-open-file-private.hh
浏览文件 @
196598bb
...
...
@@ -115,7 +115,7 @@ struct OpenTypeFontFile
switch
(
tag
)
{
default:
return
0
;
case
TrueTypeTag
:
case
CFFTag
:
return
1
;
case
TTCTag
:
return
TTCHeader
::
get_for_data
(
(
const
char
*
)
this
).
table
.
len
;
case
TTCTag
:
return
TTCHeader
::
get_for_data
(
CONST_CHARP
(
this
)
).
table
.
len
;
}
}
const
OpenTypeFontFace
&
get_face
(
unsigned
int
i
)
const
...
...
@@ -126,7 +126,7 @@ struct OpenTypeFontFile
* Apple dfont container is a container of SFNT's. So each SFNT is a
* non-TTC, but the index is more than zero. */
case
TrueTypeTag
:
case
CFFTag
:
return
*
(
const
OffsetTable
*
)
this
;
case
TTCTag
:
return
this
+
TTCHeader
::
get_for_data
(
(
const
char
*
)
this
).
table
[
i
];
case
TTCTag
:
return
this
+
TTCHeader
::
get_for_data
(
CONST_CHARP
(
this
)
).
table
[
i
];
}
}
...
...
src/hb-open-types-private.hh
浏览文件 @
196598bb
...
...
@@ -38,6 +38,13 @@
#define MAX_NESTING_LEVEL 8
/*
* Casts
*/
#define CONST_CHARP(X) (reinterpret_cast<const char *>(X))
#define CHARP(X) ((char *)reinterpret_cast<const char *>(X))
/*
* Sanitize
...
...
@@ -58,7 +65,7 @@ struct _hb_sanitize_context_t
#define SANITIZE(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG))
#define SANITIZE2(X,Y) SANITIZE (X) && SANITIZE (Y)
#define SANITIZE_THIS(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG,
(const char *) this
))
#define SANITIZE_THIS(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG,
reinterpret_cast<const char *>(this)
))
#define SANITIZE_THIS2(X,Y) SANITIZE_THIS (X) && SANITIZE_THIS (Y)
#define SANITIZE_THIS3(X,Y,Z) SANITIZE_THIS (X) && SANITIZE_THIS (Y) && SANITIZE_THIS(Z)
...
...
@@ -66,7 +73,7 @@ struct _hb_sanitize_context_t
#define SANITIZE_OBJ(X) SANITIZE_MEM(&(X), sizeof (X))
#define SANITIZE_GET_SIZE() SANITIZE_MEM (this, this->get_size ())
#define SANITIZE_MEM(B,L) HB_LIKELY (context->start <=
(const char *)(B) && (const char *)
(B) + (L) <= context->end)
/* XXX overflow */
#define SANITIZE_MEM(B,L) HB_LIKELY (context->start <=
reinterpret_cast<const char *>(B) && reinterpret_cast<const char *>
(B) + (L) <= context->end)
/* XXX overflow */
#define NEUTER(Var, Val) (false)
...
...
@@ -265,8 +272,8 @@ struct Tag : ULONG
inline
Tag
(
const
char
*
c
)
{
*
(
ULONG
*
)
this
=
*
(
ULONG
*
)
c
;
}
inline
bool
operator
==
(
const
char
*
c
)
const
{
return
*
(
ULONG
*
)
this
==
*
(
ULONG
*
)
c
;
}
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline
operator
const
char
*
(
void
)
const
{
return
(
const
char
*
)
this
;
}
inline
operator
char
*
(
void
)
{
return
(
char
*
)
this
;
}
inline
operator
const
char
*
(
void
)
const
{
return
reinterpret_cast
<
const
char
*>
(
this
)
;
}
inline
operator
char
*
(
void
)
{
return
reinterpret_cast
<
char
*>
(
this
)
;
}
};
ASSERT_SIZE
(
Tag
,
4
);
#define _NULL_TAG_INIT {' ', ' ', ' ', ' '}
...
...
@@ -330,14 +337,14 @@ struct GenericOffsetTo : OffsetType
{
unsigned
int
offset
=
*
this
;
if
(
HB_UNLIKELY
(
!
offset
))
return
Null
(
Type
);
return
*
(
const
Type
*
)((
const
char
*
)
base
+
offset
);
return
*
reinterpret_cast
<
const
Type
*>
(
reinterpret_cast
<
const
char
*>
(
base
)
+
offset
);
}
inline
bool
sanitize
(
SANITIZE_ARG_DEF
,
const
void
*
base
)
{
if
(
!
SANITIZE_OBJ
(
*
this
))
return
false
;
unsigned
int
offset
=
*
this
;
if
(
HB_UNLIKELY
(
!
offset
))
return
true
;
return
SANITIZE
(
*
(
Type
*
)((
char
*
)
base
+
offset
))
||
NEUTER
(
*
this
,
0
);
return
SANITIZE
(
*
reinterpret_cast
<
Type
*>
((
char
*
)(
reinterpret_cast
<
const
char
*>
(
base
)
+
offset
)
))
||
NEUTER
(
*
this
,
0
);
}
};
template
<
typename
Base
,
typename
OffsetType
,
typename
Type
>
...
...
src/hb-ot-layout-common-private.hh
浏览文件 @
196598bb
...
...
@@ -78,7 +78,7 @@ struct RecordListOf : RecordArrayOf<Type>
}
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
return
RecordArrayOf
<
Type
>::
sanitize
(
SANITIZE_ARG
,
(
const
char
*
)
this
);
return
RecordArrayOf
<
Type
>::
sanitize
(
SANITIZE_ARG
,
CONST_CHARP
(
this
)
);
}
};
...
...
@@ -211,7 +211,7 @@ struct Lookup
if
(
HB_UNLIKELY
(
flag
&
LookupFlag
::
UseMarkFilteringSet
))
{
const
USHORT
&
markFilteringSet
=
*
(
const
USHORT
*
)
(
(
const
char
*
)
&
subTable
+
subTable
.
get_size
());
(
CONST_CHARP
(
&
subTable
)
+
subTable
.
get_size
());
flag
+=
(
markFilteringSet
<<
16
);
}
return
flag
;
...
...
@@ -221,7 +221,7 @@ struct Lookup
if
(
!
(
SANITIZE_SELF
()
&&
SANITIZE_THIS
(
subTable
)))
return
false
;
if
(
HB_UNLIKELY
(
lookupFlag
&
LookupFlag
::
UseMarkFilteringSet
))
{
USHORT
&
markFilteringSet
=
*
(
USHORT
*
)
(
(
char
*
)
&
subTable
+
subTable
.
get_size
());
USHORT
&
markFilteringSet
=
*
(
USHORT
*
)
(
CHARP
(
&
subTable
)
+
subTable
.
get_size
());
if
(
!
SANITIZE
(
markFilteringSet
))
return
false
;
}
return
true
;
...
...
@@ -247,7 +247,7 @@ struct OffsetListOf : OffsetArrayOf<Type>
}
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
return
OffsetArrayOf
<
Type
>::
sanitize
(
SANITIZE_ARG
,
(
const
char
*
)
this
);
return
OffsetArrayOf
<
Type
>::
sanitize
(
SANITIZE_ARG
,
CONST_CHARP
(
this
)
);
}
};
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
196598bb
...
...
@@ -275,7 +275,7 @@ struct SinglePosFormat1
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
valueFormat
.
apply_value
(
context
,
(
const
char
*
)
this
,
values
,
CURPOSITION
());
valueFormat
.
apply_value
(
context
,
CONST_CHARP
(
this
)
,
values
,
CURPOSITION
());
buffer
->
in_pos
++
;
return
true
;
...
...
@@ -308,7 +308,7 @@ struct SinglePosFormat2
if
(
HB_LIKELY
(
index
>=
valueCount
))
return
false
;
valueFormat
.
apply_value
(
context
,
(
const
char
*
)
this
,
valueFormat
.
apply_value
(
context
,
CONST_CHARP
(
this
)
,
values
+
index
*
valueFormat
.
get_len
(),
CURPOSITION
());
...
...
@@ -413,8 +413,8 @@ struct PairPosFormat1
{
if
(
IN_GLYPH
(
j
)
==
record
->
secondGlyph
)
{
valueFormat1
.
apply_value
(
context
,
(
const
char
*
)
this
,
record
->
values
,
CURPOSITION
());
valueFormat2
.
apply_value
(
context
,
(
const
char
*
)
this
,
record
->
values
+
len1
,
POSITION
(
j
));
valueFormat1
.
apply_value
(
context
,
CONST_CHARP
(
this
)
,
record
->
values
,
CURPOSITION
());
valueFormat2
.
apply_value
(
context
,
CONST_CHARP
(
this
)
,
record
->
values
+
len1
,
POSITION
(
j
));
if
(
len2
)
j
++
;
buffer
->
in_pos
=
j
;
...
...
@@ -476,8 +476,8 @@ struct PairPosFormat2
return
false
;
const
Value
*
v
=
values
+
record_len
*
(
klass1
*
class2Count
+
klass2
);
valueFormat1
.
apply_value
(
context
,
(
const
char
*
)
this
,
v
,
CURPOSITION
());
valueFormat2
.
apply_value
(
context
,
(
const
char
*
)
this
,
v
+
len1
,
POSITION
(
j
));
valueFormat1
.
apply_value
(
context
,
CONST_CHARP
(
this
)
,
v
,
CURPOSITION
());
valueFormat2
.
apply_value
(
context
,
CONST_CHARP
(
this
)
,
v
+
len1
,
POSITION
(
j
));
if
(
len2
)
j
++
;
...
...
src/hb-ot-layout-gsub-private.hh
浏览文件 @
196598bb
...
...
@@ -568,17 +568,17 @@ struct ReverseChainSingleSubstFormat1
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
OffsetArrayOf
<
Coverage
>
&
lookahead
=
(
const
OffsetArrayOf
<
Coverage
>&
)
*
((
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
const
ArrayOf
<
GlyphID
>
&
substitute
=
(
const
ArrayOf
<
GlyphID
>&
)
*
((
const
char
*
)
&
lookahead
+
lookahead
.
get_size
());
const
OffsetArrayOf
<
Coverage
>
&
lookahead
=
*
(
const
OffsetArrayOf
<
Coverage
>*
)
(
CONST_CHARP
(
&
backtrack
)
+
backtrack
.
get_size
());
const
ArrayOf
<
GlyphID
>
&
substitute
=
*
(
const
ArrayOf
<
GlyphID
>*
)
(
CONST_CHARP
(
&
lookahead
)
+
lookahead
.
get_size
());
if
(
match_backtrack
(
APPLY_ARG
,
backtrack
.
len
,
(
USHORT
*
)
backtrack
.
array
,
match_coverage
,
(
char
*
)
this
)
&&
match_coverage
,
CHARP
(
this
)
)
&&
match_lookahead
(
APPLY_ARG
,
lookahead
.
len
,
(
USHORT
*
)
lookahead
.
array
,
match_coverage
,
(
char
*
)
this
,
match_coverage
,
CHARP
(
this
)
,
1
))
{
IN_CURGLYPH
()
=
substitute
[
index
];
...
...
@@ -592,12 +592,12 @@ struct ReverseChainSingleSubstFormat1
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
if
(
!
SANITIZE_THIS2
(
coverage
,
backtrack
))
return
false
;
OffsetArrayOf
<
Coverage
>
&
lookahead
=
(
OffsetArrayOf
<
Coverage
>&
)
*
((
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
OffsetArrayOf
<
Coverage
>
&
lookahead
=
*
(
OffsetArrayOf
<
Coverage
>*
)
(
CONST_CHARP
(
&
backtrack
)
+
backtrack
.
get_size
());
if
(
!
SANITIZE_THIS
(
lookahead
))
return
false
;
ArrayOf
<
GlyphID
>
&
substitute
=
(
ArrayOf
<
GlyphID
>&
)
*
((
const
char
*
)
&
lookahead
+
lookahead
.
get_size
());
ArrayOf
<
GlyphID
>
&
substitute
=
*
(
ArrayOf
<
GlyphID
>*
)
(
CONST_CHARP
(
&
lookahead
)
+
lookahead
.
get_size
());
if
(
!
SANITIZE
(
substitute
))
return
false
;
}
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
196598bb
...
...
@@ -257,7 +257,7 @@ struct Rule
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
lookup_context
)
const
{
const
LookupRecord
*
lookupRecord
=
(
const
LookupRecord
*
)
(
(
const
char
*
)
input
+
(
CONST_CHARP
(
input
)
+
sizeof
(
input
[
0
])
*
(
inputCount
?
inputCount
-
1
:
0
));
return
context_lookup
(
APPLY_ARG
,
inputCount
,
input
,
...
...
@@ -364,7 +364,7 @@ struct ContextFormat2
*/
struct
ContextLookupContext
lookup_context
=
{
{
match_class
,
apply_func
},
(
char
*
)
&
class_def
CHARP
(
&
class_def
)
};
return
rule_set
.
apply
(
APPLY_ARG
,
lookup_context
);
}
...
...
@@ -400,11 +400,11 @@ struct ContextFormat3
return
false
;
const
LookupRecord
*
lookupRecord
=
(
const
LookupRecord
*
)
(
(
const
char
*
)
coverage
+
(
CONST_CHARP
(
coverage
)
+
sizeof
(
coverage
[
0
])
*
glyphCount
);
struct
ContextLookupContext
lookup_context
=
{
{
match_coverage
,
apply_func
},
(
char
*
)
this
CHARP
(
this
)
};
return
context_lookup
(
APPLY_ARG
,
glyphCount
,
(
const
USHORT
*
)
(
coverage
+
1
),
...
...
@@ -418,7 +418,7 @@ struct ContextFormat3
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
SANITIZE_THIS
(
coverage
[
i
]))
return
false
;
LookupRecord
*
lookupRecord
=
(
LookupRecord
*
)
(
(
char
*
)
coverage
+
(
CHARP
(
coverage
)
+
sizeof
(
coverage
[
0
])
*
glyphCount
);
return
SANITIZE_MEM
(
lookupRecord
,
sizeof
(
lookupRecord
[
0
])
*
lookupCount
);
}
...
...
@@ -522,11 +522,11 @@ struct ChainRule
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
lookup_context
)
const
{
const
HeadlessArrayOf
<
USHORT
>
&
input
=
*
(
const
HeadlessArrayOf
<
USHORT
>*
)
(
(
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
(
CONST_CHARP
(
&
backtrack
)
+
backtrack
.
get_size
());
const
ArrayOf
<
USHORT
>
&
lookahead
=
*
(
const
ArrayOf
<
USHORT
>*
)
(
(
const
char
*
)
&
input
+
input
.
get_size
());
(
CONST_CHARP
(
&
input
)
+
input
.
get_size
());
const
ArrayOf
<
LookupRecord
>
&
lookup
=
*
(
const
ArrayOf
<
LookupRecord
>*
)
(
(
const
char
*
)
&
lookahead
+
lookahead
.
get_size
());
(
CONST_CHARP
(
&
lookahead
)
+
lookahead
.
get_size
());
return
chain_context_lookup
(
APPLY_ARG
,
backtrack
.
len
,
backtrack
.
array
,
input
.
len
,
input
.
array
+
1
,
...
...
@@ -540,13 +540,13 @@ struct ChainRule
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
if
(
!
SANITIZE
(
backtrack
))
return
false
;
HeadlessArrayOf
<
USHORT
>
&
input
=
*
(
HeadlessArrayOf
<
USHORT
>*
)
(
(
char
*
)
&
backtrack
+
backtrack
.
get_size
());
(
CHARP
(
&
backtrack
)
+
backtrack
.
get_size
());
if
(
!
SANITIZE
(
input
))
return
false
;
ArrayOf
<
USHORT
>
&
lookahead
=
*
(
ArrayOf
<
USHORT
>*
)
(
(
char
*
)
&
input
+
input
.
get_size
());
(
CHARP
(
&
input
)
+
input
.
get_size
());
if
(
!
SANITIZE
(
lookahead
))
return
false
;
ArrayOf
<
LookupRecord
>
&
lookup
=
*
(
ArrayOf
<
LookupRecord
>*
)
(
(
char
*
)
&
lookahead
+
lookahead
.
get_size
());
(
CHARP
(
&
lookahead
)
+
lookahead
.
get_size
());
return
SANITIZE
(
lookup
);
}
...
...
@@ -648,9 +648,9 @@ struct ChainContextFormat2
*/
struct
ChainContextLookupContext
lookup_context
=
{
{
match_class
,
apply_func
},
{
(
char
*
)
&
backtrack_class_def
,
(
char
*
)
&
input_class_def
,
(
char
*
)
&
lookahead_class_def
}
{
CHARP
(
&
backtrack_class_def
)
,
CHARP
(
&
input_class_def
)
,
CHARP
(
&
lookahead_class_def
)
}
};
return
rule_set
.
apply
(
APPLY_ARG
,
lookup_context
);
}
...
...
@@ -693,19 +693,19 @@ struct ChainContextFormat3
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
const
OffsetArrayOf
<
Coverage
>
&
input
=
*
(
const
OffsetArrayOf
<
Coverage
>*
)
(
(
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
(
CONST_CHARP
(
&
backtrack
)
+
backtrack
.
get_size
());
unsigned
int
index
=
(
this
+
input
[
0
])
(
IN_CURGLYPH
());
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
OffsetArrayOf
<
Coverage
>
&
lookahead
=
*
(
const
OffsetArrayOf
<
Coverage
>*
)
(
(
const
char
*
)
&
input
+
input
.
get_size
());
(
CONST_CHARP
(
&
input
)
+
input
.
get_size
());
const
ArrayOf
<
LookupRecord
>
&
lookup
=
*
(
const
ArrayOf
<
LookupRecord
>*
)
(
(
const
char
*
)
&
lookahead
+
lookahead
.
get_size
());
(
CONST_CHARP
(
&
lookahead
)
+
lookahead
.
get_size
());
struct
ChainContextLookupContext
lookup_context
=
{
{
match_coverage
,
apply_func
},
{
(
char
*
)
this
,
(
char
*
)
this
,
(
char
*
)
this
}
{
CHARP
(
this
),
CHARP
(
this
),
CHARP
(
this
)
}
};
return
chain_context_lookup
(
APPLY_ARG
,
backtrack
.
len
,
(
USHORT
*
)
backtrack
.
array
,
...
...
@@ -719,13 +719,13 @@ struct ChainContextFormat3
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
if
(
!
SANITIZE_THIS
(
backtrack
))
return
false
;
OffsetArrayOf
<
Coverage
>
&
input
=
*
(
OffsetArrayOf
<
Coverage
>*
)
(
(
char
*
)
&
backtrack
+
backtrack
.
get_size
());
(
CHARP
(
&
backtrack
)
+
backtrack
.
get_size
());
if
(
!
SANITIZE_THIS
(
input
))
return
false
;
OffsetArrayOf
<
Coverage
>
&
lookahead
=
*
(
OffsetArrayOf
<
Coverage
>*
)
(
(
char
*
)
&
input
+
input
.
get_size
());
(
CHARP
(
&
input
)
+
input
.
get_size
());
if
(
!
SANITIZE_THIS
(
lookahead
))
return
false
;
ArrayOf
<
LookupRecord
>
&
lookup
=
*
(
ArrayOf
<
LookupRecord
>*
)
(
(
char
*
)
&
lookahead
+
lookahead
.
get_size
());
(
CHARP
(
&
lookahead
)
+
lookahead
.
get_size
());
return
SANITIZE
(
lookup
);
}
...
...
@@ -794,7 +794,7 @@ struct ExtensionFormat1
{
unsigned
int
offset
=
get_offset
();
if
(
HB_UNLIKELY
(
!
offset
))
return
Null
(
LookupSubTable
);
return
*
(
LookupSubTable
*
)(
((
char
*
)
this
)
+
offset
);
return
*
(
LookupSubTable
*
)(
CHARP
(
this
)
+
offset
);
}
inline
bool
sanitize
(
SANITIZE_ARG_DEF
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录