Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
f18a0ed3
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
12 个月 前同步成功
通知
4
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Libpng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f18a0ed3
编写于
8月 24, 2010
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[devel] Simplified the pngvalid error-handling code
now that cexcept.h is in place.
上级
92ac4fc2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
67 deletion
+49
-67
ANNOUNCE
ANNOUNCE
+1
-0
CHANGES
CHANGES
+1
-0
pngvalid.c
pngvalid.c
+47
-67
未找到文件。
ANNOUNCE
浏览文件 @
f18a0ed3
...
...
@@ -372,6 +372,7 @@ Version 1.5.0beta44 [August 11, 2010]
Reformatted/rearranged pngvalid.c to assist use of progressive reader.
Check interlaced images in pngvalid
Clarified pngusr.h comments in pnglibconf.dfa
Simplified the pngvalid error-handling code now that cexcept.h is in place.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit
...
...
CHANGES
浏览文件 @
f18a0ed3
...
...
@@ -3009,6 +3009,7 @@ Version 1.5.0beta44 [August 11, 2010]
Reformatted/rearranged pngvalid.c to assist use of progressive reader.
Check interlaced images in pngvalid
Clarified pngusr.h comments in pnglibconf.dfa
Simplified the pngvalid error-handling code now that cexcept.h is in place.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
...
...
pngvalid.c
浏览文件 @
f18a0ed3
...
...
@@ -952,42 +952,45 @@ static png_structp
set_store_for_read
(
png_store
*
ps
,
png_infopp
ppi
,
png_uint_32
id
,
PNG_CONST
char
*
name
)
{
context
(
ps
,
fault
);
png_structp
result
=
NULL
;
/* NOTE: reference to 'name' must be outside the Try block or GCC can
* optimize it away.
*/
/* Set the name for png_error */
safecat
(
ps
->
test
,
sizeof
ps
->
test
,
0
,
name
);
Try
{
if
(
ps
->
pread
!=
NULL
)
png_error
(
ps
->
pread
,
"store already in use"
);
if
(
ps
->
pread
!=
NULL
)
png_error
(
ps
->
pread
,
"store already in use"
);
store_read_reset
(
ps
);
store_read_reset
(
ps
);
if
(
ps
->
speed
)
ps
->
pread
=
png_create_read_struct
(
PNG_LIBPNG_VER_STRING
,
ps
,
store_error
,
store_warning
);
else
ps
->
pread
=
png_create_read_struct_2
(
PNG_LIBPNG_VER_STRING
,
ps
,
store_error
,
store_warning
,
&
ps
->
read_memory_pool
,
store_malloc
,
store_free
);
store_read_set
(
ps
,
id
);
/* Both the create APIs can return NULL if used in their default mode
* (because there is no other way of handling an error because the jmp_buf by
* default is stored in png_struct and that has not been allocated!)
* However, given that store_error works correctly in these circumstances we
* don't ever expect NULL in this program.
*/
if
(
ps
->
speed
)
ps
->
pread
=
png_create_read_struct
(
PNG_LIBPNG_VER_STRING
,
ps
,
store_error
,
store_warning
);
else
ps
->
pread
=
png_create_read_struct_2
(
PNG_LIBPNG_VER_STRING
,
ps
,
store_error
,
store_warning
,
&
ps
->
read_memory_pool
,
store_malloc
,
store_free
);
if
(
ppi
!=
NULL
)
*
ppi
=
ps
->
piread
=
png_create_info_struct
(
ps
->
pread
);
if
(
ps
->
pread
==
NULL
)
{
struct
exception_context
*
the_exception_context
=
&
ps
->
exception_context
;
result
=
ps
->
pread
;
}
++
(
ps
->
nerrors
);
fprintf
(
stderr
,
"%s: png_create_read_struct returned NULL (unexpected)
\n
"
,
ps
->
test
);
Catch
(
fault
)
{
if
(
ps
!=
fault
)
Throw
fault
;
Throw
ps
;
}
store_read_set
(
ps
,
id
);
return
result
;
if
(
ppi
!=
NULL
)
*
ppi
=
ps
->
piread
=
png_create_info_struct
(
ps
->
pread
);
return
ps
->
pread
;
}
/* The overall cleanup of a store simply calls the above then removes all the
...
...
@@ -1443,34 +1446,21 @@ static png_structp
set_modifier_for_read
(
png_modifier
*
pm
,
png_infopp
ppi
,
png_uint_32
id
,
PNG_CONST
char
*
name
)
{
volatile
png_structp
ppSafe
=
set_store_for_read
(
&
pm
->
this
,
ppi
,
id
,
name
);
if
(
ppSafe
!=
NULL
)
{
context
(
&
pm
->
this
,
fault
);
Try
{
pm
->
state
=
modifier_start
;
pm
->
bit_depth
=
0
;
pm
->
colour_type
=
255
;
pm
->
pending_len
=
0
;
pm
->
pending_chunk
=
0
;
pm
->
flush
=
0
;
pm
->
buffer_count
=
0
;
pm
->
buffer_position
=
0
;
}
/* Do this first so that the modifier fields are cleared even if an error
* happens allocating the png_struct. No allocation is done here so no
* cleanup is required.
*/
pm
->
state
=
modifier_start
;
pm
->
bit_depth
=
0
;
pm
->
colour_type
=
255
;
Catch
(
fault
)
{
store_read_reset
(
&
pm
->
this
);
if
(
fault
!=
&
pm
->
this
)
Throw
fault
;
return
NULL
;
}
}
pm
->
pending_len
=
0
;
pm
->
pending_chunk
=
0
;
pm
->
flush
=
0
;
pm
->
buffer_count
=
0
;
pm
->
buffer_position
=
0
;
return
ppSafe
;
return
set_store_for_read
(
&
pm
->
this
,
ppi
,
id
,
name
)
;
}
/***************************** STANDARD PNG FILES *****************************/
...
...
@@ -2031,17 +2021,12 @@ standard_test(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
size_t
cbRow
;
int
npasses
;
/* Get a png_struct for writing the image. */
/* Get a png_struct for writing the image, this will throw an error if it
* fails, so we don't need to check the result.
*/
pp
=
set_store_for_read
(
ps
,
&
pi
,
FILEID
(
colour_type
,
bit_depth
,
interlace_type
),
"standard"
);
/* 'return' from within a Try block is not permitted, so use a bare Throw
* to get to the Catch block: set_store_for_read has already handled the
* error.
*/
if
(
pp
==
NULL
)
Throw
ps
;
/* Introduce the correct read function. */
png_set_read_fn
(
ps
->
pread
,
ps
,
store_read
);
...
...
@@ -2394,15 +2379,10 @@ gamma_test(png_modifier *pm, PNG_CONST png_byte colour_type,
modification_reset
(
pm
->
modifications
);
/* Get a png_struct for writing the image, if this fails just given up by
* doing a Throw to get to the Catch below.
*/
/* Get a png_struct for writing the image. */
pp
=
set_modifier_for_read
(
pm
,
&
pi
,
FILEID
(
colour_type
,
bit_depth
,
interlace_type
),
name
);
if
(
pp
==
NULL
)
Throw
&
pm
->
this
;
/* Se the correct read function. */
png_set_read_fn
(
pp
,
pm
,
modifier_read
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录