Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
11e3ec44
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,发现更多精彩内容 >>
提交
11e3ec44
编写于
11月 03, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a few more "unreachable code" warnings
上级
23048563
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
54 deletion
+49
-54
src/hb-blob.c
src/hb-blob.c
+1
-1
src/hb-object-private.h
src/hb-object-private.h
+6
-6
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+40
-44
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+1
-1
src/hb-private.h
src/hb-private.h
+1
-2
未找到文件。
src/hb-blob.c
浏览文件 @
11e3ec44
...
@@ -42,7 +42,7 @@ HB_BEGIN_DECLS
...
@@ -42,7 +42,7 @@ HB_BEGIN_DECLS
#ifndef HB_DEBUG_BLOB
#ifndef HB_DEBUG_BLOB
#define HB_DEBUG_BLOB
HB_DEBUG+0
#define HB_DEBUG_BLOB
(HB_DEBUG+0)
#endif
#endif
hb_blob_t
_hb_blob_nil
=
{
hb_blob_t
_hb_blob_nil
=
{
...
...
src/hb-object-private.h
浏览文件 @
11e3ec44
...
@@ -60,7 +60,7 @@ typedef struct {
...
@@ -60,7 +60,7 @@ typedef struct {
/* Debug */
/* Debug */
#ifndef HB_DEBUG_OBJECT
#ifndef HB_DEBUG_OBJECT
#define HB_DEBUG_OBJECT
HB_DEBUG+0
#define HB_DEBUG_OBJECT
(HB_DEBUG+0)
#endif
#endif
static
inline
void
static
inline
void
...
@@ -68,11 +68,11 @@ _hb_trace_object (const void *obj,
...
@@ -68,11 +68,11 @@ _hb_trace_object (const void *obj,
hb_reference_count_t
*
ref_count
,
hb_reference_count_t
*
ref_count
,
const
char
*
function
)
const
char
*
function
)
{
{
if
(
HB_DEBUG_OBJECT
)
(
void
)
(
HB_DEBUG_OBJECT
&&
fprintf
(
stderr
,
"OBJECT(%p) refcount=%d %s
\n
"
,
fprintf
(
stderr
,
"OBJECT(%p) refcount=%d %s
\n
"
,
obj
,
obj
,
HB_REFERENCE_COUNT_GET_VALUE
(
*
ref_count
),
HB_REFERENCE_COUNT_GET_VALUE
(
*
ref_count
),
function
);
function
)
);
}
}
#define TRACE_OBJECT(obj) _hb_trace_object (obj, &obj->ref_count, __FUNCTION__)
#define TRACE_OBJECT(obj) _hb_trace_object (obj, &obj->ref_count, __FUNCTION__)
...
...
src/hb-open-type-private.hh
浏览文件 @
11e3ec44
...
@@ -152,8 +152,8 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
...
@@ -152,8 +152,8 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
template
<
int
max_depth
>
template
<
int
max_depth
>
struct
hb_trace_t
{
struct
hb_trace_t
{
explicit
hb_trace_t
(
unsigned
int
*
pdepth
,
const
char
*
what
,
const
char
*
function
,
const
void
*
obj
)
:
pdepth
(
pdepth
)
{
explicit
hb_trace_t
(
unsigned
int
*
pdepth
,
const
char
*
what
,
const
char
*
function
,
const
void
*
obj
)
:
pdepth
(
pdepth
)
{
if
(
*
pdepth
<
max_depth
)
(
void
)
(
*
pdepth
<
max_depth
&&
fprintf
(
stderr
,
"%s(%p) %-*d-> %s
\n
"
,
what
,
obj
,
*
pdepth
,
*
pdepth
,
function
);
fprintf
(
stderr
,
"%s(%p) %-*d-> %s
\n
"
,
what
,
obj
,
*
pdepth
,
*
pdepth
,
function
)
);
if
(
max_depth
)
++*
pdepth
;
if
(
max_depth
)
++*
pdepth
;
}
}
~
hb_trace_t
(
void
)
{
if
(
max_depth
)
--*
pdepth
;
}
~
hb_trace_t
(
void
)
{
if
(
max_depth
)
--*
pdepth
;
}
...
@@ -173,7 +173,7 @@ struct hb_trace_t<0> {
...
@@ -173,7 +173,7 @@ struct hb_trace_t<0> {
*/
*/
#ifndef HB_DEBUG_SANITIZE
#ifndef HB_DEBUG_SANITIZE
#define HB_DEBUG_SANITIZE
HB_DEBUG+0
#define HB_DEBUG_SANITIZE
(HB_DEBUG+0)
#endif
#endif
...
@@ -192,17 +192,17 @@ struct hb_sanitize_context_t
...
@@ -192,17 +192,17 @@ struct hb_sanitize_context_t
this
->
edit_count
=
0
;
this
->
edit_count
=
0
;
this
->
debug_depth
=
0
;
this
->
debug_depth
=
0
;
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"sanitize %p init [%p..%p] (%lu bytes)
\n
"
,
fprintf
(
stderr
,
"sanitize %p init [%p..%p] (%lu bytes)
\n
"
,
this
->
blob
,
this
->
start
,
this
->
end
,
this
->
blob
,
this
->
start
,
this
->
end
,
(
unsigned
long
)
(
this
->
end
-
this
->
start
));
(
unsigned
long
)
(
this
->
end
-
this
->
start
))
)
;
}
}
inline
void
finish
(
void
)
inline
void
finish
(
void
)
{
{
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"sanitize %p fini [%p..%p] %u edit requests
\n
"
,
fprintf
(
stderr
,
"sanitize %p fini [%p..%p] %u edit requests
\n
"
,
this
->
blob
,
this
->
start
,
this
->
end
,
this
->
edit_count
);
this
->
blob
,
this
->
start
,
this
->
end
,
this
->
edit_count
)
)
;
hb_blob_unlock
(
this
->
blob
);
hb_blob_unlock
(
this
->
blob
);
hb_blob_destroy
(
this
->
blob
);
hb_blob_destroy
(
this
->
blob
);
...
@@ -217,13 +217,13 @@ struct hb_sanitize_context_t
...
@@ -217,13 +217,13 @@ struct hb_sanitize_context_t
p
<=
this
->
end
&&
p
<=
this
->
end
&&
(
unsigned
int
)
(
this
->
end
-
p
)
>=
len
;
(
unsigned
int
)
(
this
->
end
-
p
)
>=
len
;
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
\
(
void
)
(
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
"
,
\
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> range [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
p
,
p
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
debug_depth
,
p
,
p
+
len
,
len
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
,
this
->
start
,
this
->
end
,
ret
?
"pass"
:
"FAIL"
);
ret
?
"pass"
:
"FAIL"
)
)
;
return
likely
(
ret
);
return
likely
(
ret
);
}
}
...
@@ -233,13 +233,13 @@ struct hb_sanitize_context_t
...
@@ -233,13 +233,13 @@ struct hb_sanitize_context_t
const
char
*
p
=
(
const
char
*
)
base
;
const
char
*
p
=
(
const
char
*
)
base
;
bool
overflows
=
record_size
>
0
&&
len
>=
((
unsigned
int
)
-
1
)
/
record_size
;
bool
overflows
=
record_size
>
0
&&
len
>=
((
unsigned
int
)
-
1
)
/
record_size
;
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
(
void
)
(
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
"
,
\
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> array [%p..%p] (%d*%d=%ld bytes) in [%p..%p] -> %s
\n
"
,
p
,
p
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
debug_depth
,
p
,
p
+
(
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
,
this
->
start
,
this
->
end
,
!
overflows
?
"does not overflow"
:
"OVERFLOWS FAIL"
);
!
overflows
?
"does not overflow"
:
"OVERFLOWS FAIL"
)
)
;
return
likely
(
!
overflows
&&
this
->
check_range
(
base
,
record_size
*
len
));
return
likely
(
!
overflows
&&
this
->
check_range
(
base
,
record_size
*
len
));
}
}
...
@@ -255,14 +255,14 @@ struct hb_sanitize_context_t
...
@@ -255,14 +255,14 @@ struct hb_sanitize_context_t
const
char
*
p
=
(
const
char
*
)
base
;
const
char
*
p
=
(
const
char
*
)
base
;
this
->
edit_count
++
;
this
->
edit_count
++
;
if
(
HB_DEBUG_SANITIZE
&&
(
int
)
this
->
debug_depth
<
(
int
)
HB_DEBUG_SANITIZE
)
(
void
)
(
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
"
,
\
fprintf
(
stderr
,
"SANITIZE(%p) %-*d-> edit(%u) [%p..%p] (%d bytes) in [%p..%p] -> %s
\n
"
,
p
,
p
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
debug_depth
,
this
->
edit_count
,
this
->
edit_count
,
p
,
p
+
len
,
len
,
p
,
p
+
len
,
len
,
this
->
start
,
this
->
end
,
this
->
start
,
this
->
end
,
this
->
writable
?
"granted"
:
"REJECTED"
);
this
->
writable
?
"granted"
:
"REJECTED"
)
)
;
return
this
->
writable
;
return
this
->
writable
;
}
}
...
@@ -290,8 +290,8 @@ struct Sanitizer
...
@@ -290,8 +290,8 @@ struct Sanitizer
return
hb_blob_create_empty
();
return
hb_blob_create_empty
();
retry:
retry:
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"Sanitizer %p start %s
\n
"
,
blob
,
HB_FUNC
);
fprintf
(
stderr
,
"Sanitizer %p start %s
\n
"
,
blob
,
HB_FUNC
)
)
;
c
->
init
(
blob
);
c
->
init
(
blob
);
...
@@ -305,17 +305,17 @@ struct Sanitizer
...
@@ -305,17 +305,17 @@ struct Sanitizer
sane
=
t
->
sanitize
(
c
);
sane
=
t
->
sanitize
(
c
);
if
(
sane
)
{
if
(
sane
)
{
if
(
c
->
edit_count
)
{
if
(
c
->
edit_count
)
{
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"Sanitizer %p passed first round with %d edits; doing a second round %s
\n
"
,
fprintf
(
stderr
,
"Sanitizer %p passed first round with %d edits; doing a second round %s
\n
"
,
blob
,
c
->
edit_count
,
HB_FUNC
);
blob
,
c
->
edit_count
,
HB_FUNC
)
)
;
/* sanitize again to ensure no toe-stepping */
/* sanitize again to ensure no toe-stepping */
c
->
edit_count
=
0
;
c
->
edit_count
=
0
;
sane
=
t
->
sanitize
(
c
);
sane
=
t
->
sanitize
(
c
);
if
(
c
->
edit_count
)
{
if
(
c
->
edit_count
)
{
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"Sanitizer %p requested %d edits in second round; FAILLING %s
\n
"
,
fprintf
(
stderr
,
"Sanitizer %p requested %d edits in second round; FAILLING %s
\n
"
,
blob
,
c
->
edit_count
,
HB_FUNC
);
blob
,
c
->
edit_count
,
HB_FUNC
)
)
;
sane
=
false
;
sane
=
false
;
}
}
}
}
...
@@ -325,14 +325,14 @@ struct Sanitizer
...
@@ -325,14 +325,14 @@ struct Sanitizer
c
->
finish
();
c
->
finish
();
if
(
edit_count
&&
!
hb_blob_is_writable
(
blob
)
&&
hb_blob_try_writable
(
blob
))
{
if
(
edit_count
&&
!
hb_blob_is_writable
(
blob
)
&&
hb_blob_try_writable
(
blob
))
{
/* ok, we made it writable by relocating. try again */
/* ok, we made it writable by relocating. try again */
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"Sanitizer %p retry %s
\n
"
,
blob
,
HB_FUNC
);
fprintf
(
stderr
,
"Sanitizer %p retry %s
\n
"
,
blob
,
HB_FUNC
)
)
;
goto
retry
;
goto
retry
;
}
}
}
}
if
(
HB_DEBUG_SANITIZE
)
(
void
)
(
HB_DEBUG_SANITIZE
&&
fprintf
(
stderr
,
"Sanitizer %p %s %s
\n
"
,
blob
,
sane
?
"passed"
:
"FAILED"
,
HB_FUNC
);
fprintf
(
stderr
,
"Sanitizer %p %s %s
\n
"
,
blob
,
sane
?
"passed"
:
"FAILED"
,
HB_FUNC
)
)
;
if
(
sane
)
if
(
sane
)
return
blob
;
return
blob
;
else
{
else
{
...
@@ -577,18 +577,16 @@ struct GenericArrayOf
...
@@ -577,18 +577,16 @@ struct GenericArrayOf
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
TRACE_SANITIZE
();
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
/* Note: for structs that do not reference other structs,
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
*/
return
true
;
(
void
)
(
false
&&
array
[
0
].
sanitize
(
c
));
/* We do keep this code though to make sure the structs pointed
* to do have a simple sanitize(), ie. they do not reference
* other structs. */
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
array
[
i
].
sanitize
(
c
)))
return
false
;
return
true
;
return
true
;
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
)
{
...
@@ -688,18 +686,16 @@ struct HeadlessArrayOf
...
@@ -688,18 +686,16 @@ struct HeadlessArrayOf
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
TRACE_SANITIZE
();
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
/* Note: for structs that do not reference other structs,
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
*/
return
true
;
(
void
)
(
false
&&
array
[
0
].
sanitize
(
c
));
/* We do keep this code though to make sure the structs pointed
* to do have a simple sanitize(), ie. they do not reference
* other structs. */
unsigned
int
count
=
len
?
len
-
1
:
0
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
array
[
i
].
sanitize
(
c
)))
return
false
;
return
true
;
return
true
;
}
}
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
11e3ec44
...
@@ -41,7 +41,7 @@ HB_BEGIN_DECLS
...
@@ -41,7 +41,7 @@ HB_BEGIN_DECLS
#ifndef HB_DEBUG_APPLY
#ifndef HB_DEBUG_APPLY
#define HB_DEBUG_APPLY
HB_DEBUG+0
#define HB_DEBUG_APPLY
(HB_DEBUG+0)
#endif
#endif
#define TRACE_APPLY() \
#define TRACE_APPLY() \
...
...
src/hb-private.h
浏览文件 @
11e3ec44
...
@@ -257,8 +257,7 @@ _hb_trace (const char *what,
...
@@ -257,8 +257,7 @@ _hb_trace (const char *what,
unsigned
int
depth
,
unsigned
int
depth
,
unsigned
int
max_depth
)
unsigned
int
max_depth
)
{
{
if
(
depth
<
max_depth
)
(
void
)
((
depth
<
max_depth
)
&&
fprintf
(
stderr
,
"%s(%p) %-*d-> %s
\n
"
,
what
,
obj
,
depth
,
depth
,
function
));
fprintf
(
stderr
,
"%s(%p) %-*d-> %s
\n
"
,
what
,
obj
,
depth
,
depth
,
function
);
return
TRUE
;
return
TRUE
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录