Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
a357b991
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
1 年多 前同步成功
通知
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看板
提交
a357b991
编写于
2月 08, 1998
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Imported from libpng-0.99d.tar
上级
0f881d62
变更
24
展开全部
隐藏空白更改
内联
并排
Showing
24 changed file
with
3279 addition
and
1210 deletion
+3279
-1210
CHANGES
CHANGES
+10
-2
README
README
+1
-1
libpng.3
libpng.3
+2594
-38
libpng.txt
libpng.txt
+492
-317
png.5
png.5
+1
-1
png.c
png.c
+3
-2
png.h
png.h
+9
-7
pngconf.h
pngconf.h
+4
-4
pngerror.c
pngerror.c
+2
-2
pngget.c
pngget.c
+37
-35
pngmem.c
pngmem.c
+23
-31
pngpread.c
pngpread.c
+17
-7
pngread.c
pngread.c
+3
-3
pngrio.c
pngrio.c
+2
-2
pngrtran.c
pngrtran.c
+5
-8
pngrutil.c
pngrutil.c
+38
-23
pngset.c
pngset.c
+19
-19
pngtest.c
pngtest.c
+2
-4
pngtrans.c
pngtrans.c
+2
-2
pngwio.c
pngwio.c
+4
-4
pngwrite.c
pngwrite.c
+6
-6
pngwtran.c
pngwtran.c
+2
-2
pngwutil.c
pngwutil.c
+3
-3
synopsis.txt
synopsis.txt
+0
-687
未找到文件。
CHANGES
浏览文件 @
a357b991
...
...
@@ -223,5 +223,13 @@ version 0.99b [February 4, 1998]
version 0.99c [February 7, 1998]
More type casting. Removed erroneous overflow test in pngmem.c.
Added png_buffered_memcpy() and png_buffered_memset(), apply them to rowbytes.
Added UNIX manual pages libpng.3, initially created by R. P. C. Rodgers,
U.S. National Library of Medicine (rodgers@nlm.nih.gov), and png.5.
Added UNIX manual pages libpng.3 (incorporating libpng.txt) and png.5.
version 0.99d [February 8, 1998]
Renamed "far_to_near()" "png_far_to_near()"
Revised libpng.3
Version 99c "buffered" operations didn't work as intended. Replaced them
with png_memcpy_check() and png_memset_check().
version 0.99e [February 9, 1998]
Fixed a bug with background compositing of paletted images in pngrtran.c
Added many "if (png_ptr == NULL) return" to quell compiler warnings about
unused png_ptr, mostly in pngget.c and pngset.c.
README
浏览文件 @
a357b991
[NOTE: this is still beta version 0.99
c
; the text below has already
[NOTE: this is still beta version 0.99
d
; the text below has already
been updated in anticipation of the imminent 1.0 release.]
...
...
libpng.3
浏览文件 @
a357b991
此差异已折叠。
点击以展开。
libpng.txt
浏览文件 @
a357b991
此差异已折叠。
点击以展开。
png.5
浏览文件 @
a357b991
.TH PNG 5 "February
7
, 1998"
.TH PNG 5 "February
8
, 1998"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
...
...
png.c
浏览文件 @
a357b991
/* png.c - location for general purpose libpng functions
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*/
#define PNG_INTERNAL
...
...
@@ -200,6 +200,7 @@ png_create_info_struct(png_structp png_ptr)
png_infop
info_ptr
;
png_debug
(
1
,
"in png_create_info_struct
\n
"
);
if
(
png_ptr
==
NULL
)
return
(
NULL
);
if
((
info_ptr
=
(
png_infop
)
png_create_struct
(
PNG_STRUCT_INFO
))
!=
NULL
)
{
png_info_init
(
info_ptr
);
...
...
png.h
浏览文件 @
a357b991
/* png.h - header file for PNG reference library
*
* libpng 0.99
c
beta
* libpng 0.99
d
beta
* For conditions of distribution and use, see the COPYRIGHT NOTICE below.
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998 Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* Note about libpng version numbers:
*
...
...
@@ -30,6 +30,7 @@
* 0.99a 0.99 2.0.99
* 0.99b 0.99 2.0.99
* 0.99c 0.99 2.0.99
* 0.99d 0.99 2.0.99
* 1.0 1.00 2.1.0
*
* Henceforth the source version will match the shared-library minor
...
...
@@ -1109,10 +1110,10 @@ extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
/* frees a pointer allocated by png_malloc() */
extern
PNG_EXPORT
(
void
,
png_free
)
PNGARG
((
png_structp
png_ptr
,
png_voidp
ptr
));
extern
PNG_EXPORT
(
void
,
png_buffered_memcpy
)
PNGARG
((
png_structp
png_ptr
,
extern
PNG_EXPORT
(
png_voidp
,
png_memcpy_check
)
PNGARG
((
png_structp
png_ptr
,
png_voidp
s1
,
png_voidp
s2
,
png_uint_32
size
));
extern
PNG_EXPORT
(
void
,
png_buffered_memset
)
PNGARG
((
png_structp
png_ptr
,
extern
PNG_EXPORT
(
png_voidp
,
png_memset_check
)
PNGARG
((
png_structp
png_ptr
,
png_voidp
s1
,
int
value
,
png_uint_32
size
));
#ifdef PNGTEST_MEMORY_DEBUG
...
...
@@ -1123,7 +1124,8 @@ extern PNG_EXPORT(void,png_debug_free) PNGARG((png_structp png_ptr,
png_voidp
ptr
));
#endif
#if defined(USE_FAR_KEYWORD)
/* memory model conversion function */
extern
void
*
far_to_near
PNGARG
((
png_structp
png_ptr
,
png_voidp
ptr
,
int
check
));
extern
void
*
png_far_to_near
PNGARG
((
png_structp
png_ptr
,
png_voidp
ptr
,
int
check
));
#endif
/* USE_FAR_KEYWORD */
/* Fatal error in PNG image of libpng - can't continue */
...
...
@@ -1475,8 +1477,8 @@ extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
#define PNG_FLAG_FREE_PALETTE 0x1000
#define PNG_FLAG_FREE_TRANS 0x2000
#define PNG_FLAG_FREE_HIST 0x4000
#define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000
#define PNG_FLAG_WROTE_tIME 0x10000
#define PNG_FLAG_HAVE_CHUNK_HEADER 0x8000
L
#define PNG_FLAG_WROTE_tIME 0x10000
L
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
...
...
pngconf.h
浏览文件 @
a357b991
/* pngconf.h - machine configurable file for libpng
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*/
/* Any machine specific code is near the front of this file, so if you
...
...
@@ -525,8 +525,8 @@ typedef z_stream FAR * png_zstreamp;
/* use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
# define CVT_PTR(ptr) (far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (far_to_near(png_ptr,ptr,NOCHECK))
# define CVT_PTR(ptr) (
png_
far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (
png_
far_to_near(png_ptr,ptr,NOCHECK))
# define png_strlen _fstrlen
# define png_memcmp _fmemcmp
/* SJT: added */
# define png_memcpy _fmemcpy
...
...
pngerror.c
浏览文件 @
a357b991
/* pngerror.c - stub functions for i/o and memory allocation
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file provides a location for all error handling. Users which
* need special error handling are expected to write replacement functions
...
...
pngget.c
浏览文件 @
a357b991
/* pngget.c - retrieval of values from info struct
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*/
#define PNG_INTERNAL
...
...
@@ -15,7 +15,7 @@
png_uint_32
png_get_valid
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
flag
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
return
(
info_ptr
->
valid
&
flag
);
else
return
(
0
);
...
...
@@ -24,7 +24,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
png_uint_32
png_get_rowbytes
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
return
(
info_ptr
->
rowbytes
);
else
return
(
0
);
...
...
@@ -35,7 +35,7 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
png_uint_32
png_get_image_width
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
width
;
}
...
...
@@ -45,7 +45,7 @@ png_get_image_width(png_structp png_ptr, png_infop info_ptr)
png_uint_32
png_get_image_height
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
height
;
}
...
...
@@ -55,7 +55,7 @@ png_get_image_height(png_structp png_ptr, png_infop info_ptr)
png_byte
png_get_bit_depth
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
bit_depth
;
}
...
...
@@ -65,7 +65,7 @@ png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
png_byte
png_get_color_type
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
color_type
;
}
...
...
@@ -75,7 +75,7 @@ png_get_color_type(png_structp png_ptr, png_infop info_ptr)
png_byte
png_get_filter_type
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
filter_type
;
}
...
...
@@ -85,7 +85,7 @@ png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
png_byte
png_get_interlace_type
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
interlace_type
;
}
...
...
@@ -95,7 +95,7 @@ png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
png_byte
png_get_compression_type
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
{
return
info_ptr
->
compression_type
;
}
...
...
@@ -106,7 +106,7 @@ png_uint_32
png_get_pixels_per_meter
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pHYs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pHYs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_pixels_per_meter"
);
if
(
info_ptr
->
phys_unit_type
!=
PNG_RESOLUTION_METER
)
...
...
@@ -122,7 +122,7 @@ float
png_get_pixel_aspect_ratio
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
#if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pHYs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pHYs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_aspect_ratio"
);
if
(
info_ptr
->
x_pixels_per_unit
==
0
)
...
...
@@ -140,7 +140,7 @@ png_uint_32
png_get_x_offset_microns
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_x_offset_microns"
);
if
(
info_ptr
->
offset_unit_type
!=
PNG_OFFSET_MICROMETER
)
...
...
@@ -156,7 +156,7 @@ png_uint_32
png_get_y_offset_microns
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_y_offset_microns"
);
if
(
info_ptr
->
offset_unit_type
!=
PNG_OFFSET_MICROMETER
)
...
...
@@ -172,7 +172,7 @@ png_uint_32
png_get_x_offset_pixels
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_x_offset_microns"
);
if
(
info_ptr
->
offset_unit_type
!=
PNG_OFFSET_PIXEL
)
...
...
@@ -188,7 +188,7 @@ png_uint_32
png_get_y_offset_pixels
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
#if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_y_offset_microns"
);
if
(
info_ptr
->
offset_unit_type
!=
PNG_OFFSET_PIXEL
)
...
...
@@ -206,7 +206,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
png_byte
png_get_channels
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
return
(
info_ptr
->
channels
);
else
return
(
0
);
...
...
@@ -215,7 +215,7 @@ png_get_channels(png_structp png_ptr, png_infop info_ptr)
png_bytep
png_get_signature
(
png_structp
png_ptr
,
png_infop
info_ptr
)
{
if
(
info_ptr
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
)
return
(
info_ptr
->
signature
);
else
return
(
NULL
);
...
...
@@ -226,7 +226,7 @@ png_uint_32
png_get_bKGD
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_color_16p
*
background
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_bKGD
&&
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_bKGD
&&
background
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"bKGD"
);
...
...
@@ -243,7 +243,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
double
*
white_x
,
double
*
white_y
,
double
*
red_x
,
double
*
red_y
,
double
*
green_x
,
double
*
green_y
,
double
*
blue_x
,
double
*
blue_y
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_cHRM
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_cHRM
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"cHRM"
);
if
(
white_x
!=
NULL
)
...
...
@@ -272,7 +272,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
png_uint_32
png_get_gAMA
(
png_structp
png_ptr
,
png_infop
info_ptr
,
double
*
file_gamma
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_gAMA
&&
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_gAMA
&&
file_gamma
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"gAMA"
);
...
...
@@ -287,7 +287,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
png_uint_32
png_get_sRGB
(
png_structp
png_ptr
,
png_infop
info_ptr
,
int
*
file_srgb_intent
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_sRGB
&&
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_sRGB
&&
file_srgb_intent
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"sRGB"
);
...
...
@@ -302,7 +302,8 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
png_uint_32
png_get_hIST
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_16p
*
hist
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_hIST
&&
hist
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_hIST
&&
hist
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"hIST"
);
*
hist
=
info_ptr
->
hist
;
...
...
@@ -319,10 +320,9 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
int
*
filter_type
)
{
if
(
info_ptr
!=
NULL
&&
width
!=
NULL
&&
height
!=
NULL
&&
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
width
!=
NULL
&&
height
!=
NULL
&&
bit_depth
!=
NULL
&&
color_type
!=
NULL
)
{
png_uint_32
rowbytes
;
int
pixel_depth
,
channels
;
png_uint_32
rowbytes_per_pixel
;
...
...
@@ -349,7 +349,6 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
channels
++
;
pixel_depth
=
*
bit_depth
*
channels
;
rowbytes_per_pixel
=
(
pixel_depth
+
7
)
>>
3
;
rowbytes
=
*
width
*
rowbytes_per_pixel
;
if
((
*
width
>
(
png_uint_32
)
2147483647L
/
rowbytes_per_pixel
))
{
png_warning
(
png_ptr
,
...
...
@@ -365,7 +364,7 @@ png_uint_32
png_get_oFFs
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
*
offset_x
,
png_uint_32
*
offset_y
,
int
*
unit_type
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
&&
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_oFFs
&&
offset_x
!=
NULL
&&
offset_y
!=
NULL
&&
unit_type
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"oFFs"
);
...
...
@@ -384,7 +383,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp
*
purpose
,
png_int_32
*
X0
,
png_int_32
*
X1
,
int
*
type
,
int
*
nparams
,
png_charp
*
units
,
png_charpp
*
params
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pCAL
&&
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pCAL
&&
purpose
!=
NULL
&&
X0
!=
NULL
&&
X1
!=
NULL
&&
type
!=
NULL
&&
nparams
!=
NULL
&&
units
!=
NULL
&&
params
!=
NULL
)
{
...
...
@@ -409,7 +408,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
{
png_uint_32
retval
=
0
;
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pHYs
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_pHYs
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"pHYs"
);
if
(
res_x
!=
NULL
&&
res_y
!=
NULL
)
...
...
@@ -433,7 +432,8 @@ png_uint_32
png_get_PLTE
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_colorp
*
palette
,
int
*
num_palette
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_PLTE
&&
palette
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_PLTE
&&
palette
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"PLTE"
);
*
palette
=
info_ptr
->
palette
;
...
...
@@ -448,7 +448,8 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
png_uint_32
png_get_sBIT
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_color_8p
*
sig_bit
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_sBIT
&&
sig_bit
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_sBIT
&&
sig_bit
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"sBIT"
);
*
sig_bit
=
&
(
info_ptr
->
sig_bit
);
...
...
@@ -463,7 +464,7 @@ png_uint_32
png_get_text
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_textp
*
text_ptr
,
int
*
num_text
)
{
if
(
(
info_ptr
!=
NULL
)
||
(
info_ptr
->
num_text
>
0
)
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
||
info_ptr
->
num_text
>
0
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
(
png_ptr
->
chunk_name
[
0
]
==
'\0'
?
"text"
...
...
@@ -482,7 +483,8 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
png_uint_32
png_get_tIME
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_timep
*
mod_time
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_tIME
&&
mod_time
!=
NULL
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_tIME
&&
mod_time
!=
NULL
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"tIME"
);
*
mod_time
=
&
(
info_ptr
->
mod_time
);
...
...
@@ -497,7 +499,7 @@ png_uint_32
png_get_tRNS
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_bytep
*
trans
,
int
*
num_trans
,
png_color_16p
*
trans_values
)
{
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_tRNS
)
if
(
png_ptr
!=
NULL
&&
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_tRNS
)
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"tRNS"
);
if
(
info_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
&&
trans
!=
NULL
)
...
...
pngmem.c
浏览文件 @
a357b991
/* pngmem.c - stub functions for memory allocation
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file provides a location for all memory allocation. Users which
* need special memory handling are expected to modify the code in this file
...
...
@@ -282,27 +282,22 @@ png_voidp
PNG_MALLOC
(
png_structp
png_ptr
,
png_uint_32
size
)
{
png_voidp
ret
;
png_size_t
length
;
if
(
png_ptr
==
NULL
||
size
==
0
)
return
((
png_voidp
)
NULL
);
#ifdef PNG_MAX_MALLOC_64K
if
(
png_
size
>
(
png_uint_32
)
65536L
)
if
(
size
>
(
png_uint_32
)
65536L
)
png_error
(
png_ptr
,
"Cannot Allocate > 64K"
);
#endif
length
=
(
png_size_t
)
size
;
if
((
png_uint_32
)
length
!=
size
)
png_error
(
png_ptr
,
"Cannot Allocate > size_t"
);
#if defined(__TURBOC__) && !defined(__FLAT__)
ret
=
farmalloc
(
length
);
ret
=
farmalloc
(
size
);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
ret
=
halloc
(
length
,
1
);
ret
=
halloc
(
size
,
1
);
# else
ret
=
malloc
(
length
);
ret
=
malloc
(
size
);
# endif
#endif
...
...
@@ -336,32 +331,29 @@ PNG_FREE(png_structp png_ptr, png_voidp ptr)
#endif
/* Not Borland DOS special memory handler */
void
png_
buffered_memcpy
(
png_structp
png_ptr
,
png_voidp
s1
,
png_voidp
s2
,
png_voidp
png_
memcpy_check
(
png_structp
png_ptr
,
png_voidp
s1
,
png_voidp
s2
,
png_uint_32
length
)
{
png_size_t
size
;
png_uint_32
i
;
for
(
i
=
0
;
i
<
length
;
i
+=
65530
)
{
size
=
(
png_size_t
)(
length
-
i
);
if
(
size
>
(
png_size_t
)
65530L
)
size
=
(
png_size_t
)
65530L
;
png_memcpy
(
s1
,
s2
,
size
);
}
size
=
(
png_size_t
)
length
;
if
((
png_uint_32
)
size
!=
length
)
png_error
(
png_ptr
,
"Overflow in png_memcpy_check."
);
return
(
png_memcpy
(
s1
,
s2
,
size
));
}
void
png_
buffered_memset
(
png_structp
png_ptr
,
png_voidp
s1
,
int
value
,
png_voidp
png_
memset_check
(
png_structp
png_ptr
,
png_voidp
s1
,
int
value
,
png_uint_32
length
)
{
png_size_t
size
;
png_uint_32
i
;
for
(
i
=
0
;
i
<
length
;
i
+=
65530
)
{
size
=
length
-
i
;
if
(
size
>
65530
)
size
=
65530
;
png_memset
(
s1
,
value
,
size
);
}
size
=
(
png_size_t
)
length
;
if
((
png_uint_32
)
size
!=
length
)
png_error
(
png_ptr
,
"Overflow in png_memset_check."
);
return
(
png_memset
(
s1
,
value
,
size
));
}
pngpread.c
浏览文件 @
a357b991
/* pngpread.c - read a png file in push mode
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*/
#define PNG_INTERNAL
...
...
@@ -638,7 +638,7 @@ png_push_process_row(png_structp png_ptr)
png_ptr
->
row_buf
+
1
,
png_ptr
->
prev_row
+
1
,
(
int
)(
png_ptr
->
row_buf
[
0
]));
png_
buffered_memcpy
(
png_ptr
,
png_ptr
->
prev_row
,
png_ptr
->
row_buf
,
png_
memcpy_check
(
png_ptr
,
png_ptr
->
prev_row
,
png_ptr
->
row_buf
,
png_ptr
->
rowbytes
+
1
);
if
(
png_ptr
->
transformations
)
...
...
@@ -774,8 +774,8 @@ png_read_push_finish_row(png_structp png_ptr)
if
(
png_ptr
->
interlaced
)
{
png_ptr
->
row_number
=
0
;
png_
buffered_memset
(
png_ptr
,
png_ptr
->
prev_row
,
0
,
(
png_size_t
)
png_ptr
->
rowbytes
+
1
);
png_
memset_check
(
png_ptr
,
png_ptr
->
prev_row
,
0
,
png_ptr
->
rowbytes
+
1
);
do
{
png_ptr
->
pass
++
;
...
...
@@ -806,7 +806,11 @@ void
png_push_handle_tEXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
{
if
(
png_ptr
->
mode
==
PNG_BEFORE_IHDR
||
png_ptr
->
mode
&
PNG_HAVE_IEND
)
png_error
(
png_ptr
,
"Out of place tEXt"
);
{
png_error
(
png_ptr
,
"Out of place tEXt"
);
/* to quiet some compiler warnings */
if
(
info_ptr
==
NULL
)
return
;
}
#ifdef PNG_MAX_MALLOC_64K
png_ptr
->
skip_length
=
0
;
/* This may not be necessary */
...
...
@@ -888,7 +892,11 @@ void
png_push_handle_zTXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
{
if
(
png_ptr
->
mode
==
PNG_BEFORE_IHDR
||
png_ptr
->
mode
&
PNG_HAVE_IEND
)
png_error
(
png_ptr
,
"Out of place zTXt"
);
{
png_error
(
png_ptr
,
"Out of place zTXt"
);
/* to quiet some compiler warnings */
if
(
info_ptr
==
NULL
)
return
;
}
#ifdef PNG_MAX_MALLOC_64K
/* We can't handle zTXt chunks > 64K, since we don't have enough space
...
...
@@ -1073,6 +1081,8 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
if
(
!
(
png_ptr
->
chunk_name
[
0
]
&
0x20
))
{
png_chunk_error
(
png_ptr
,
"unknown critical chunk"
);
/* to quiet some compiler warnings */
if
(
info_ptr
==
NULL
)
return
;
}
png_push_crc_skip
(
png_ptr
,
length
);
...
...
pngread.c
浏览文件 @
a357b991
/* pngread.c - read a PNG file
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file contains routines that an application calls directly to
* read a PNG file or stream.
...
...
@@ -418,7 +418,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_ptr
->
row_buf
+
1
,
png_ptr
->
prev_row
+
1
,
(
int
)(
png_ptr
->
row_buf
[
0
]));
png_
buffered_memcpy
(
png_ptr
,
png_ptr
->
prev_row
,
png_ptr
->
row_buf
,
png_
memcpy_check
(
png_ptr
,
png_ptr
->
prev_row
,
png_ptr
->
row_buf
,
png_ptr
->
rowbytes
+
1
);
if
(
png_ptr
->
transformations
)
...
...
pngrio.c
浏览文件 @
a357b991
/* pngrio.c - functions for data input
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file provides a location for all input. Users which need
* special handling are expected to write a function which has the same
...
...
pngrtran.c
浏览文件 @
a357b991
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
...
...
@@ -1913,24 +1913,21 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
{
if
(
png_ptr
->
color_type
==
PNG_COLOR_TYPE_PALETTE
)
{
int
i
;
png_color
back
;
back
.
red
=
(
png_byte
)
png_ptr
->
background
.
red
;
back
.
green
=
(
png_byte
)
png_ptr
->
background
.
green
;
back
.
blue
=
(
png_byte
)
png_ptr
->
background
.
blue
;
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
png_ptr
->
num_trans
&&
i
<
num_palette
;
i
++
)
{
if
(
i
>=
(
int
)
png_ptr
->
num_trans
||
png_ptr
->
trans
[
i
]
==
0
)
if
(
png_ptr
->
trans
[
i
]
==
0
)
{
palette
[
i
].
red
=
back
.
red
;
palette
[
i
].
green
=
back
.
green
;
palette
[
i
].
blue
=
back
.
blue
;
}
else
if
(
i
<
(
int
)
png_ptr
->
num_trans
||
png_ptr
->
trans
[
i
]
!=
0xff
)
else
if
(
png_ptr
->
trans
[
i
]
!=
0xff
)
{
png_composite
(
palette
[
i
].
red
,
png_ptr
->
palette
[
i
].
red
,
png_ptr
->
trans
[
i
],
back
.
red
);
...
...
pngrutil.c
浏览文件 @
a357b991
...
...
@@ -6,7 +6,7 @@
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file contains routines which are only called from within
* libpng itself during the course of reading an image.
...
...
@@ -345,6 +345,10 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
!
(
png_ptr
->
mode
&
PNG_HAVE_IDAT
))
{
png_error
(
png_ptr
,
"No image in file"
);
/* to quiet compiler warnings about unused info_ptr */
if
(
info_ptr
==
NULL
)
return
;
}
png_ptr
->
mode
|=
PNG_AFTER_IDAT
|
PNG_HAVE_IEND
;
...
...
@@ -722,7 +726,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
else
if
(
info_ptr
!=
NULL
&&
info_ptr
->
valid
&
PNG_INFO_tRNS
)
{
png_warning
(
png_ptr
,
"Duplcate tRNS chunk"
);
png_warning
(
png_ptr
,
"Dupl
i
cate tRNS chunk"
);
png_crc_finish
(
png_ptr
,
length
);
return
;
}
...
...
@@ -1022,6 +1026,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_byte
type
,
nparams
;
png_charp
buf
,
units
,
endptr
;
png_charpp
params
;
png_size_t
slength
;
int
i
;
png_debug
(
1
,
"in png_handle_pCAL
\n
"
);
...
...
@@ -1044,7 +1049,8 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug1
(
2
,
"Allocating and reading pCAL chunk data (%d bytes)
\n
"
,
length
+
1
);
purpose
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
purpose
,
(
png_size_t
)
length
);
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
purpose
,
slength
);
if
(
png_crc_finish
(
png_ptr
,
0
))
{
...
...
@@ -1052,13 +1058,13 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return
;
}
purpose
[
length
]
=
'\0'
;
/* null terminate the last string */
purpose
[
slength
]
=
0x00
;
/* null terminate the last string */
png_debug
(
3
,
"Finding end of pCAL purpose string
\n
"
);
for
(
buf
=
purpose
;
*
buf
!=
'\0'
;
buf
++
)
/* empty loop */
;
endptr
=
purpose
+
length
;
endptr
=
purpose
+
s
length
;
/* We need to have at least 12 bytes after the purpose string
in order to get the parameter information. */
...
...
@@ -1094,7 +1100,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
/* Empty loop to move past the units string. */
for
(
buf
=
units
;
*
buf
!=
'\0'
;
buf
++
);
for
(
buf
=
units
;
*
buf
!=
0x00
;
buf
++
);
png_debug
(
3
,
"Allocating pCAL parameters array
\n
"
);
params
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
nparams
...
...
@@ -1107,7 +1113,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug1
(
3
,
"Reading pCAL parameter %d
\n
"
,
i
);
/* Empty loop to move past each paramter string */
for
(
params
[
i
]
=
buf
;
*
buf
!=
'\0'
&&
buf
<=
endptr
;
buf
++
);
for
(
params
[
i
]
=
buf
;
*
buf
!=
0x00
&&
buf
<=
endptr
;
buf
++
);
/* Make sure we haven't run out of data yet */
if
(
buf
>
endptr
)
...
...
@@ -1179,6 +1185,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_charp
key
;
png_charp
text
;
png_uint_32
skip
=
0
;
png_size_t
slength
;
png_debug
(
1
,
"in png_handle_tEXt
\n
"
);
...
...
@@ -1198,7 +1205,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
key
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
key
,
(
png_size_t
)
length
);
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
key
,
slength
);
if
(
png_crc_finish
(
png_ptr
,
skip
))
{
...
...
@@ -1206,12 +1214,12 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return
;
}
key
[
length
]
=
'\0'
;
key
[
slength
]
=
0x00
;
for
(
text
=
key
;
*
text
;
text
++
)
/* empty loop to find end of key */
;
if
(
text
!=
key
+
(
png_size_t
)
length
)
if
(
text
!=
key
+
s
length
)
text
++
;
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
...
...
@@ -1235,6 +1243,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_charp
key
;
png_charp
text
;
int
comp_type
=
PNG_TEXT_COMPRESSION_NONE
;
png_size_t
slength
;
png_debug
(
1
,
"in png_handle_zTXt
\n
"
);
...
...
@@ -1256,20 +1265,21 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
key
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
key
,
(
png_size_t
)
length
);
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
key
,
slength
);
if
(
png_crc_finish
(
png_ptr
,
0
))
{
png_free
(
png_ptr
,
key
);
return
;
}
key
[
length
]
=
'\0'
;
key
[
slength
]
=
0x00
;
for
(
text
=
key
;
*
text
;
text
++
)
/* empty loop */
;
/* zTXt must have some text after the keyword */
if
(
text
==
key
+
(
png_size_t
)
length
)
if
(
text
==
key
+
s
length
)
{
png_warning
(
png_ptr
,
"Zero length zTXt chunk"
);
}
...
...
@@ -1283,7 +1293,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr
->
zstream
.
next_out
=
png_ptr
->
zbuf
;
png_ptr
->
zstream
.
avail_out
=
png_ptr
->
zbuf_size
;
key_size
=
text
-
key
;
key_size
=
(
png_size_t
)(
text
-
key
)
;
text_size
=
0
;
text
=
NULL
;
...
...
@@ -1308,10 +1318,10 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_memcpy
(
text
,
key
,
key_size
);
}
text
[
text_size
-
1
]
=
'\0'
;
text
[
text_size
-
1
]
=
0x00
;
/* Copy what we can of the error message into the text chunk */
text_size
=
(
png_size_t
)
length
-
(
text
-
key
)
-
1
;
text_size
=
(
png_size_t
)
(
slength
-
(
text
-
key
)
-
1
)
;
text_size
=
sizeof
(
msg
)
>
text_size
?
text_size
:
sizeof
(
msg
);
png_memcpy
(
text
+
key_size
,
msg
,
text_size
+
1
);
break
;
...
...
@@ -1328,7 +1338,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_memcpy
(
text
,
key
,
key_size
);
text_size
=
key_size
+
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
*
(
text
+
text_size
)
=
'\0'
;
*
(
text
+
text_size
)
=
0x00
;
}
else
{
...
...
@@ -1342,7 +1352,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_memcpy
(
text
+
text_size
,
png_ptr
->
zbuf
,
(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
));
text_size
+=
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
*
(
text
+
text_size
)
=
'\0'
;
*
(
text
+
text_size
)
=
0x00
;
}
if
(
ret
!=
Z_STREAM_END
)
{
...
...
@@ -1376,7 +1386,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
/* Copy what we can of the error message into the text chunk */
text_size
=
(
png_size_t
)
length
-
(
text
-
key
)
-
1
;
text_size
=
(
png_size_t
)
(
slength
-
(
text
-
key
)
-
1
)
;
text_size
=
sizeof
(
msg
)
>
text_size
?
text_size
:
sizeof
(
msg
);
png_memcpy
(
text
,
msg
,
text_size
+
1
);
}
...
...
@@ -1409,12 +1419,17 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if
(
!
(
png_ptr
->
chunk_name
[
0
]
&
0x20
))
{
png_chunk_error
(
png_ptr
,
"unknown critical chunk"
);
/* to quiet compiler warnings about unused info_ptr */
if
(
info_ptr
==
NULL
)
return
;
}
if
(
png_ptr
->
mode
&
PNG_HAVE_IDAT
)
png_ptr
->
mode
|=
PNG_AFTER_IDAT
;
png_crc_finish
(
png_ptr
,
length
);
}
/* This function is called to verify that a chunk name is valid.
...
...
@@ -1847,8 +1862,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
pixel_bytes
=
(
row_info
->
pixel_depth
>>
3
);
sp
=
row
+
(
row_info
->
width
-
1
)
*
pixel_bytes
;
dp
=
row
+
(
final_width
-
1
)
*
pixel_bytes
;
sp
=
row
+
(
png_size_t
)(
row_info
->
width
-
1
)
*
pixel_bytes
;
dp
=
row
+
(
png_size_t
)(
final_width
-
1
)
*
pixel_bytes
;
for
(
i
=
row_info
->
width
;
i
;
i
--
)
{
png_byte
v
[
8
];
...
...
@@ -1993,7 +2008,7 @@ png_read_finish_row(png_structp png_ptr)
if
(
png_ptr
->
interlaced
)
{
png_ptr
->
row_number
=
0
;
png_
buffered_memset
(
png_ptr
,
png_ptr
->
prev_row
,
0
,
png_ptr
->
rowbytes
+
1
);
png_
memset_check
(
png_ptr
,
png_ptr
->
prev_row
,
0
,
png_ptr
->
rowbytes
+
1
);
do
{
png_ptr
->
pass
++
;
...
...
@@ -2203,7 +2218,7 @@ png_read_start_row(png_structp png_ptr)
png_ptr
->
prev_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
png_ptr
->
rowbytes
+
1
));
png_
buffered_memset
(
png_ptr
,
png_ptr
->
prev_row
,
0
,
png_ptr
->
rowbytes
+
1
);
png_
memset_check
(
png_ptr
,
png_ptr
->
prev_row
,
0
,
png_ptr
->
rowbytes
+
1
);
png_debug1
(
3
,
"width = %d,
\n
"
,
png_ptr
->
width
);
png_debug1
(
3
,
"height = %d,
\n
"
,
png_ptr
->
height
);
...
...
pngset.c
浏览文件 @
a357b991
/* pngset.c - storage of image information into info struct
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* The functions here are used during reads to store data from the file
* into the info struct, and during writes to store application data
...
...
@@ -22,7 +22,7 @@ void
png_set_bKGD
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_color_16p
background
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"bKGD"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
png_memcpy
(
&
(
info_ptr
->
background
),
background
,
sizeof
(
png_color_16
));
...
...
@@ -37,7 +37,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double
green_x
,
double
green_y
,
double
blue_x
,
double
blue_y
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"cHRM"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
x_white
=
(
float
)
white_x
;
...
...
@@ -57,7 +57,7 @@ void
png_set_gAMA
(
png_structp
png_ptr
,
png_infop
info_ptr
,
double
file_gamma
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"gAMA"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
gamma
=
(
float
)
file_gamma
;
...
...
@@ -70,7 +70,7 @@ void
png_set_hIST
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_16p
hist
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"hIST"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
hist
=
hist
;
...
...
@@ -86,7 +86,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
{
int
rowbytes_per_pixel
;
png_debug1
(
1
,
"in %s storage function
\n
"
,
"IHDR"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
width
=
width
;
...
...
@@ -123,7 +123,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_uint_32
offset_x
,
png_uint_32
offset_y
,
int
unit_type
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"oFFs"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
x_offset
=
offset_x
;
...
...
@@ -140,10 +140,10 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp
units
,
png_charpp
params
)
{
png_uint_32
length
;
png_uint_32
i
;
int
i
;
png_debug1
(
1
,
"in %s storage function
\n
"
,
"pCAL"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
length
=
png_strlen
(
purpose
)
+
1
;
...
...
@@ -184,7 +184,7 @@ png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32
res_x
,
png_uint_32
res_y
,
int
unit_type
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"pHYs"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
x_pixels_per_unit
=
res_x
;
...
...
@@ -199,7 +199,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
png_colorp
palette
,
int
num_palette
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"PLTE"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
palette
=
palette
;
...
...
@@ -213,7 +213,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p
sig_bit
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"sBIT"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
png_memcpy
(
&
(
info_ptr
->
sig_bit
),
sig_bit
,
sizeof
(
png_color_8
));
...
...
@@ -226,7 +226,7 @@ void
png_set_sRGB
(
png_structp
png_ptr
,
png_infop
info_ptr
,
int
intent
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"sRGB"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
info_ptr
->
srgb_intent
=
(
png_byte
)
intent
;
...
...
@@ -243,7 +243,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
float
white_x
,
white_y
,
red_x
,
red_y
,
green_x
,
green_y
,
blue_x
,
blue_y
;
#endif
png_debug1
(
1
,
"in %s storage function
\n
"
,
"sRGB_gAMA_and_cHRM"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
png_set_sRGB
(
png_ptr
,
info_ptr
,
intent
);
...
...
@@ -281,7 +281,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
png_debug1
(
1
,
"in %s storage function
\n
"
,
(
png_ptr
->
chunk_name
[
0
]
==
'\0'
?
"text"
:
(
png_const_charp
)
png_ptr
->
chunk_name
));
if
(
info_ptr
==
NULL
||
num_text
==
0
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
||
num_text
==
0
)
return
;
/* Make sure we have enough space in the "text" array in info_struct
...
...
@@ -298,7 +298,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr
->
max_text
=
info_ptr
->
num_text
+
num_text
+
8
;
old_text
=
info_ptr
->
text
;
info_ptr
->
text
=
(
png_textp
)
png_malloc
(
png_ptr
,
info_ptr
->
max_text
*
sizeof
(
png_text
));
(
png_uint_32
)(
info_ptr
->
max_text
*
sizeof
(
png_text
)
));
png_memcpy
(
info_ptr
->
text
,
old_text
,
(
png_size_t
)(
old_max
*
sizeof
(
png_text
)));
png_free
(
png_ptr
,
old_text
);
...
...
@@ -344,7 +344,7 @@ void
png_set_tIME
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_timep
mod_time
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"tIME"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
png_memcpy
(
&
(
info_ptr
->
mod_time
),
mod_time
,
sizeof
(
png_time
));
...
...
@@ -358,7 +358,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep
trans
,
int
num_trans
,
png_color_16p
trans_values
)
{
png_debug1
(
1
,
"in %s storage function
\n
"
,
"tRNS"
);
if
(
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
return
;
if
(
trans
!=
NULL
)
...
...
pngtest.c
浏览文件 @
a357b991
/* pngtest.c - a simple test program to test libpng
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This program reads in a PNG image, writes it out again, and then
* compares the two files. If the files are identical, this shows that
...
...
@@ -39,7 +39,6 @@
#ifdef PNGTEST_MEMORY_DEBUG
#include <unistd.h>
void
*
sbrk
(
ssize_t
incr
);
#endif
int
test_one_file
(
PNG_CONST
char
*
inname
,
PNG_CONST
char
*
outname
);
...
...
@@ -857,7 +856,6 @@ main(int argc, char *argv[])
pinfo
=
pinfo
->
next
;
}
}
fprintf
(
STDERR
,
"sbrk(0)=%d
\n
"
,
sbrk
(
0
));
#endif
}
#ifdef PNGTEST_MEMORY_DEBUG
...
...
pngtrans.c
浏览文件 @
a357b991
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*/
#define PNG_INTERNAL
...
...
pngwio.c
浏览文件 @
a357b991
/* pngwio.c - functions for data output
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*
* This file provides a location for all output. Users which need
* special handling are expected to write functions which have the same
...
...
@@ -180,7 +180,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
#if defined(USE_FAR_KEYWORD)
#if defined(_MSC_VER)
void
*
far_to_near
(
png_structp
png_ptr
,
png_voidp
ptr
,
int
check
)
void
*
png_
far_to_near
(
png_structp
png_ptr
,
png_voidp
ptr
,
int
check
)
{
void
*
near_ptr
;
void
FAR
*
far_ptr
;
...
...
@@ -192,7 +192,7 @@ void *far_to_near(png_structp png_ptr,png_voidp ptr, int check)
return
(
near_ptr
);
}
# else
void
*
far_to_near
(
png_structp
png_ptr
,
png_voidp
ptr
,
int
check
)
void
*
png_
far_to_near
(
png_structp
png_ptr
,
png_voidp
ptr
,
int
check
)
{
void
*
near_ptr
;
void
FAR
*
far_ptr
;
...
...
pngwrite.c
浏览文件 @
a357b991
/* pngwrite.c - general routines to write a PNG file
*
* libpng 0.99
c
* libpng 0.99
d
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, Glenn Randers-Pehrson
* February
7
, 1998
* February
8
, 1998
*/
/* get internal access to png.h */
...
...
@@ -502,7 +502,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_debug1
(
3
,
"row_info->rowbytes = %d
\n
"
,
png_ptr
->
row_info
.
rowbytes
);
/* Copy user's row into buffer, leaving room for filter byte. */
png_
buffered_memcpy
(
png_ptr
,
png_ptr
->
row_buf
+
1
,
row
,
png_
memcpy_check
(
png_ptr
,
png_ptr
->
row_buf
+
1
,
row
,
png_ptr
->
row_info
.
rowbytes
);
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
...
...
@@ -831,10 +831,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
if
(
png_ptr
->
filter_weights
==
NULL
)
{
png_ptr
->
filter_weights
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
filter_weights
=
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
(
png_uint_16
)
*
num_weights
));
png_ptr
->
inv_filter_weights
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
inv_filter_weights
=
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
(
png_uint_16
)
*
num_weights
));
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
...
...
@@ -866,7 +866,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
*/
if
(
png_ptr
->
filter_costs
==
NULL
)
{
png_ptr
->
filter_costs
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
filter_costs
=
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
(
png_uint_16
)
*
PNG_FILTER_VALUE_LAST
));
png_ptr
->
inv_filter_costs
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
...
...
pngwtran.c
浏览文件 @
a357b991
此差异已折叠。
点击以展开。
pngwutil.c
浏览文件 @
a357b991
此差异已折叠。
点击以展开。
synopsis.txt
已删除
100644 → 0
浏览文件 @
0f881d62
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录