Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
82ae3833
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
接近 2 年 前同步成功
通知
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看板
提交
82ae3833
编写于
4月 20, 2001
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Imported from libpng-1.0.11rc1.tar
上级
e1eff58f
变更
54
隐藏空白更改
内联
并排
Showing
54 changed file
with
396 addition
and
739 deletion
+396
-739
ANNOUNCE
ANNOUNCE
+4
-2
CHANGES
CHANGES
+6
-1
INSTALL
INSTALL
+7
-6
KNOWNBUG
KNOWNBUG
+4
-1
LICENSE
LICENSE
+2
-2
README
README
+6
-5
Y2KINFO
Y2KINFO
+2
-2
configure
configure
+1
-1
example.c
example.c
+2
-3
libpng.3
libpng.3
+13
-8
libpng.txt
libpng.txt
+7
-3
libpngpf.3
libpngpf.3
+2
-2
png.5
png.5
+1
-1
png.c
png.c
+34
-41
png.h
png.h
+12
-11
pngasmrd.h
pngasmrd.h
+1
-1
pngconf.h
pngconf.h
+1
-1
pngerror.c
pngerror.c
+5
-4
pnggccrd.c
pnggccrd.c
+1
-1
pngget.c
pngget.c
+2
-2
pngmem.c
pngmem.c
+13
-7
pngpread.c
pngpread.c
+58
-110
pngread.c
pngread.c
+4
-19
pngrio.c
pngrio.c
+1
-1
pngrtran.c
pngrtran.c
+10
-103
pngrutil.c
pngrutil.c
+45
-160
pngset.c
pngset.c
+17
-113
pngtest.c
pngtest.c
+2
-14
pngtrans.c
pngtrans.c
+1
-1
pngvcrd.c
pngvcrd.c
+1
-1
pngwio.c
pngwio.c
+1
-1
pngwrite.c
pngwrite.c
+8
-36
pngwtran.c
pngwtran.c
+1
-1
pngwutil.c
pngwutil.c
+8
-50
projects/msvc/README.txt
projects/msvc/README.txt
+1
-1
projects/msvc/png32ms.def
projects/msvc/png32ms.def
+1
-1
projects/wince/READMEE.WCE
projects/wince/READMEE.WCE
+4
-4
projects/wince/READMEJ.WCE
projects/wince/READMEJ.WCE
+1
-1
projects/wince/png32ce.def
projects/wince/png32ce.def
+1
-1
scripts/makefile.aix
scripts/makefile.aix
+1
-1
scripts/makefile.beos
scripts/makefile.beos
+1
-1
scripts/makefile.cygwin
scripts/makefile.cygwin
+2
-2
scripts/makefile.dec
scripts/makefile.dec
+1
-1
scripts/makefile.gcmmx
scripts/makefile.gcmmx
+1
-1
scripts/makefile.hpgcc
scripts/makefile.hpgcc
+1
-1
scripts/makefile.hpux
scripts/makefile.hpux
+1
-1
scripts/makefile.linux
scripts/makefile.linux
+1
-1
scripts/makefile.netbsd
scripts/makefile.netbsd
+89
-0
scripts/makefile.sco
scripts/makefile.sco
+1
-1
scripts/makefile.sggcc
scripts/makefile.sggcc
+2
-2
scripts/makefile.sgi
scripts/makefile.sgi
+1
-1
scripts/makefile.solaris
scripts/makefile.solaris
+1
-1
scripts/pngdef.pas
scripts/pngdef.pas
+1
-1
scripts/pngos2.def
scripts/pngos2.def
+1
-1
未找到文件。
ANNOUNCE
浏览文件 @
82ae3833
Libpng 1.0.11
beta3 - April 15
, 2001
Libpng 1.0.11
rc1 - April 20
, 2001
This is a public release of libpng, intended for use in production codes.
This is a public release of libpng, intended for use in production codes.
...
@@ -10,7 +10,9 @@ Changes since the last public release (1.0.10):
...
@@ -10,7 +10,9 @@ Changes since the last public release (1.0.10):
Changed several "//" single-line comments to C-style in pnggccrd.c
Changed several "//" single-line comments to C-style in pnggccrd.c
Removed PNGAPI from private functions whose prototypes did not have PNGAPI.
Removed PNGAPI from private functions whose prototypes did not have PNGAPI.
Updated scripts/pngos2.def
Updated scripts/pngos2.def
Added checking the results of many instances of png_malloc() for NULL
Added makefile.netbsd
Added a check for NULL return from user's malloc_fn().
Removed some useless type casts of the NULL pointer.
Send comments/corrections/commendations to
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
...
...
CHANGES
浏览文件 @
82ae3833
...
@@ -921,8 +921,13 @@ version 1.0.11beta1 [April 3, 2001]
...
@@ -921,8 +921,13 @@ version 1.0.11beta1 [April 3, 2001]
version 1.0.11beta2 [April 11, 2001]
version 1.0.11beta2 [April 11, 2001]
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
Updated scripts/pngos2.def
Updated scripts/pngos2.def
version 1.0.11beta3 [April 1
5
, 2001]
version 1.0.11beta3 [April 1
4
, 2001]
Added checking the results of many instances of png_malloc() for NULL
Added checking the results of many instances of png_malloc() for NULL
version 1.0.11rc1 [April 20, 2001]
Undid the changes from version 1.0.11beta3. Added a check for NULL return
from user's malloc_fn().
Removed some useless type casts of the NULL pointer.
Added makefile.netbsd .
Send comments/corrections/commendations to
Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
...
...
INSTALL
浏览文件 @
82ae3833
Installing libpng version 1.0.11
beta3 - April 15
, 2001
Installing libpng version 1.0.11
rc1 - April 20
, 2001
Before installing libpng, you must first install zlib. zlib
Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be
can usually be found wherever you got libpng. zlib can be
...
@@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
...
@@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed.
version of zlib that's installed.
You can rename the directories that you downloaded (they
You can rename the directories that you downloaded (they
might be called "libpng-1.0.11
beta3
" or "lpng109" and "zlib-1.1.3"
might be called "libpng-1.0.11
rc1
" or "lpng109" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng".
or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
Your directory structure should look like this:
...
@@ -60,8 +60,8 @@ The files that are presently available in the scripts directory
...
@@ -60,8 +60,8 @@ The files that are presently available in the scripts directory
include
include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11
beta3
)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11
rc1
)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11
beta3
,
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11
rc1
,
uses assembler code tuned for Intel MMX platform)
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
makefile.knr => Archaic UNIX Makefile that converts files with
...
@@ -76,10 +76,11 @@ include
...
@@ -76,10 +76,11 @@ include
makefile.intel => Intel C/C++ version 4.0 and later
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.macosx => MACOS X Makefile
makefile.macosx => MACOS X Makefile
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11
beta3
)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11
rc1
)
makefile.sunos => Sun makefile
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11
beta3
)
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11
rc1
)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile
makefile.acorn => Acorn makefile
...
...
KNOWNBUG
浏览文件 @
82ae3833
...
@@ -25,4 +25,7 @@ Known bugs in libpng-1.0.10
...
@@ -25,4 +25,7 @@ Known bugs in libpng-1.0.10
4. April 14, 2001: Many instances of png_malloc() are not followed by
4. April 14, 2001: Many instances of png_malloc() are not followed by
a check to make sure it didn't return NULL.
a check to make sure it didn't return NULL.
STATUS: tests were added in libpng-1.0.11beta3.
STATUS: This only seems to matter if the user is using a custom
malloc_fn() that returns NULL. In libpng-1.0.11rc1 the return from
malloc_fn() will be checked for NULL and png_error() issued if one
is found.
LICENSE
浏览文件 @
82ae3833
...
@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
...
@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
If you modify libpng you may insert additional notices immediately following
this sentence.
this sentence.
libpng versions 1.0.7, July 1, 2000, through 1.0.11
beta3, April 15
, 2001, are
libpng versions 1.0.7, July 1, 2000, through 1.0.11
rc1, April 20
, 2001, are
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
and are distributed according to the same disclaimer and license as libpng-1.0.6
and are distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
with the following individuals added to the list of Contributing Authors
...
@@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
...
@@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
Glenn Randers-Pehrson
randeg@alum.rpi.edu
randeg@alum.rpi.edu
April
15
, 2001
April
20
, 2001
README
浏览文件 @
82ae3833
README for libpng 1.0.11
beta3 - April 15
, 2001 (shared library 2.1)
README for libpng 1.0.11
rc1 - April 20
, 2001 (shared library 2.1)
See the note about version numbers near the top of png.h
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
See INSTALL for instructions on how to install libpng.
...
@@ -183,9 +183,9 @@ Files in this distribution:
...
@@ -183,9 +183,9 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile
makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.11
beta3
)
(gcc, creates libpng.so.2.1.0.11
rc1
)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.11
beta3
, uses assembler code
libpng.so.2.1.0.11
rc1
, uses assembler code
tuned for Intel MMX platform)
tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
makefile.knr => Archaic UNIX Makefile that converts files with
...
@@ -200,11 +200,12 @@ Files in this distribution:
...
@@ -200,11 +200,12 @@ Files in this distribution:
makefile.intel => Intel C/C++ version 4.0 and later
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.macosx => MACOS X Makefile
makefile.macosx => MACOS X Makefile
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11
beta3
)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11
rc1
)
makefile.sunos => Sun makefile
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.11
beta3
)
(gcc, creates libpng.so.2.1.0.11
rc1
)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile
makefile.acorn => Acorn makefile
...
...
Y2KINFO
浏览文件 @
82ae3833
Y2K compliance in libpng:
Y2K compliance in libpng:
=========================
=========================
April
15
, 2001
April
20
, 2001
Since the PNG Development group is an ad-hoc body, we can't make
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.11
beta3
are Y2K compliant. It is my belief that earlier
upward through 1.0.11
rc1
are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer
Libpng only has three year fields. One is a 2-byte unsigned integer
...
...
configure
浏览文件 @
82ae3833
echo "
echo "
There is no \"configure\" script for Libpng-1.0.11
beta3
. Instead, please
There is no \"configure\" script for Libpng-1.0.11
rc1
. Instead, please
copy the appropriate makefile for your system from the \"scripts\"
copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details.
directory. Read the INSTALL file for more details.
"
"
...
...
example.c
浏览文件 @
82ae3833
...
@@ -338,7 +338,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
...
@@ -338,7 +338,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
for
(
row
=
0
;
row
<
height
;
row
++
)
for
(
row
=
0
;
row
<
height
;
row
++
)
{
{
row_pointers
[
row
]
=
malloc
(
png_get_rowbytes
(
png_ptr
,
info_ptr
));
row_pointers
[
row
]
=
png_malloc
(
png_ptr
,
png_get_rowbytes
(
png_ptr
,
info_ptr
));
}
}
/* Now it's time to read the image. One of these methods is REQUIRED */
/* Now it's time to read the image. One of these methods is REQUIRED */
...
@@ -605,8 +606,6 @@ void write_png(char *file_name /* , ... other image information ... */)
...
@@ -605,8 +606,6 @@ void write_png(char *file_name /* , ... other image information ... */)
/* set the palette if there is one. REQUIRED for indexed-color images */
/* set the palette if there is one. REQUIRED for indexed-color images */
palette
=
(
png_colorp
)
png_malloc
(
png_ptr
,
PNG_MAX_PALETTE_LENGTH
palette
=
(
png_colorp
)
png_malloc
(
png_ptr
,
PNG_MAX_PALETTE_LENGTH
*
sizeof
(
png_color
));
*
sizeof
(
png_color
));
if
(
palette
==
NULL
)
png_error
(
png_ptr
,
"Example: malloc of palette failed"
);
/* ... set palette colors ... */
/* ... set palette colors ... */
png_set_PLTE
(
png_ptr
,
info_ptr
,
palette
,
PNG_MAX_PALETTE_LENGTH
);
png_set_PLTE
(
png_ptr
,
info_ptr
,
palette
,
PNG_MAX_PALETTE_LENGTH
);
/* You must not free palette here, because png_set_PLTE only makes a link to
/* You must not free palette here, because png_set_PLTE only makes a link to
...
...
libpng.3
浏览文件 @
82ae3833
.TH LIBPNG 3 "April
15
, 2001"
.TH LIBPNG 3 "April
20
, 2001"
.SH NAME
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11
beta3
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11
rc1
.SH SYNOPSIS
.SH SYNOPSIS
\fI\fB
\fI\fB
...
@@ -747,7 +747,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
...
@@ -747,7 +747,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.11
beta3 - April 15
, 2001
libpng version 1.0.11
rc1 - April 20
, 2001
Updated and distributed by Glenn Randers-Pehrson
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
...
@@ -3061,6 +3061,10 @@ Your replacement memory functions must have prototypes as follows:
...
@@ -3061,6 +3061,10 @@ Your replacement memory functions must have prototypes as follows:
png_uint_32 size);
png_uint_32 size);
void free_fn(png_structp png_ptr, png_voidp ptr);
void free_fn(png_structp png_ptr, png_voidp ptr);
Your malloc_fn() can return NULL in case of failure. The png_malloc()
function will call png_error() if it receives a NULL from the system
memory allocator or from your replacement malloc_fn().
Input/Output in libpng is done through png_read() and png_write(),
Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in
which currently just call fread() and fwrite(). The FILE * is stored in
png_struct and is initialized via png_init_io(). If you wish to change
png_struct and is initialized via png_init_io(). If you wish to change
...
@@ -3464,13 +3468,13 @@ application:
...
@@ -3464,13 +3468,13 @@ application:
.SH VIII. Y2K Compliance in libpng
.SH VIII. Y2K Compliance in libpng
April
15
, 2001
April
20
, 2001
Since the PNG Development group is an ad-hoc body, we can't make
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.11
beta3
are Y2K compliant. It is my belief that earlier
upward through 1.0.11
rc1
are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
Libpng only has three year fields. One is a 2-byte unsigned integer that
...
@@ -3580,6 +3584,7 @@ the first widely used release:
...
@@ -3580,6 +3584,7 @@ the first widely used release:
1.0.10rc1 1 10010 2.1.0.10rc1
1.0.10rc1 1 10010 2.1.0.10rc1
1.0.10 1 10010 2.1.0.10
1.0.10 1 10010 2.1.0.10
1.0.11beta1-3 1 10011 2.1.0.11beta1-3
1.0.11beta1-3 1 10011 2.1.0.11beta1-3
1.0.11rc1 1 10011 2.1.0.11rc1
Henceforth the source version will match the shared-library minor
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
and patch numbers; the shared-library major version number will be
...
@@ -3637,7 +3642,7 @@ possible without all of you.
...
@@ -3637,7 +3642,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.11
beta3 - April 15
, 2001:
Libpng version 1.0.11
rc1 - April 20
, 2001:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
...
@@ -3654,7 +3659,7 @@ included in the libpng distribution, the latter shall prevail.)
...
@@ -3654,7 +3659,7 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following
If you modify libpng you may insert additional notices immediately following
this sentence.
this sentence.
libpng versions 1.0.7, July 1, 2000, through 1.0.11
beta3, April 15
, 2001, are
libpng versions 1.0.7, July 1, 2000, through 1.0.11
rc1, April 20
, 2001, are
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.0.6
distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
with the following individuals added to the list of Contributing Authors
...
@@ -3746,7 +3751,7 @@ certification mark of the Open Source Initiative.
...
@@ -3746,7 +3751,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
Glenn Randers-Pehrson
randeg@alum.rpi.edu
randeg@alum.rpi.edu
April
15
, 2001
April
20
, 2001
.\" end of man page
.\" end of man page
libpng.txt
浏览文件 @
82ae3833
libpng.txt - A description on how to use and modify libpng
libpng.txt - A description on how to use and modify libpng
libpng version 1.0.11
beta3 - April 15
, 2001
libpng version 1.0.11
rc1 - April 20
, 2001
Updated and distributed by Glenn Randers-Pehrson
Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu>
<randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
...
@@ -2314,6 +2314,10 @@ Your replacement memory functions must have prototypes as follows:
...
@@ -2314,6 +2314,10 @@ Your replacement memory functions must have prototypes as follows:
png_uint_32 size);
png_uint_32 size);
void free_fn(png_structp png_ptr, png_voidp ptr);
void free_fn(png_structp png_ptr, png_voidp ptr);
Your malloc_fn() can return NULL in case of failure. The png_malloc()
function will call png_error() if it receives a NULL from the system
memory allocator or from your replacement malloc_fn().
Input/Output in libpng is done through png_read() and png_write(),
Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in
which currently just call fread() and fwrite(). The FILE * is stored in
png_struct and is initialized via png_init_io(). If you wish to change
png_struct and is initialized via png_init_io(). If you wish to change
...
@@ -2717,13 +2721,13 @@ application:
...
@@ -2717,13 +2721,13 @@ application:
VIII. Y2K Compliance in libpng
VIII. Y2K Compliance in libpng
April
15
, 2001
April
20
, 2001
Since the PNG Development group is an ad-hoc body, we can't make
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.11
beta3
are Y2K compliant. It is my belief that earlier
upward through 1.0.11
rc1
are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
Libpng only has three year fields. One is a 2-byte unsigned integer that
...
...
libpngpf.3
浏览文件 @
82ae3833
.TH LIBPNGPF 3 "April
15
, 2001"
.TH LIBPNGPF 3 "April
20
, 2001"
.SH NAME
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11
beta3
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11
rc1
(private functions)
(private functions)
.SH SYNOPSIS
.SH SYNOPSIS
\fB#include <png.h>\fP
\fB#include <png.h>\fP
...
...
png.5
浏览文件 @
82ae3833
.TH PNG 5 "April
15
, 2001"
.TH PNG 5 "April
20
, 2001"
.SH NAME
.SH NAME
png \- Portable Network Graphics (PNG) format
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
.SH DESCRIPTION
...
...
png.c
浏览文件 @
82ae3833
/* png.c - location for general purpose libpng functions
/* png.c - location for general purpose libpng functions
*
*
* libpng version 1.0.11
beta3 - April 15
, 2001
* libpng version 1.0.11
rc1 - April 20
, 2001
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
...
@@ -13,14 +13,14 @@
...
@@ -13,14 +13,14 @@
#include "png.h"
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
/* Generate a compiler error if there is an old png.h in the search path. */
typedef
version_1_0_11
beta3
Your_png_h_is_not_version_1_0_11beta3
;
typedef
version_1_0_11
rc1
Your_png_h_is_not_version_1_0_11rc1
;
/* Version information for C files. This had better match the version
/* Version information for C files. This had better match the version
* string defined in png.h. */
* string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
/* png_libpng_ver was changed to a function in version 1.0.5c */
const
char
png_libpng_ver
[
18
]
=
"1.0.11
beta3
"
;
const
char
png_libpng_ver
[
18
]
=
"1.0.11
rc1
"
;
/* png_sig was changed to a function in version 1.0.5c */
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
/* Place to hold the signature string for a PNG file. */
...
@@ -142,18 +142,15 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
...
@@ -142,18 +142,15 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
png_voidp
ptr
=
(
png_voidp
)
png_malloc
((
png_structp
)
png_ptr
,
num_bytes
);
png_voidp
ptr
=
(
png_voidp
)
png_malloc
((
png_structp
)
png_ptr
,
num_bytes
);
#ifndef PNG_NO_ZALLOC_ZERO
#ifndef PNG_NO_ZALLOC_ZERO
if
(
ptr
)
if
(
num_bytes
>
(
png_uint_32
)
0x8000L
)
{
{
if
(
num_bytes
>
(
png_uint_32
)
0x8000L
)
png_memset
(
ptr
,
0
,
(
png_size_t
)
0x8000L
);
{
png_memset
((
png_bytep
)
ptr
+
(
png_size_t
)
0x8000L
,
0
,
png_memset
(
ptr
,
0
,
(
png_size_t
)
0x8000L
);
(
png_size_t
)(
num_bytes
-
(
png_uint_32
)
0x8000L
));
png_memset
((
png_bytep
)
ptr
+
(
png_size_t
)
0x8000L
,
0
,
}
(
png_size_t
)(
num_bytes
-
(
png_uint_32
)
0x8000L
));
else
}
{
else
png_memset
(
ptr
,
0
,
(
png_size_t
)
num_bytes
);
{
png_memset
(
ptr
,
0
,
(
png_size_t
)
num_bytes
);
}
}
}
#endif
#endif
return
((
voidpf
)
ptr
);
return
((
voidpf
)
ptr
);
...
@@ -285,7 +282,8 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
...
@@ -285,7 +282,8 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
void
PNGAPI
void
PNGAPI
png_free_data
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
mask
,
int
num
)
png_free_data
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
mask
,
int
num
)
{
{
png_debug
(
1
,
"in png_free_data
\n
"
);
png_debug
(
1
,
"in png_free_data
\n
"
);
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
if
(
png_ptr
==
NULL
||
info_ptr
==
NULL
)
...
@@ -584,31 +582,27 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
...
@@ -584,31 +582,27 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
sizeof
(
char
)));
sizeof
(
char
)));
}
}
if
(
png_ptr
->
time_buffer
==
NULL
)
png_warning
(
png_ptr
,
"Malloc of buffer for tIME chunk failed"
);
else
{
#if defined(_WIN32_WCE)
#if defined(_WIN32_WCE)
{
{
wchar_t
time_buf
[
29
];
wchar_t
time_buf
[
29
];
wsprintf
(
time_buf
,
TEXT
(
"%d %S %d %02d:%02d:%02d +0000"
),
wsprintf
(
time_buf
,
TEXT
(
"%d %S %d %02d:%02d:%02d +0000"
),
ptime
->
day
%
32
,
short_months
[(
ptime
->
month
-
1
)
%
12
],
ptime
->
day
%
32
,
short_months
[(
ptime
->
month
-
1
)
%
12
],
ptime
->
year
,
ptime
->
hour
%
24
,
ptime
->
minute
%
60
,
ptime
->
year
,
ptime
->
hour
%
24
,
ptime
->
minute
%
60
,
ptime
->
second
%
61
);
ptime
->
second
%
61
);
WideCharToMultiByte
(
CP_ACP
,
0
,
time_buf
,
-
1
,
png_ptr
->
time_buffer
,
29
,
WideCharToMultiByte
(
CP_ACP
,
0
,
time_buf
,
-
1
,
png_ptr
->
time_buffer
,
29
,
NULL
,
NULL
);
NULL
,
NULL
);
}
}
#else
#else
#ifdef USE_FAR_KEYWORD
#ifdef USE_FAR_KEYWORD
{
{
char
near_time_buf
[
29
];
char
near_time_buf
[
29
];
sprintf
(
near_time_buf
,
"%d %s %d %02d:%02d:%02d +0000"
,
sprintf
(
near_time_buf
,
"%d %s %d %02d:%02d:%02d +0000"
,
ptime
->
day
%
32
,
short_months
[(
ptime
->
month
-
1
)
%
12
],
ptime
->
day
%
32
,
short_months
[(
ptime
->
month
-
1
)
%
12
],
ptime
->
year
,
ptime
->
hour
%
24
,
ptime
->
minute
%
60
,
ptime
->
year
,
ptime
->
hour
%
24
,
ptime
->
minute
%
60
,
ptime
->
second
%
61
);
ptime
->
second
%
61
);
png_memcpy
(
png_ptr
->
time_buffer
,
near_time_buf
,
png_memcpy
(
png_ptr
->
time_buffer
,
near_time_buf
,
29
*
sizeof
(
char
));
29
*
sizeof
(
char
));
}
}
#else
#else
sprintf
(
png_ptr
->
time_buffer
,
"%d %s %d %02d:%02d:%02d +0000"
,
sprintf
(
png_ptr
->
time_buffer
,
"%d %s %d %02d:%02d:%02d +0000"
,
ptime
->
day
%
32
,
short_months
[(
ptime
->
month
-
1
)
%
12
],
ptime
->
day
%
32
,
short_months
[(
ptime
->
month
-
1
)
%
12
],
...
@@ -616,7 +610,6 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
...
@@ -616,7 +610,6 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
ptime
->
second
%
61
);
ptime
->
second
%
61
);
#endif
#endif
#endif
/* _WIN32_WCE */
#endif
/* _WIN32_WCE */
}
return
((
png_charp
)
png_ptr
->
time_buffer
);
return
((
png_charp
)
png_ptr
->
time_buffer
);
}
}
#endif
/* PNG_TIME_RFC1123_SUPPORTED */
#endif
/* PNG_TIME_RFC1123_SUPPORTED */
...
@@ -634,7 +627,7 @@ png_charp PNGAPI
...
@@ -634,7 +627,7 @@ png_charp PNGAPI
png_get_copyright
(
png_structp
png_ptr
)
png_get_copyright
(
png_structp
png_ptr
)
{
{
if
(
png_ptr
!=
NULL
||
png_ptr
==
NULL
)
/* silence compiler warning */
if
(
png_ptr
!=
NULL
||
png_ptr
==
NULL
)
/* silence compiler warning */
return
((
png_charp
)
"
\n
libpng version 1.0.11
beta3 - April 15
, 2001
\n
\
return
((
png_charp
)
"
\n
libpng version 1.0.11
rc1 - April 20
, 2001
\n
\
Copyright (c) 1998-2001 Glenn Randers-Pehrson
\n
\
Copyright (c) 1998-2001 Glenn Randers-Pehrson
\n
\
Copyright (c) 1996, 1997 Andreas Dilger
\n
\
Copyright (c) 1996, 1997 Andreas Dilger
\n
\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
\n
"
);
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
\n
"
);
...
@@ -652,8 +645,8 @@ png_get_libpng_ver(png_structp png_ptr)
...
@@ -652,8 +645,8 @@ png_get_libpng_ver(png_structp png_ptr)
{
{
/* Version of *.c files used when building libpng */
/* Version of *.c files used when building libpng */
if
(
png_ptr
!=
NULL
)
/* silence compiler warning about unused png_ptr */
if
(
png_ptr
!=
NULL
)
/* silence compiler warning about unused png_ptr */
return
((
png_charp
)
"1.0.11
beta3
"
);
return
((
png_charp
)
"1.0.11
rc1
"
);
return
((
png_charp
)
"1.0.11
beta3
"
);
return
((
png_charp
)
"1.0.11
rc1
"
);
}
}
png_charp
PNGAPI
png_charp
PNGAPI
...
...
png.h
浏览文件 @
82ae3833
/* png.h - header file for PNG reference library
/* png.h - header file for PNG reference library
*
*
* libpng version 1.0.11
beta3 - April 15
, 2001
* libpng version 1.0.11
rc1 - April 20
, 2001
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Authors and maintainers:
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.11
beta3 - April 15
, 2001: Glenn
* libpng versions 0.97, January 1998, through 1.0.11
rc1 - April 20
, 2001: Glenn
* See also "Contributing Authors", below.
* See also "Contributing Authors", below.
*
*
* Note about libpng version numbers:
* Note about libpng version numbers:
...
@@ -68,6 +68,7 @@
...
@@ -68,6 +68,7 @@
* 1.0.10rc1 1 10010 2.1.0.10rc1
* 1.0.10rc1 1 10010 2.1.0.10rc1
* 1.0.10 1 10010 2.1.0.10
* 1.0.10 1 10010 2.1.0.10
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
* 1.0.11rc1 1 10011 2.1.0.11rc1
*
*
* Henceforth the source version will match the shared-library major
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
* and minor numbers; the shared-library major version number will be
...
@@ -97,7 +98,7 @@
...
@@ -97,7 +98,7 @@
* If you modify libpng you may insert additional notices immediately following
* If you modify libpng you may insert additional notices immediately following
* this sentence.
* this sentence.
*
*
* libpng versions 1.0.7, July 1, 2000, through 1.0.11
beta3, April 15
, 2001, are
* libpng versions 1.0.7, July 1, 2000, through 1.0.11
rc1, April 20
, 2001, are
* Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
* Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.0.6
* distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors
* with the following individuals added to the list of Contributing Authors
...
@@ -202,13 +203,13 @@
...
@@ -202,13 +203,13 @@
* Y2K compliance in libpng:
* Y2K compliance in libpng:
* =========================
* =========================
*
*
* April
15
, 2001
* April
20
, 2001
*
*
* Since the PNG Development group is an ad-hoc body, we can't make
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
* an official declaration.
*
*
* This is your unofficial assurance that libpng from version 0.71 and
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.11
beta3
are Y2K compliant. It is my belief that earlier
* upward through 1.0.11
rc1
are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
* versions were also Y2K compliant.
*
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
* Libpng only has three year fields. One is a 2-byte unsigned integer
...
@@ -264,7 +265,7 @@
...
@@ -264,7 +265,7 @@
*/
*/
/* Version information for png.h - this should match the version in png.c */
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.11
beta3
"
#define PNG_LIBPNG_VER_STRING "1.0.11
rc1
"
#define PNG_LIBPNG_VER_SONUM 2
#define PNG_LIBPNG_VER_SONUM 2
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
...
@@ -276,7 +277,7 @@
...
@@ -276,7 +277,7 @@
/* This should match the numeric part of the final component of
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
#define PNG_LIBPNG_VER_BUILD
3
#define PNG_LIBPNG_VER_BUILD
1
#define PNG_LIBPNG_BUILD_ALPHA 1
#define PNG_LIBPNG_BUILD_ALPHA 1
#define PNG_LIBPNG_BUILD_BETA 2
#define PNG_LIBPNG_BUILD_BETA 2
...
@@ -284,7 +285,7 @@
...
@@ -284,7 +285,7 @@
#define PNG_LIBPNG_BUILD_STABLE 4
#define PNG_LIBPNG_BUILD_STABLE 4
#define PNG_LIBPNG_BUILD_TYPEMASK 7
#define PNG_LIBPNG_BUILD_TYPEMASK 7
#define PNG_LIBPNG_BUILD_PATCH 8
/* Can be OR'ed with STABLE only */
#define PNG_LIBPNG_BUILD_PATCH 8
/* Can be OR'ed with STABLE only */
#define PNG_LIBPNG_BUILD_TYPE
2
#define PNG_LIBPNG_BUILD_TYPE
3
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
* We must not include leading zeros.
...
@@ -1185,9 +1186,9 @@ struct png_struct_def
...
@@ -1185,9 +1186,9 @@ struct png_struct_def
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.11
beta3
and png.h are both at * version 1.0.11
rc1
*/
*/
typedef
png_structp
version_1_0_11
beta3
;
typedef
png_structp
version_1_0_11
rc1
;
typedef
png_struct
FAR
*
FAR
*
png_structpp
;
typedef
png_struct
FAR
*
FAR
*
png_structpp
;
...
@@ -2235,7 +2236,7 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
...
@@ -2235,7 +2236,7 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
#define PNG_HEADER_VERSION_STRING \
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.11
beta3 - April 15
, 2001 (header)\n"
" libpng version 1.0.11
rc1 - April 20
, 2001 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on
/* With these routines we avoid an integer divide, which will be slower on
...
...
pngasmrd.h
浏览文件 @
82ae3833
/* pngasmrd.h - assembler version of utilities to read a PNG file
/* pngasmrd.h - assembler version of utilities to read a PNG file
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 2001 Glenn Randers-Pehrson
* Copyright (c) 2001 Glenn Randers-Pehrson
*
*
...
...
pngconf.h
浏览文件 @
82ae3833
/* pngconf.h - machine configurable file for libpng
/* pngconf.h - machine configurable file for libpng
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
...
pngerror.c
浏览文件 @
82ae3833
/* pngerror.c - stub functions for i/o and memory allocation
/* pngerror.c - stub functions for i/o and memory allocation
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -61,11 +61,12 @@ png_warning(png_structp png_ptr, png_const_charp message)
...
@@ -61,11 +61,12 @@ png_warning(png_structp png_ptr, png_const_charp message)
*/
*/
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
static
PNG_CONST
char
png_digit
[
16
]
=
{
static
PNG_CONST
char
png_digit
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
};
'F'
};
static
void
/* PRIVATE */
static
void
/* PRIVATE */
png_format_buffer
(
png_structp
png_ptr
,
png_charp
buffer
,
png_const_charp
message
)
png_format_buffer
(
png_structp
png_ptr
,
png_charp
buffer
,
png_const_charp
message
)
{
{
int
iout
=
0
,
iin
=
0
;
int
iout
=
0
,
iin
=
0
;
...
...
pnggccrd.c
浏览文件 @
82ae3833
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code.
* for Intel's performance analysis of the MMX vs. non-MMX code.
*
*
* libpng version 1.0.11
beta3 - April 15
, 2001
* libpng version 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, Intel Corporation
...
...
pngget.c
浏览文件 @
82ae3833
/* pngget.c - retrieval of values from info struct
/* pngget.c - retrieval of values from info struct
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -137,7 +137,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
...
@@ -137,7 +137,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED)
#if defined(PNG_pHYs_SUPPORTED)
if
(
info_ptr
->
valid
&
PNG_INFO_pHYs
)
if
(
info_ptr
->
valid
&
PNG_INFO_pHYs
)
{
{
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_y_pixels_per_meter"
);
png_debug1
(
1
,
"in %s retrieval function
\n
"
,
"png_get_y_pixels_per_meter"
);
if
(
info_ptr
->
phys_unit_type
!=
PNG_RESOLUTION_METER
)
if
(
info_ptr
->
phys_unit_type
!=
PNG_RESOLUTION_METER
)
return
(
0
);
return
(
0
);
else
return
(
info_ptr
->
y_pixels_per_unit
);
else
return
(
info_ptr
->
y_pixels_per_unit
);
...
...
pngmem.c
浏览文件 @
82ae3833
/* pngmem.c - stub functions for memory allocation
/* pngmem.c - stub functions for memory allocation
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -119,7 +119,12 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
...
@@ -119,7 +119,12 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
#ifdef PNG_USER_MEM_SUPPORTED
#ifdef PNG_USER_MEM_SUPPORTED
if
(
png_ptr
->
malloc_fn
!=
NULL
)
if
(
png_ptr
->
malloc_fn
!=
NULL
)
return
((
png_voidp
)(
*
(
png_ptr
->
malloc_fn
))(
png_ptr
,
size
));
{
ret
=
((
png_voidp
)(
*
(
png_ptr
->
malloc_fn
))(
png_ptr
,
size
));
if
(
ret
==
NULL
)
png_error
(
png_ptr
,
"Out of memory!"
);
return
(
ret
);
}
else
else
return
png_malloc_default
(
png_ptr
,
size
);
return
png_malloc_default
(
png_ptr
,
size
);
}
}
...
@@ -373,15 +378,18 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
...
@@ -373,15 +378,18 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
png_voidp
PNGAPI
png_voidp
PNGAPI
png_malloc
(
png_structp
png_ptr
,
png_uint_32
size
)
png_malloc
(
png_structp
png_ptr
,
png_uint_32
size
)
{
{
#ifndef PNG_USER_MEM_SUPPORTED
png_voidp
ret
;
png_voidp
ret
;
#endif
if
(
png_ptr
==
NULL
||
size
==
0
)
if
(
png_ptr
==
NULL
||
size
==
0
)
return
((
png_voidp
)
NULL
);
return
((
png_voidp
)
NULL
);
#ifdef PNG_USER_MEM_SUPPORTED
#ifdef PNG_USER_MEM_SUPPORTED
if
(
png_ptr
->
malloc_fn
!=
NULL
)
if
(
png_ptr
->
malloc_fn
!=
NULL
)
return
((
png_voidp
)(
*
(
png_ptr
->
malloc_fn
))(
png_ptr
,
size
));
{
ret
=
((
png_voidp
)(
*
(
png_ptr
->
malloc_fn
))(
png_ptr
,
size
));
if
(
ret
==
NULL
)
png_error
(
png_ptr
,
"Out of Memory!"
);
return
(
ret
);
}
else
else
return
(
png_malloc_default
(
png_ptr
,
size
));
return
(
png_malloc_default
(
png_ptr
,
size
));
}
}
...
@@ -407,9 +415,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
...
@@ -407,9 +415,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
#endif
#endif
if
(
ret
==
NULL
)
if
(
ret
==
NULL
)
{
png_error
(
png_ptr
,
"Out of Memory"
);
png_error
(
png_ptr
,
"Out of Memory"
);
}
return
(
ret
);
return
(
ret
);
}
}
...
...
pngpread.c
浏览文件 @
82ae3833
/* pngpread.c - read a png file in push mode
/* pngpread.c - read a png file in push mode
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -585,18 +585,9 @@ png_push_save_buffer(png_structp png_ptr)
...
@@ -585,18 +585,9 @@ png_push_save_buffer(png_structp png_ptr)
old_buffer
=
png_ptr
->
save_buffer
;
old_buffer
=
png_ptr
->
save_buffer
;
png_ptr
->
save_buffer
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
save_buffer
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
new_max
);
(
png_uint_32
)
new_max
);
if
(
png_ptr
->
save_buffer
==
(
png_bytep
)
NULL
)
png_memcpy
(
png_ptr
->
save_buffer
,
old_buffer
,
png_ptr
->
save_buffer_size
);
{
png_free
(
png_ptr
,
old_buffer
);
png_warning
(
png_ptr
,
"Malloc of save buffer failed"
);
png_ptr
->
save_buffer_max
=
new_max
;
png_ptr
->
save_buffer
=
old_buffer
;
png_ptr
->
current_buffer_size
=
0
;
}
else
{
png_memcpy
(
png_ptr
->
save_buffer
,
old_buffer
,
png_ptr
->
save_buffer_size
);
png_free
(
png_ptr
,
old_buffer
);
png_ptr
->
save_buffer_max
=
new_max
;
}
}
}
if
(
png_ptr
->
current_buffer_size
)
if
(
png_ptr
->
current_buffer_size
)
{
{
...
@@ -1004,7 +995,8 @@ png_read_push_finish_row(png_structp png_ptr)
...
@@ -1004,7 +995,8 @@ png_read_push_finish_row(png_structp png_ptr)
#if defined(PNG_READ_tEXt_SUPPORTED)
#if defined(PNG_READ_tEXt_SUPPORTED)
void
/* PRIVATE */
void
/* PRIVATE */
png_push_handle_tEXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
png_push_handle_tEXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
{
{
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
(
png_ptr
->
mode
&
PNG_HAVE_IEND
))
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
(
png_ptr
->
mode
&
PNG_HAVE_IEND
))
{
{
...
@@ -1016,7 +1008,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
...
@@ -1016,7 +1008,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
#ifdef PNG_MAX_MALLOC_64K
#ifdef PNG_MAX_MALLOC_64K
png_ptr
->
skip_length
=
0
;
/* This may not be necessary */
png_ptr
->
skip_length
=
0
;
/* This may not be necessary */
if
(
length
>
(
png_uint_32
)
65535L
)
/* Can't hold
the
entire string in memory */
if
(
length
>
(
png_uint_32
)
65535L
)
/* Can't hold entire string in memory */
{
{
png_warning
(
png_ptr
,
"tEXt chunk too large to fit in memory"
);
png_warning
(
png_ptr
,
"tEXt chunk too large to fit in memory"
);
png_ptr
->
skip_length
=
length
-
(
png_uint_32
)
65535L
;
png_ptr
->
skip_length
=
length
-
(
png_uint_32
)
65535L
;
...
@@ -1026,12 +1018,6 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
...
@@ -1026,12 +1018,6 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
png_ptr
->
current_text
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_ptr
->
current_text
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
length
+
1
));
(
png_uint_32
)(
length
+
1
));
if
(
png_ptr
->
current_text
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"malloc of current text failed"
);
png_ptr
->
skip_length
=
length
;
return
;
}
png_ptr
->
current_text
[
length
]
=
'\0'
;
png_ptr
->
current_text
[
length
]
=
'\0'
;
png_ptr
->
current_text_ptr
=
png_ptr
->
current_text
;
png_ptr
->
current_text_ptr
=
png_ptr
->
current_text
;
png_ptr
->
current_text_size
=
(
png_size_t
)
length
;
png_ptr
->
current_text_size
=
(
png_size_t
)
length
;
...
@@ -1083,11 +1069,6 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1083,11 +1069,6 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
text
++
;
text
++
;
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
if
(
text_ptr
==
(
png_textp
)
NULL
)
{
png_warning
(
png_ptr
,
"malloc of text buffer failed"
);
return
;
}
text_ptr
->
compression
=
PNG_TEXT_COMPRESSION_NONE
;
text_ptr
->
compression
=
PNG_TEXT_COMPRESSION_NONE
;
text_ptr
->
key
=
key
;
text_ptr
->
key
=
key
;
#ifdef PNG_iTXt_SUPPORTED
#ifdef PNG_iTXt_SUPPORTED
...
@@ -1106,7 +1087,8 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1106,7 +1087,8 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_READ_zTXt_SUPPORTED)
#if defined(PNG_READ_zTXt_SUPPORTED)
void
/* PRIVATE */
void
/* PRIVATE */
png_push_handle_zTXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
png_push_handle_zTXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
{
{
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
(
png_ptr
->
mode
&
PNG_HAVE_IEND
))
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
(
png_ptr
->
mode
&
PNG_HAVE_IEND
))
{
{
...
@@ -1130,12 +1112,6 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
...
@@ -1130,12 +1112,6 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
png_ptr
->
current_text
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_ptr
->
current_text
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
length
+
1
));
(
png_uint_32
)(
length
+
1
));
if
(
png_ptr
->
current_text
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"malloc of zTXt buffer failed"
);
png_push_crc_skip
(
png_ptr
,
length
);
return
;
}
png_ptr
->
current_text
[
length
]
=
'\0'
;
png_ptr
->
current_text
[
length
]
=
'\0'
;
png_ptr
->
current_text_ptr
=
png_ptr
->
current_text
;
png_ptr
->
current_text_ptr
=
png_ptr
->
current_text
;
png_ptr
->
current_text_size
=
(
png_size_t
)
length
;
png_ptr
->
current_text_size
=
(
png_size_t
)
length
;
...
@@ -1224,19 +1200,14 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1224,19 +1200,14 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
if
(
text
==
NULL
)
if
(
text
==
NULL
)
{
{
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
+
(
png_uint_32
)(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
key_size
+
1
));
+
key_size
+
1
));
if
(
text
==
(
png_charp
)
NULL
)
png_memcpy
(
text
+
key_size
,
png_ptr
->
zbuf
,
png_warning
(
png_ptr
,
"Malloc of text block failed"
);
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
);
else
png_memcpy
(
text
,
key
,
key_size
);
{
text_size
=
key_size
+
png_ptr
->
zbuf_size
-
png_memcpy
(
text
+
key_size
,
png_ptr
->
zbuf
,
png_ptr
->
zstream
.
avail_out
;
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
);
*
(
text
+
text_size
)
=
'\0'
;
png_memcpy
(
text
,
key
,
key_size
);
text_size
=
key_size
+
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
*
(
text
+
text_size
)
=
'\0'
;
}
}
}
else
else
{
{
...
@@ -1246,17 +1217,12 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1246,17 +1217,12 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
+
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
+
(
png_uint_32
)(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
(
png_uint_32
)(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
+
1
));
+
1
));
if
(
text
!=
(
png_charp
)
NULL
)
png_memcpy
(
text
,
tmp
,
text_size
);
png_warning
(
png_ptr
,
"Malloc of new text block failed"
);
png_free
(
png_ptr
,
tmp
);
else
png_memcpy
(
text
+
text_size
,
png_ptr
->
zbuf
,
{
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
);
png_memcpy
(
text
,
tmp
,
text_size
);
text_size
+=
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
png_free
(
png_ptr
,
tmp
);
*
(
text
+
text_size
)
=
'\0'
;
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'
;
}
}
}
if
(
ret
!=
Z_STREAM_END
)
if
(
ret
!=
Z_STREAM_END
)
{
{
...
@@ -1288,30 +1254,26 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1288,30 +1254,26 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
text
+=
key_size
;
text
+=
key_size
;
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
if
(
text_ptr
==
(
png_textp
)
NULL
)
text_ptr
->
compression
=
PNG_TEXT_COMPRESSION_zTXt
;
png_warning
(
png_ptr
,
"Malloc of iTXt failed"
);
text_ptr
->
key
=
key
;
else
{
text_ptr
->
compression
=
PNG_TEXT_COMPRESSION_zTXt
;
text_ptr
->
key
=
key
;
#ifdef PNG_iTXt_SUPPORTED
#ifdef PNG_iTXt_SUPPORTED
text_ptr
->
lang
=
(
char
*
)
NULL
;
text_ptr
->
lang
=
(
char
*
)
NULL
;
text_ptr
->
lang_key
=
(
char
*
)
NULL
;
text_ptr
->
lang_key
=
(
char
*
)
NULL
;
#endif
#endif
text_ptr
->
text
=
text
;
text_ptr
->
text
=
text
;
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_free
(
png_ptr
,
text_ptr
);
}
png_free
(
png_ptr
,
key
);
png_free
(
png_ptr
,
key
);
png_free
(
png_ptr
,
text_ptr
);
}
}
}
}
#endif
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
#if defined(PNG_READ_iTXt_SUPPORTED)
void
/* PRIVATE */
void
/* PRIVATE */
png_push_handle_iTXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
png_push_handle_iTXt
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
{
{
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
(
png_ptr
->
mode
&
PNG_HAVE_IEND
))
if
(
!
(
png_ptr
->
mode
&
PNG_HAVE_IHDR
)
||
(
png_ptr
->
mode
&
PNG_HAVE_IEND
))
{
{
...
@@ -1323,7 +1285,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
...
@@ -1323,7 +1285,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
#ifdef PNG_MAX_MALLOC_64K
#ifdef PNG_MAX_MALLOC_64K
png_ptr
->
skip_length
=
0
;
/* This may not be necessary */
png_ptr
->
skip_length
=
0
;
/* This may not be necessary */
if
(
length
>
(
png_uint_32
)
65535L
)
/* Can't hold
the
entire string in memory */
if
(
length
>
(
png_uint_32
)
65535L
)
/* Can't hold entire string in memory */
{
{
png_warning
(
png_ptr
,
"iTXt chunk too large to fit in memory"
);
png_warning
(
png_ptr
,
"iTXt chunk too large to fit in memory"
);
png_ptr
->
skip_length
=
length
-
(
png_uint_32
)
65535L
;
png_ptr
->
skip_length
=
length
-
(
png_uint_32
)
65535L
;
...
@@ -1333,16 +1295,11 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
...
@@ -1333,16 +1295,11 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
png_ptr
->
current_text
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_ptr
->
current_text
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
length
+
1
));
(
png_uint_32
)(
length
+
1
));
if
(
png_ptr
->
current_text
==
(
png_charp
)
NULL
)
png_ptr
->
current_text
[
length
]
=
'\0'
;
png_warning
(
png_ptr
,
"malloc of iTXt buffer failed"
);
png_ptr
->
current_text_ptr
=
png_ptr
->
current_text
;
else
png_ptr
->
current_text_size
=
(
png_size_t
)
length
;
{
png_ptr
->
current_text_left
=
(
png_size_t
)
length
;
png_ptr
->
current_text
[
length
]
=
'\0'
;
png_ptr
->
process_mode
=
PNG_READ_iTXt_MODE
;
png_ptr
->
current_text_ptr
=
png_ptr
->
current_text
;
png_ptr
->
current_text_size
=
(
png_size_t
)
length
;
png_ptr
->
current_text_left
=
(
png_size_t
)
length
;
png_ptr
->
process_mode
=
PNG_READ_iTXt_MODE
;
}
}
}
void
/* PRIVATE */
void
/* PRIVATE */
...
@@ -1406,10 +1363,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1406,10 +1363,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
text
++
;
text
++
;
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
if
(
text_ptr
==
(
png_textp
)
NULL
)
png_warning
(
png_ptr
,
"Malloc of iTXt pointer failed"
);
else
{
text_ptr
->
compression
=
comp_flag
+
2
;
text_ptr
->
compression
=
comp_flag
+
2
;
text_ptr
->
key
=
key
;
text_ptr
->
key
=
key
;
text_ptr
->
lang
=
lang
;
text_ptr
->
lang
=
lang
;
...
@@ -1421,7 +1374,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1421,7 +1374,6 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_free
(
png_ptr
,
text_ptr
);
png_free
(
png_ptr
,
text_ptr
);
}
}
}
}
}
#endif
#endif
...
@@ -1431,7 +1383,8 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
...
@@ -1431,7 +1383,8 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
* name or a critical chunk), the chunk is (currently) silently ignored.
* name or a critical chunk), the chunk is (currently) silently ignored.
*/
*/
void
/* PRIVATE */
void
/* PRIVATE */
png_push_handle_unknown
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
png_push_handle_unknown
(
png_structp
png_ptr
,
png_infop
info_ptr
,
png_uint_32
length
)
{
{
png_uint_32
skip
=
0
;
png_uint_32
skip
=
0
;
png_check_chunk_name
(
png_ptr
,
png_ptr
->
chunk_name
);
png_check_chunk_name
(
png_ptr
,
png_ptr
->
chunk_name
);
...
@@ -1442,7 +1395,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
...
@@ -1442,7 +1395,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
if
(
png_handle_as_unknown
(
png_ptr
,
png_ptr
->
chunk_name
)
!=
if
(
png_handle_as_unknown
(
png_ptr
,
png_ptr
->
chunk_name
)
!=
HANDLE_CHUNK_ALWAYS
HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
&&
png_ptr
->
read_user_chunk_fn
==
(
png_user_chunk_ptr
)
NULL
&&
png_ptr
->
read_user_chunk_fn
==
NULL
#endif
#endif
)
)
#endif
#endif
...
@@ -1469,30 +1422,25 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
...
@@ -1469,30 +1422,25 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
png_strcpy
((
png_charp
)
chunk
.
name
,
(
png_charp
)
png_ptr
->
chunk_name
);
png_strcpy
((
png_charp
)
chunk
.
name
,
(
png_charp
)
png_ptr
->
chunk_name
);
chunk
.
data
=
(
png_bytep
)
png_malloc
(
png_ptr
,
length
);
chunk
.
data
=
(
png_bytep
)
png_malloc
(
png_ptr
,
length
);
if
(
chunk
.
data
==
(
png_bytep
)
NULL
)
png_crc_read
(
png_ptr
,
chunk
.
data
,
length
);
png_warning
(
png_ptr
,
"Malloc of unknown chunk data failed"
);
chunk
.
size
=
length
;
else
{
png_crc_read
(
png_ptr
,
chunk
.
data
,
length
);
chunk
.
size
=
length
;
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if
(
png_ptr
->
read_user_chunk_fn
!=
(
png_user_chunk_ptr
)
NULL
)
if
(
png_ptr
->
read_user_chunk_fn
!=
NULL
)
{
{
/* callback to user unknown chunk handler */
/* callback to user unknown chunk handler */
if
((
*
(
png_ptr
->
read_user_chunk_fn
))
(
png_ptr
,
&
chunk
)
<=
0
)
if
((
*
(
png_ptr
->
read_user_chunk_fn
))
(
png_ptr
,
&
chunk
)
<=
0
)
{
{
if
(
!
(
png_ptr
->
chunk_name
[
0
]
&
0x20
))
if
(
!
(
png_ptr
->
chunk_name
[
0
]
&
0x20
))
if
(
png_handle_as_unknown
(
png_ptr
,
png_ptr
->
chunk_name
)
!=
if
(
png_handle_as_unknown
(
png_ptr
,
png_ptr
->
chunk_name
)
!=
HANDLE_CHUNK_ALWAYS
)
HANDLE_CHUNK_ALWAYS
)
png_chunk_error
(
png_ptr
,
"unknown critical chunk"
);
png_chunk_error
(
png_ptr
,
"unknown critical chunk"
);
}
}
png_set_unknown_chunks
(
png_ptr
,
info_ptr
,
&
chunk
,
1
);
png_set_unknown_chunks
(
png_ptr
,
info_ptr
,
&
chunk
,
1
);
}
else
#endif
png_set_unknown_chunks
(
png_ptr
,
info_ptr
,
&
chunk
,
1
);
png_free
(
png_ptr
,
chunk
.
data
);
}
}
else
#endif
png_set_unknown_chunks
(
png_ptr
,
info_ptr
,
&
chunk
,
1
);
png_free
(
png_ptr
,
chunk
.
data
);
}
}
else
else
#endif
#endif
...
...
pngread.c
浏览文件 @
82ae3833
/* pngread.c - read a PNG file
/* pngread.c - read a PNG file
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -115,8 +115,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
...
@@ -115,8 +115,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
(
png_uint_32
)
png_ptr
->
zbuf_size
);
if
(
png_ptr
->
zbuf
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate zbuf"
);
png_ptr
->
zstream
.
zalloc
=
png_zalloc
;
png_ptr
->
zstream
.
zalloc
=
png_zalloc
;
png_ptr
->
zstream
.
zfree
=
png_zfree
;
png_ptr
->
zstream
.
zfree
=
png_zfree
;
png_ptr
->
zstream
.
opaque
=
(
voidpf
)
png_ptr
;
png_ptr
->
zstream
.
opaque
=
(
voidpf
)
png_ptr
;
...
@@ -199,8 +197,6 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
...
@@ -199,8 +197,6 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
(
png_uint_32
)
png_ptr
->
zbuf_size
);
if
(
png_ptr
->
zbuf
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate zbuf"
);
png_ptr
->
zstream
.
zalloc
=
png_zalloc
;
png_ptr
->
zstream
.
zalloc
=
png_zalloc
;
png_ptr
->
zstream
.
zfree
=
png_zfree
;
png_ptr
->
zstream
.
zfree
=
png_zfree
;
png_ptr
->
zstream
.
opaque
=
(
voidpf
)
png_ptr
;
png_ptr
->
zstream
.
opaque
=
(
voidpf
)
png_ptr
;
...
@@ -719,7 +715,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
...
@@ -719,7 +715,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
* not called png_set_interlace_handling(), the display_row buffer will
* not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it.
* be ignored, so pass NULL to it.
*
*
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11
beta3
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11
rc1
*/
*/
void
PNGAPI
void
PNGAPI
...
@@ -768,7 +764,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
...
@@ -768,7 +764,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* only call this function once. If you desire to have an image for
* only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead.
* each pass of a interlaced image, use png_read_rows() instead.
*
*
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11
beta3
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11
rc1
*/
*/
void
PNGAPI
void
PNGAPI
png_read_image
(
png_structp
png_ptr
,
png_bytepp
image
)
png_read_image
(
png_structp
png_ptr
,
png_bytepp
image
)
...
@@ -1322,8 +1318,6 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
...
@@ -1322,8 +1318,6 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
{
{
info_ptr
->
row_pointers
=
(
png_bytepp
)
png_malloc
(
png_ptr
,
info_ptr
->
row_pointers
=
(
png_bytepp
)
png_malloc
(
png_ptr
,
info_ptr
->
height
*
sizeof
(
png_bytep
));
info_ptr
->
height
*
sizeof
(
png_bytep
));
if
(
info_ptr
->
row_pointers
)
png_error
(
png_ptr
,
"png_read_png could not allocate row pointers"
);
#ifdef PNG_FREE_ME_SUPPORTED
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr
->
free_me
|=
PNG_FREE_ROWS
;
info_ptr
->
free_me
|=
PNG_FREE_ROWS
;
#endif
#endif
...
@@ -1331,15 +1325,6 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
...
@@ -1331,15 +1325,6 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
{
{
info_ptr
->
row_pointers
[
row
]
=
(
png_bytep
)
png_malloc
(
png_ptr
,
info_ptr
->
row_pointers
[
row
]
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_get_rowbytes
(
png_ptr
,
info_ptr
));
png_get_rowbytes
(
png_ptr
,
info_ptr
));
if
(
info_ptr
->
row_pointers
)
{
int
allocated_row
;
for
(
allocated_row
=
0
;
allocated_row
<
row
;
allocated_row
++
)
png_free
(
png_ptr
,
info_ptr
->
row_pointers
[
allocated_row
]);
if
(
info_ptr
->
free_me
&
!
(
PNG_FREE_ROWS
))
png_free
(
png_ptr
,
info_ptr
->
row_pointers
);
png_error
(
png_ptr
,
"png_read_png could not allocate row pointer"
);
}
}
}
}
}
...
@@ -1349,7 +1334,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
...
@@ -1349,7 +1334,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end
(
png_ptr
,
info_ptr
);
png_read_end
(
png_ptr
,
info_ptr
);
if
(
transforms
==
0
||
params
==
(
voidp
)
NULL
)
if
(
transforms
==
0
||
params
==
NULL
)
/* quiet compiler warnings */
return
;
/* quiet compiler warnings */
return
;
}
}
...
...
pngrio.c
浏览文件 @
82ae3833
/* pngrio.c - functions for data input
/* pngrio.c - functions for data input
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
...
pngrtran.c
浏览文件 @
82ae3833
/* pngrtran.c - transforms the data in a row for PNG readers
/* pngrtran.c - transforms the data in a row for PNG readers
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -155,11 +155,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -155,11 +155,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
png_ptr
->
dither_index
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
dither_index
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
if
(
png_ptr
->
dither_index
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of dither index failed"
);
return
;
}
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
png_ptr
->
dither_index
[
i
]
=
(
png_byte
)
i
;
png_ptr
->
dither_index
[
i
]
=
(
png_byte
)
i
;
}
}
...
@@ -177,12 +172,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -177,12 +172,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
/* initialize an array to sort colors */
/* initialize an array to sort colors */
sort
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_palette
sort
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
*
sizeof
(
png_byte
)));
if
(
sort
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of sort array for dither failed"
);
png_free
(
png_ptr
,
png_ptr
->
dither_index
);
return
;
}
/* initialize the sort array */
/* initialize the sort array */
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
...
@@ -313,14 +302,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -313,14 +302,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
palette_to_index
=
(
png_bytep
)
png_malloc
(
png_ptr
,
palette_to_index
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
(
png_uint_32
)(
num_palette
*
sizeof
(
png_byte
)));
if
(
index_to_palette
==
(
png_bytep
)
NULL
||
palette_to_index
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of index array for dither failed"
);
png_free
(
png_ptr
,
index_to_palette
);
png_free
(
png_ptr
,
png_ptr
->
dither_index
);
return
;
}
/* initialize the sort array */
/* initialize the sort array */
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
...
@@ -331,14 +312,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -331,14 +312,6 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
hash
=
(
png_dsortpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
769
*
hash
=
(
png_dsortpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
769
*
sizeof
(
png_dsortp
)));
sizeof
(
png_dsortp
)));
if
(
hash
==
(
png_dsortpp
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of hash array for dither failed"
);
png_free
(
png_ptr
,
palette_to_index
);
png_free
(
png_ptr
,
index_to_palette
);
png_free
(
png_ptr
,
png_ptr
->
dither_index
);
return
;
}
for
(
i
=
0
;
i
<
769
;
i
++
)
for
(
i
=
0
;
i
<
769
;
i
++
)
hash
[
i
]
=
NULL
;
hash
[
i
]
=
NULL
;
/* png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
/* png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
...
@@ -373,13 +346,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -373,13 +346,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
t
=
(
png_dsortp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
t
=
(
png_dsortp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
(
png_dsort
)));
(
png_dsort
)));
if
(
t
!=
(
png_dsortp
)
NULL
)
{
t
->
next
=
hash
[
d
];
t
->
next
=
hash
[
d
];
t
->
left
=
(
png_byte
)
i
;
t
->
left
=
(
png_byte
)
i
;
t
->
right
=
(
png_byte
)
j
;
t
->
right
=
(
png_byte
)
j
;
hash
[
d
]
=
t
;
hash
[
d
]
=
t
;
}
}
}
}
}
}
}
...
@@ -486,25 +456,16 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -486,25 +456,16 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
png_ptr
->
palette_lookup
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
palette_lookup
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_entries
*
sizeof
(
png_byte
)));
(
png_uint_32
)(
num_entries
*
sizeof
(
png_byte
)));
if
(
png_ptr
->
palette_lookup
==
(
png_bytep
)
NULL
)
{
png_memset
(
png_ptr
->
palette_lookup
,
0
,
num_entries
*
sizeof
(
png_byte
));
png_warning
(
png_ptr
,
"Malloc of palette_lookup for dither failed"
);
}
else
png_memset
(
png_ptr
->
palette_lookup
,
0
,
num_entries
*
sizeof
(
png_byte
));
distance
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_entries
*
distance
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num_entries
*
sizeof
(
png_byte
)));
sizeof
(
png_byte
)));
if
(
distance
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of distance array for dither failed"
);
}
else
{
png_memset
(
distance
,
0xff
,
num_entries
*
sizeof
(
png_byte
));
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
png_memset
(
distance
,
0xff
,
num_entries
*
sizeof
(
png_byte
));
{
for
(
i
=
0
;
i
<
num_palette
;
i
++
)
{
int
ir
,
ig
,
ib
;
int
ir
,
ig
,
ib
;
int
r
=
(
palette
[
i
].
red
>>
(
8
-
PNG_DITHER_RED_BITS
));
int
r
=
(
palette
[
i
].
red
>>
(
8
-
PNG_DITHER_RED_BITS
));
int
g
=
(
palette
[
i
].
green
>>
(
8
-
PNG_DITHER_GREEN_BITS
));
int
g
=
(
palette
[
i
].
green
>>
(
8
-
PNG_DITHER_GREEN_BITS
));
...
@@ -535,12 +496,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
...
@@ -535,12 +496,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
png_ptr
->
palette_lookup
[
d_index
]
=
(
png_byte
)
i
;
png_ptr
->
palette_lookup
[
d_index
]
=
(
png_byte
)
i
;
}
}
}
}
}
}
}
}
}
}
png_free
(
png_ptr
,
distance
);
png_free
(
png_ptr
,
distance
);
}
}
}
}
}
#endif
#endif
...
@@ -3898,11 +3858,6 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -3898,11 +3858,6 @@ png_build_gamma_table(png_structp png_ptr)
png_ptr
->
gamma_table
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_table
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
256
);
(
png_uint_32
)
256
);
if
(
png_ptr
->
gamma_table
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma table failed"
);
return
;
}
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
i
=
0
;
i
<
256
;
i
++
)
{
{
...
@@ -3919,11 +3874,6 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -3919,11 +3874,6 @@ png_build_gamma_table(png_structp png_ptr)
png_ptr
->
gamma_to_1
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_to_1
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
256
);
(
png_uint_32
)
256
);
if
(
png_ptr
->
gamma_to_1
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_to_1 table failed"
);
return
;
}
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
i
=
0
;
i
<
256
;
i
++
)
{
{
...
@@ -3934,11 +3884,6 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -3934,11 +3884,6 @@ png_build_gamma_table(png_structp png_ptr)
png_ptr
->
gamma_from_1
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_from_1
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
256
);
(
png_uint_32
)
256
);
if
(
png_ptr
->
gamma_from_1
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_from_1 table failed"
);
return
;
}
if
(
png_ptr
->
screen_gamma
>
0
.
000001
)
if
(
png_ptr
->
screen_gamma
>
0
.
000001
)
g
=
1
.
0
/
png_ptr
->
screen_gamma
;
g
=
1
.
0
/
png_ptr
->
screen_gamma
;
...
@@ -4001,11 +3946,6 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -4001,11 +3946,6 @@ png_build_gamma_table(png_structp png_ptr)
png_ptr
->
gamma_16_table
=
(
png_uint_16pp
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_table
=
(
png_uint_16pp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num
*
sizeof
(
png_uint_16p
)));
(
png_uint_32
)(
num
*
sizeof
(
png_uint_16p
)));
if
(
png_ptr
->
gamma_16_table
==
(
png_uint_16pp
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16 table failed"
);
return
;
}
if
(
png_ptr
->
transformations
&
(
PNG_16_TO_8
|
PNG_BACKGROUND
))
if
(
png_ptr
->
transformations
&
(
PNG_16_TO_8
|
PNG_BACKGROUND
))
{
{
...
@@ -4016,11 +3956,6 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -4016,11 +3956,6 @@ png_build_gamma_table(png_structp png_ptr)
{
{
png_ptr
->
gamma_16_table
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_table
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
if
(
png_ptr
->
gamma_16_table
[
i
]
==
(
png_uint_16p
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16 table entry failed"
);
return
;
}
}
}
g
=
1
.
0
/
g
;
g
=
1
.
0
/
g
;
...
@@ -4051,11 +3986,6 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -4051,11 +3986,6 @@ png_build_gamma_table(png_structp png_ptr)
{
{
png_ptr
->
gamma_16_table
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_table
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
if
(
png_ptr
->
gamma_16_table
[
i
]
==
(
png_uint_16p
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16 table entry failed"
);
return
;
}
ig
=
(((
png_uint_32
)
i
*
(
png_uint_32
)
png_gamma_shift
[
shift
])
>>
4
);
ig
=
(((
png_uint_32
)
i
*
(
png_uint_32
)
png_gamma_shift
[
shift
])
>>
4
);
for
(
j
=
0
;
j
<
256
;
j
++
)
for
(
j
=
0
;
j
<
256
;
j
++
)
...
@@ -4076,22 +4006,11 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -4076,22 +4006,11 @@ png_build_gamma_table(png_structp png_ptr)
png_ptr
->
gamma_16_to_1
=
(
png_uint_16pp
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_to_1
=
(
png_uint_16pp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num
*
sizeof
(
png_uint_16p
)));
(
png_uint_32
)(
num
*
sizeof
(
png_uint_16p
)));
if
(
png_ptr
->
gamma_16_to_1
==
(
png_uint_16pp
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16_to_1 table failed"
);
return
;
}
for
(
i
=
0
;
i
<
num
;
i
++
)
for
(
i
=
0
;
i
<
num
;
i
++
)
{
{
png_ptr
->
gamma_16_to_1
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_to_1
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
if
(
png_ptr
->
gamma_16_to_1
[
i
]
==
(
png_uint_16p
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16_to_1 table entry failed"
);
return
;
}
ig
=
(((
png_uint_32
)
i
*
ig
=
(((
png_uint_32
)
i
*
(
png_uint_32
)
png_gamma_shift
[
shift
])
>>
4
);
(
png_uint_32
)
png_gamma_shift
[
shift
])
>>
4
);
...
@@ -4110,23 +4029,11 @@ png_build_gamma_table(png_structp png_ptr)
...
@@ -4110,23 +4029,11 @@ png_build_gamma_table(png_structp png_ptr)
png_ptr
->
gamma_16_from_1
=
(
png_uint_16pp
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_from_1
=
(
png_uint_16pp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
num
*
sizeof
(
png_uint_16p
)));
(
png_uint_32
)(
num
*
sizeof
(
png_uint_16p
)));
if
(
png_ptr
->
gamma_16_from_1
==
(
png_uint_16pp
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16_from_1 table failed"
);
return
;
}
for
(
i
=
0
;
i
<
num
;
i
++
)
for
(
i
=
0
;
i
<
num
;
i
++
)
{
{
png_ptr
->
gamma_16_from_1
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
gamma_16_from_1
[
i
]
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
(
png_uint_32
)(
256
*
sizeof
(
png_uint_16
)));
if
(
png_ptr
->
gamma_16_from_1
[
i
]
==
(
png_uint_16p
)
NULL
)
{
png_warning
(
png_ptr
,
"Malloc of gamma_16_from_1 table failed"
);
return
;
}
ig
=
(((
png_uint_32
)
i
*
ig
=
(((
png_uint_32
)
i
*
(
png_uint_32
)
png_gamma_shift
[
shift
])
>>
4
);
(
png_uint_32
)
png_gamma_shift
[
shift
])
>>
4
);
...
...
pngrutil.c
浏览文件 @
82ae3833
/* pngrutil.c - utilities to read a PNG file
/* pngrutil.c - utilities to read a PNG file
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -201,19 +201,15 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
...
@@ -201,19 +201,15 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
{
{
text_size
=
prefix_size
+
sizeof
(
msg
)
+
1
;
text_size
=
prefix_size
+
sizeof
(
msg
)
+
1
;
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
);
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
);
if
(
text
!=
NULL
)
png_memcpy
(
text
,
chunkdata
,
prefix_size
);
png_memcpy
(
text
,
chunkdata
,
prefix_size
);
}
}
if
(
text
!=
NULL
)
text
[
text_size
-
1
]
=
0x00
;
{
text
[
text_size
-
1
]
=
0x00
;
/* Copy what we can of the error message into the text chunk */
/* Copy what we can of the error message into the text chunk */
text_size
=
(
png_size_t
)(
chunklength
-
(
text
-
chunkdata
)
-
1
);
text_size
=
(
png_size_t
)(
chunklength
-
(
text
-
chunkdata
)
-
1
);
text_size
=
sizeof
(
msg
)
>
text_size
?
text_size
:
sizeof
(
msg
);
text_size
=
sizeof
(
msg
)
>
text_size
?
text_size
:
sizeof
(
msg
);
png_memcpy
(
text
+
prefix_size
,
msg
,
text_size
+
1
);
png_memcpy
(
text
+
prefix_size
,
msg
,
text_size
+
1
);
}
break
;
break
;
}
}
if
(
!
png_ptr
->
zstream
.
avail_out
||
ret
==
Z_STREAM_END
)
if
(
!
png_ptr
->
zstream
.
avail_out
||
ret
==
Z_STREAM_END
)
...
@@ -223,13 +219,10 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
...
@@ -223,13 +219,10 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
text_size
=
prefix_size
+
text_size
=
prefix_size
+
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
+
1
);
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
+
1
);
if
(
text
!=
NULL
)
png_memcpy
(
text
+
prefix_size
,
png_ptr
->
zbuf
,
{
text_size
-
prefix_size
);
png_memcpy
(
text
+
prefix_size
,
png_ptr
->
zbuf
,
png_memcpy
(
text
,
chunkdata
,
prefix_size
);
text_size
-
prefix_size
);
*
(
text
+
text_size
)
=
0x00
;
png_memcpy
(
text
,
chunkdata
,
prefix_size
);
*
(
text
+
text_size
)
=
0x00
;
}
}
}
else
else
{
{
...
@@ -238,20 +231,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
...
@@ -238,20 +231,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
tmp
=
text
;
tmp
=
text
;
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
text_size
+
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
text_size
+
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
+
1
));
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
+
1
));
if
(
text
!=
NULL
)
{
png_memcpy
(
text
,
tmp
,
text_size
);
png_memcpy
(
text
,
tmp
,
text_size
);
png_free
(
png_ptr
,
tmp
);
png_free
(
png_ptr
,
tmp
);
png_memcpy
(
text
+
text_size
,
png_ptr
->
zbuf
,
png_memcpy
(
text
+
text_size
,
png_ptr
->
zbuf
,
(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
));
(
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
));
text_size
+=
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
text_size
+=
png_ptr
->
zbuf_size
-
png_ptr
->
zstream
.
avail_out
;
*
(
text
+
text_size
)
=
0x00
;
*
(
text
+
text_size
)
=
0x00
;
}
else
{
png_warning
(
png_ptr
,
"Could not malloc text buffer"
);
text
=
tmp
;
}
}
}
if
(
ret
==
Z_STREAM_END
)
if
(
ret
==
Z_STREAM_END
)
break
;
break
;
...
@@ -285,13 +270,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
...
@@ -285,13 +270,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
if
(
text
==
NULL
)
if
(
text
==
NULL
)
{
{
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
+
1
);
text
=
(
png_charp
)
png_malloc
(
png_ptr
,
text_size
+
1
);
if
(
text
!=
NULL
)
png_memcpy
(
text
,
chunkdata
,
prefix_size
);
png_memcpy
(
text
,
chunkdata
,
prefix_size
);
else
png_warning
(
png_ptr
,
"Could not malloc text chunkdata"
);
}
}
if
(
text
!=
NULL
)
*
(
text
+
text_size
)
=
0x00
;
*
(
text
+
text_size
)
=
0x00
;
}
}
inflateReset
(
&
png_ptr
->
zstream
);
inflateReset
(
&
png_ptr
->
zstream
);
...
@@ -1002,14 +983,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1002,14 +983,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
chunkdata
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
chunkdata
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
slength
=
(
png_size_t
)
length
;
slength
=
(
png_size_t
)
length
;
if
(
chunkdata
!=
(
png_charp
)
NULL
)
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
else
{
png_warning
(
png_ptr
,
"Could not allocate memory for iCCP chunk"
);
png_crc_finish
(
png_ptr
,
slength
);
return
;
}
if
(
png_crc_finish
(
png_ptr
,
skip
))
if
(
png_crc_finish
(
png_ptr
,
skip
))
{
{
...
@@ -1105,16 +1079,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1105,16 +1079,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#endif
chunkdata
=
(
png_bytep
)
png_malloc
(
png_ptr
,
length
+
1
);
chunkdata
=
(
png_bytep
)
png_malloc
(
png_ptr
,
length
+
1
);
if
(
chunkdata
!=
(
png_bytep
)
NULL
)
slength
=
(
png_size_t
)
length
;
{
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
}
else
{
png_warning
(
png_ptr
,
"Could not allocate memory for sPLT chunk"
);
skip
=
(
png_size_t
)
length
;
}
if
(
png_crc_finish
(
png_ptr
,
skip
))
if
(
png_crc_finish
(
png_ptr
,
skip
))
{
{
...
@@ -1151,12 +1117,6 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1151,12 +1117,6 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
new_palette
.
nentries
=
data_length
/
entry_size
;
new_palette
.
nentries
=
data_length
/
entry_size
;
new_palette
.
entries
=
(
png_sPLT_entryp
)
png_malloc
(
new_palette
.
entries
=
(
png_sPLT_entryp
)
png_malloc
(
png_ptr
,
new_palette
.
nentries
*
sizeof
(
png_sPLT_entry
));
png_ptr
,
new_palette
.
nentries
*
sizeof
(
png_sPLT_entry
));
if
(
new_palette
.
entries
==
(
png_sPLT_entryp
)
NULL
)
{
png_free
(
png_ptr
,
chunkdata
);
png_warning
(
png_ptr
,
"Could not allocate sPLT entries"
);
return
;
}
#ifndef PNG_NO_POINTER_INDEXING
#ifndef PNG_NO_POINTER_INDEXING
for
(
i
=
0
;
i
<
new_palette
.
nentries
;
i
++
)
for
(
i
=
0
;
i
<
new_palette
.
nentries
;
i
++
)
...
@@ -1566,12 +1526,6 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1566,12 +1526,6 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug1
(
2
,
"Allocating and reading pCAL chunk data (%lu bytes)
\n
"
,
png_debug1
(
2
,
"Allocating and reading pCAL chunk data (%lu bytes)
\n
"
,
length
+
1
);
length
+
1
);
purpose
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
purpose
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
if
(
purpose
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for pCAL purpose"
);
png_crc_finish
(
png_ptr
,
length
);
return
;
}
slength
=
(
png_size_t
)
length
;
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
purpose
,
slength
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
purpose
,
slength
);
...
@@ -1628,11 +1582,6 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1628,11 +1582,6 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug
(
3
,
"Allocating pCAL parameters array
\n
"
);
png_debug
(
3
,
"Allocating pCAL parameters array
\n
"
);
params
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
nparams
params
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
nparams
*
sizeof
(
png_charp
)))
;
*
sizeof
(
png_charp
)))
;
if
(
params
==
(
png_charpp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate pCAL parameters array"
);
nparams
=
0
;
}
/* Get pointers to the start of each parameter string. */
/* Get pointers to the start of each parameter string. */
for
(
i
=
0
;
i
<
(
int
)
nparams
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
nparams
;
i
++
)
...
@@ -1697,12 +1646,6 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1697,12 +1646,6 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug1
(
2
,
"Allocating and reading sCAL chunk data (%lu bytes)
\n
"
,
png_debug1
(
2
,
"Allocating and reading sCAL chunk data (%lu bytes)
\n
"
,
length
+
1
);
length
+
1
);
buffer
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
buffer
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
if
(
buffer
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for sCAL buffer"
);
png_crc_finish
(
png_ptr
,
length
);
return
;
}
slength
=
(
png_size_t
)
length
;
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
buffer
,
slength
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
buffer
,
slength
);
...
@@ -1726,8 +1669,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1726,8 +1669,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#else
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
swidth
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_strlen
(
ep
)
+
1
);
swidth
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_strlen
(
ep
)
+
1
);
if
(
swidth
!=
(
png_charp
)
NULL
)
png_memcpy
(
swidth
,
ep
,
(
png_size_t
)
png_strlen
(
ep
));
png_memcpy
(
swidth
,
ep
,
(
png_size_t
)
png_strlen
(
ep
));
#endif
#endif
#endif
#endif
...
@@ -1745,8 +1687,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1745,8 +1687,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#else
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
sheight
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_strlen
(
ep
)
+
1
);
sheight
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_strlen
(
ep
)
+
1
);
if
(
sheight
!=
(
png_charp
)
NULL
)
png_memcpy
(
sheight
,
ep
,
(
png_size_t
)
png_strlen
(
ep
));
png_memcpy
(
sheight
,
ep
,
(
png_size_t
)
png_strlen
(
ep
));
#endif
#endif
#endif
#endif
...
@@ -1855,14 +1796,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1855,14 +1796,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
key
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
key
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
slength
=
(
png_size_t
)
length
;
slength
=
(
png_size_t
)
length
;
if
(
key
==
(
png_charp
)
NULL
)
png_crc_read
(
png_ptr
,
(
png_bytep
)
key
,
slength
);
{
png_warning
(
png_ptr
,
"Could not allocate memory for tEXt chunk"
);
png_crc_finish
(
png_ptr
,
slength
);
return
;
}
else
png_crc_read
(
png_ptr
,
(
png_bytep
)
key
,
slength
);
if
(
png_crc_finish
(
png_ptr
,
skip
))
if
(
png_crc_finish
(
png_ptr
,
skip
))
{
{
...
@@ -1879,8 +1813,6 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1879,8 +1813,6 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text
++
;
text
++
;
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
if
(
text_ptr
!=
(
png_textp
)
NULL
)
{
text_ptr
->
compression
=
PNG_TEXT_COMPRESSION_NONE
;
text_ptr
->
compression
=
PNG_TEXT_COMPRESSION_NONE
;
text_ptr
->
key
=
key
;
text_ptr
->
key
=
key
;
#ifdef PNG_iTXt_SUPPORTED
#ifdef PNG_iTXt_SUPPORTED
...
@@ -1893,11 +1825,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1893,11 +1825,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_free
(
png_ptr
,
text_ptr
);
}
else
png_warning
(
png_ptr
,
"Could not allocate iTXt pointer"
);
png_free
(
png_ptr
,
key
);
png_free
(
png_ptr
,
key
);
png_free
(
png_ptr
,
text_ptr
);
}
}
#endif
#endif
...
@@ -1931,17 +1860,8 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1931,17 +1860,8 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#endif
chunkdata
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
chunkdata
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
if
(
chunkdata
!=
(
png_charp
)
NULL
)
{
slength
=
(
png_size_t
)
length
;
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
}
else
{
png_warning
(
png_ptr
,
"Could not allocate memory for zTXt chunk data"
);
png_crc_finish
(
png_ptr
,
length
);
return
;
}
if
(
png_crc_finish
(
png_ptr
,
0
))
if
(
png_crc_finish
(
png_ptr
,
0
))
{
{
png_free
(
png_ptr
,
chunkdata
);
png_free
(
png_ptr
,
chunkdata
);
...
@@ -1975,24 +1895,19 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -1975,24 +1895,19 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
(
png_size_t
)
length
,
prefix_len
,
&
data_len
);
(
png_size_t
)
length
,
prefix_len
,
&
data_len
);
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
if
(
text_ptr
!=
(
png_textp
)
NULL
)
text_ptr
->
compression
=
comp_type
;
{
text_ptr
->
key
=
chunkdata
;
text_ptr
->
compression
=
comp_type
;
text_ptr
->
key
=
chunkdata
;
#ifdef PNG_iTXt_SUPPORTED
#ifdef PNG_iTXt_SUPPORTED
text_ptr
->
lang
=
NULL
;
text_ptr
->
lang
=
NULL
;
text_ptr
->
lang_key
=
NULL
;
text_ptr
->
lang_key
=
NULL
;
text_ptr
->
itxt_length
=
0
;
text_ptr
->
itxt_length
=
0
;
#endif
#endif
text_ptr
->
text
=
chunkdata
+
prefix_len
;
text_ptr
->
text
=
chunkdata
+
prefix_len
;
text_ptr
->
text_length
=
data_len
;
text_ptr
->
text_length
=
data_len
;
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_free
(
png_ptr
,
text_ptr
);
png_free
(
png_ptr
,
text_ptr
);
}
else
png_warning
(
png_ptr
,
"Could not allocate memory for zTXt data"
);
png_free
(
png_ptr
,
chunkdata
);
png_free
(
png_ptr
,
chunkdata
);
}
}
#endif
#endif
...
@@ -2029,17 +1944,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -2029,17 +1944,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#endif
chunkdata
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
chunkdata
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
+
1
);
if
(
chunkdata
!=
(
png_charp
)
NULL
)
slength
=
(
png_size_t
)
length
;
{
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
slength
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunkdata
,
slength
);
}
else
{
png_warning
(
png_ptr
,
"Could not allocate memory for iTXt chunk data"
);
png_crc_finish
(
png_ptr
,
length
);
return
;
}
if
(
png_crc_finish
(
png_ptr
,
0
))
if
(
png_crc_finish
(
png_ptr
,
0
))
{
{
png_free
(
png_ptr
,
chunkdata
);
png_free
(
png_ptr
,
chunkdata
);
...
@@ -2084,22 +1990,17 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -2084,22 +1990,17 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
else
else
data_len
=
png_strlen
(
chunkdata
+
prefix_len
);
data_len
=
png_strlen
(
chunkdata
+
prefix_len
);
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
text_ptr
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
sizeof
(
png_text
));
if
(
text_ptr
!=
(
png_textp
)
NULL
)
text_ptr
->
compression
=
(
int
)
comp_flag
+
1
;
{
text_ptr
->
lang_key
=
chunkdata
+
(
lang_key
-
key
);
text_ptr
->
compression
=
(
int
)
comp_flag
+
1
;
text_ptr
->
lang
=
chunkdata
+
(
lang
-
key
);
text_ptr
->
lang_key
=
chunkdata
+
(
lang_key
-
key
);
text_ptr
->
itxt_length
=
data_len
;
text_ptr
->
lang
=
chunkdata
+
(
lang
-
key
);
text_ptr
->
text_length
=
0
;
text_ptr
->
itxt_length
=
data_len
;
text_ptr
->
key
=
chunkdata
;
text_ptr
->
text_length
=
0
;
text_ptr
->
text
=
chunkdata
+
prefix_len
;
text_ptr
->
key
=
chunkdata
;
text_ptr
->
text
=
chunkdata
+
prefix_len
;
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_set_text
(
png_ptr
,
info_ptr
,
text_ptr
,
1
);
png_free
(
png_ptr
,
text_ptr
);
png_free
(
png_ptr
,
text_ptr
);
}
else
png_warning
(
png_ptr
,
"Could not allocate memory for iTXt chunk data"
);
png_free
(
png_ptr
,
chunkdata
);
png_free
(
png_ptr
,
chunkdata
);
}
}
#endif
#endif
...
@@ -2133,7 +2034,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -2133,7 +2034,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if
(
png_handle_as_unknown
(
png_ptr
,
png_ptr
->
chunk_name
)
!=
if
(
png_handle_as_unknown
(
png_ptr
,
png_ptr
->
chunk_name
)
!=
HANDLE_CHUNK_ALWAYS
HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
&&
png_ptr
->
read_user_chunk_fn
==
(
png_user_chunk_ptr
)
NULL
&&
png_ptr
->
read_user_chunk_fn
==
NULL
#endif
#endif
)
)
#endif
#endif
...
@@ -2155,19 +2056,10 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
...
@@ -2155,19 +2056,10 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
#endif
png_strcpy
((
png_charp
)
chunk
.
name
,
(
png_charp
)
png_ptr
->
chunk_name
);
png_strcpy
((
png_charp
)
chunk
.
name
,
(
png_charp
)
png_ptr
->
chunk_name
);
chunk
.
data
=
(
png_bytep
)
png_malloc
(
png_ptr
,
length
);
chunk
.
data
=
(
png_bytep
)
png_malloc
(
png_ptr
,
length
);
if
(
chunk
.
data
!=
(
png_bytep
)
NULL
)
chunk
.
size
=
(
png_size_t
)
length
;
{
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunk
.
data
,
length
);
chunk
.
size
=
(
png_size_t
)
length
;
png_crc_read
(
png_ptr
,
(
png_bytep
)
chunk
.
data
,
length
);
}
else
{
png_warning
(
png_ptr
,
"Could not allocate memory for iTXt chunk data"
);
png_crc_finish
(
png_ptr
,
length
);
return
;
}
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if
(
png_ptr
->
read_user_chunk_fn
!=
(
png_user_chunk_ptr
)
NULL
)
if
(
png_ptr
->
read_user_chunk_fn
!=
NULL
)
{
{
/* callback to user unknown chunk handler */
/* callback to user unknown chunk handler */
if
((
*
(
png_ptr
->
read_user_chunk_fn
))
(
png_ptr
,
&
chunk
)
<=
0
)
if
((
*
(
png_ptr
->
read_user_chunk_fn
))
(
png_ptr
,
&
chunk
)
<=
0
)
...
@@ -3072,8 +2964,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
...
@@ -3072,8 +2964,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_error
(
png_ptr
,
"This image requires a row greater than 64KB"
);
png_error
(
png_ptr
,
"This image requires a row greater than 64KB"
);
#endif
#endif
png_ptr
->
row_buf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
row_bytes
);
png_ptr
->
row_buf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
row_bytes
);
if
(
png_ptr
->
row_buf
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate memory for row buffer"
);
png_ptr
->
row_buf_size
=
row_bytes
;
png_ptr
->
row_buf_size
=
row_bytes
;
#ifdef PNG_MAX_MALLOC_64K
#ifdef PNG_MAX_MALLOC_64K
...
@@ -3082,11 +2972,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
...
@@ -3082,11 +2972,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#endif
#endif
png_ptr
->
prev_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
png_ptr
->
prev_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
png_ptr
->
rowbytes
+
1
));
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
prev_row
==
(
png_bytep
)
NULL
)
{
png_free
(
png_ptr
,
png_ptr
->
row_buf
);
png_error
(
png_ptr
,
"Could not allocate memory for previous row buffer"
);
}
png_memset_check
(
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
);
...
...
pngset.c
浏览文件 @
82ae3833
/* pngset.c - storage of image information into info struct
/* pngset.c - storage of image information into info struct
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -154,11 +154,6 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
...
@@ -154,11 +154,6 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
#endif
#endif
png_ptr
->
hist
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
hist
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
info_ptr
->
num_palette
*
sizeof
(
png_uint_16
)));
(
png_uint_32
)(
info_ptr
->
num_palette
*
sizeof
(
png_uint_16
)));
if
(
png_ptr
->
hist
==
(
png_uint_16p
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for histogram"
);
return
;
}
for
(
i
=
0
;
i
<
info_ptr
->
num_palette
;
i
++
)
for
(
i
=
0
;
i
<
info_ptr
->
num_palette
;
i
++
)
png_ptr
->
hist
[
i
]
=
hist
[
i
];
png_ptr
->
hist
[
i
]
=
hist
[
i
];
...
@@ -300,11 +295,6 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
...
@@ -300,11 +295,6 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
length
=
png_strlen
(
purpose
)
+
1
;
length
=
png_strlen
(
purpose
)
+
1
;
png_debug1
(
3
,
"allocating purpose for info (%lu bytes)
\n
"
,
length
);
png_debug1
(
3
,
"allocating purpose for info (%lu bytes)
\n
"
,
length
);
info_ptr
->
pcal_purpose
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
info_ptr
->
pcal_purpose
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
if
(
info_ptr
->
pcal_purpose
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for pCAL"
);
return
;
}
png_memcpy
(
info_ptr
->
pcal_purpose
,
purpose
,
(
png_size_t
)
length
);
png_memcpy
(
info_ptr
->
pcal_purpose
,
purpose
,
(
png_size_t
)
length
);
png_debug
(
3
,
"storing X0, X1, type, and nparams in info
\n
"
);
png_debug
(
3
,
"storing X0, X1, type, and nparams in info
\n
"
);
...
@@ -316,23 +306,10 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
...
@@ -316,23 +306,10 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
length
=
png_strlen
(
units
)
+
1
;
length
=
png_strlen
(
units
)
+
1
;
png_debug1
(
3
,
"allocating units for info (%lu bytes)
\n
"
,
length
);
png_debug1
(
3
,
"allocating units for info (%lu bytes)
\n
"
,
length
);
info_ptr
->
pcal_units
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
info_ptr
->
pcal_units
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
if
(
info_ptr
->
pcal_units
==
(
png_charp
)
NULL
)
{
png_free
(
png_ptr
,
info_ptr
->
pcal_purpose
);
png_warning
(
png_ptr
,
"Could not allocate memory for pCAL units"
);
return
;
}
png_memcpy
(
info_ptr
->
pcal_units
,
units
,
(
png_size_t
)
length
);
png_memcpy
(
info_ptr
->
pcal_units
,
units
,
(
png_size_t
)
length
);
info_ptr
->
pcal_params
=
(
png_charpp
)
png_malloc
(
png_ptr
,
info_ptr
->
pcal_params
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)((
nparams
+
1
)
*
sizeof
(
png_charp
)));
(
png_uint_32
)((
nparams
+
1
)
*
sizeof
(
png_charp
)));
if
(
info_ptr
->
pcal_params
==
(
png_charpp
)
NULL
)
{
png_free
(
png_ptr
,
info_ptr
->
pcal_purpose
);
png_free
(
png_ptr
,
info_ptr
->
pcal_units
);
png_warning
(
png_ptr
,
"Could not allocate memory for pCAL params"
);
return
;
}
info_ptr
->
pcal_params
[
nparams
]
=
NULL
;
info_ptr
->
pcal_params
[
nparams
]
=
NULL
;
...
@@ -341,13 +318,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
...
@@ -341,13 +318,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
length
=
png_strlen
(
params
[
i
])
+
1
;
length
=
png_strlen
(
params
[
i
])
+
1
;
png_debug2
(
3
,
"allocating parameter %d for info (%lu bytes)
\n
"
,
i
,
length
);
png_debug2
(
3
,
"allocating parameter %d for info (%lu bytes)
\n
"
,
i
,
length
);
info_ptr
->
pcal_params
[
i
]
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
info_ptr
->
pcal_params
[
i
]
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
if
(
info_ptr
->
pcal_params
[
i
]
==
(
png_charp
)
NULL
)
png_memcpy
(
info_ptr
->
pcal_params
[
i
],
params
[
i
],
(
png_size_t
)
length
);
{
nparams
=
i
;
png_warning
(
png_ptr
,
"Could not allocate memory for pCAL params"
);
}
else
png_memcpy
(
info_ptr
->
pcal_params
[
i
],
params
[
i
],
(
png_size_t
)
length
);
}
}
info_ptr
->
valid
|=
PNG_INFO_pCAL
;
info_ptr
->
valid
|=
PNG_INFO_pCAL
;
...
@@ -390,14 +361,12 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
...
@@ -390,14 +361,12 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
length
=
png_strlen
(
swidth
)
+
1
;
length
=
png_strlen
(
swidth
)
+
1
;
png_debug1
(
3
,
"allocating unit for info (%d bytes)
\n
"
,
length
);
png_debug1
(
3
,
"allocating unit for info (%d bytes)
\n
"
,
length
);
info_ptr
->
scal_s_width
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
info_ptr
->
scal_s_width
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
if
(
info_ptr
->
scal_s_width
!=
(
png_charp
)
NULL
)
png_memcpy
(
info_ptr
->
scal_s_width
,
swidth
,
(
png_size_t
)
length
);
png_memcpy
(
info_ptr
->
scal_s_width
,
swidth
,
(
png_size_t
)
length
);
length
=
png_strlen
(
sheight
)
+
1
;
length
=
png_strlen
(
sheight
)
+
1
;
png_debug1
(
3
,
"allocating unit for info (%d bytes)
\n
"
,
length
);
png_debug1
(
3
,
"allocating unit for info (%d bytes)
\n
"
,
length
);
info_ptr
->
scal_s_height
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
info_ptr
->
scal_s_height
=
(
png_charp
)
png_malloc
(
png_ptr
,
length
);
if
(
info_ptr
->
scal_s_height
!=
(
png_charp
)
NULL
)
png_memcpy
(
info_ptr
->
scal_s_height
,
sheight
,
(
png_size_t
)
length
);
png_memcpy
(
info_ptr
->
scal_s_height
,
sheight
,
(
png_size_t
)
length
);
info_ptr
->
valid
|=
PNG_INFO_sCAL
;
info_ptr
->
valid
|=
PNG_INFO_sCAL
;
#ifdef PNG_FREE_ME_SUPPORTED
#ifdef PNG_FREE_ME_SUPPORTED
...
@@ -443,11 +412,6 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
...
@@ -443,11 +412,6 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
png_ptr
->
palette
=
(
png_colorp
)
png_zalloc
(
png_ptr
,
(
uInt
)
num_palette
,
png_ptr
->
palette
=
(
png_colorp
)
png_zalloc
(
png_ptr
,
(
uInt
)
num_palette
,
sizeof
(
png_color
));
sizeof
(
png_color
));
if
(
png_ptr
->
palette
==
(
png_colorp
)
NULL
)
{
png_warning
(
png_ptr
,
"Unable to allocate palette"
);
return
;
}
png_memcpy
(
png_ptr
->
palette
,
palette
,
num_palette
*
sizeof
(
png_color
));
png_memcpy
(
png_ptr
->
palette
,
palette
,
num_palette
*
sizeof
(
png_color
));
info_ptr
->
palette
=
png_ptr
->
palette
;
info_ptr
->
palette
=
png_ptr
->
palette
;
info_ptr
->
num_palette
=
png_ptr
->
num_palette
=
(
png_uint_16
)
num_palette
;
info_ptr
->
num_palette
=
png_ptr
->
num_palette
=
(
png_uint_16
)
num_palette
;
...
@@ -572,19 +536,8 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
...
@@ -572,19 +536,8 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
return
;
return
;
new_iccp_name
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_strlen
(
name
)
+
1
);
new_iccp_name
=
(
png_charp
)
png_malloc
(
png_ptr
,
png_strlen
(
name
)
+
1
);
if
(
new_iccp_name
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for ICC profile name"
);
return
;
}
png_strcpy
(
new_iccp_name
,
name
);
png_strcpy
(
new_iccp_name
,
name
);
new_iccp_profile
=
(
png_charp
)
png_malloc
(
png_ptr
,
proflen
);
new_iccp_profile
=
(
png_charp
)
png_malloc
(
png_ptr
,
proflen
);
if
(
new_iccp_profile
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for ICC profile"
);
png_free
(
png_ptr
,
new_iccp_name
);
return
;
}
png_memcpy
(
new_iccp_profile
,
profile
,
(
png_size_t
)
proflen
);
png_memcpy
(
new_iccp_profile
,
profile
,
(
png_size_t
)
proflen
);
png_free_data
(
png_ptr
,
info_ptr
,
PNG_FREE_ICCP
,
0
);
png_free_data
(
png_ptr
,
info_ptr
,
PNG_FREE_ICCP
,
0
);
...
@@ -630,12 +583,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
...
@@ -630,12 +583,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
old_text
=
info_ptr
->
text
;
old_text
=
info_ptr
->
text
;
info_ptr
->
text
=
(
png_textp
)
png_malloc
(
png_ptr
,
info_ptr
->
text
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
info_ptr
->
max_text
*
sizeof
(
png_text
)));
(
png_uint_32
)(
info_ptr
->
max_text
*
sizeof
(
png_text
)));
if
(
info_ptr
->
text
==
(
png_textp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for text"
);
info_ptr
->
text
=
old_text
;
return
;
}
png_memcpy
(
info_ptr
->
text
,
old_text
,
(
png_size_t
)(
old_max
*
png_memcpy
(
info_ptr
->
text
,
old_text
,
(
png_size_t
)(
old_max
*
sizeof
(
png_text
)));
sizeof
(
png_text
)));
png_free
(
png_ptr
,
old_text
);
png_free
(
png_ptr
,
old_text
);
...
@@ -646,11 +593,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
...
@@ -646,11 +593,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr
->
num_text
=
0
;
info_ptr
->
num_text
=
0
;
info_ptr
->
text
=
(
png_textp
)
png_malloc
(
png_ptr
,
info_ptr
->
text
=
(
png_textp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
info_ptr
->
max_text
*
sizeof
(
png_text
)));
(
png_uint_32
)(
info_ptr
->
max_text
*
sizeof
(
png_text
)));
if
(
info_ptr
->
text
==
(
png_textp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for text"
);
return
;
}
#ifdef PNG_FREE_ME_SUPPORTED
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr
->
free_me
|=
PNG_FREE_TEXT
;
info_ptr
->
free_me
|=
PNG_FREE_TEXT
;
#endif
#endif
...
@@ -664,7 +606,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
...
@@ -664,7 +606,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
png_size_t
lang_len
,
lang_key_len
;
png_size_t
lang_len
,
lang_key_len
;
png_textp
textp
=
&
(
info_ptr
->
text
[
info_ptr
->
num_text
]);
png_textp
textp
=
&
(
info_ptr
->
text
[
info_ptr
->
num_text
]);
if
(
text_ptr
[
i
].
key
==
(
png_charp
)
NULL
)
if
(
text_ptr
[
i
].
key
==
NULL
)
continue
;
continue
;
key_len
=
png_strlen
(
text_ptr
[
i
].
key
);
key_len
=
png_strlen
(
text_ptr
[
i
].
key
);
...
@@ -678,11 +620,11 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
...
@@ -678,11 +620,11 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#ifdef PNG_iTXt_SUPPORTED
#ifdef PNG_iTXt_SUPPORTED
{
{
/* set iTXt data */
/* set iTXt data */
if
(
text_ptr
[
i
].
key
!=
(
png_charp
)
NULL
)
if
(
text_ptr
[
i
].
key
!=
NULL
)
lang_len
=
png_strlen
(
text_ptr
[
i
].
lang
);
lang_len
=
png_strlen
(
text_ptr
[
i
].
lang
);
else
else
lang_len
=
0
;
lang_len
=
0
;
if
(
text_ptr
[
i
].
lang_key
!=
(
png_charp
)
NULL
)
if
(
text_ptr
[
i
].
lang_key
!=
NULL
)
lang_key_len
=
png_strlen
(
text_ptr
[
i
].
lang_key
);
lang_key_len
=
png_strlen
(
text_ptr
[
i
].
lang_key
);
else
else
lang_key_len
=
0
;
lang_key_len
=
0
;
...
@@ -694,7 +636,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
...
@@ -694,7 +636,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
}
#endif
#endif
if
(
text_ptr
[
i
].
text
==
(
png_charp
)
NULL
||
text_ptr
[
i
].
text
[
0
]
==
'\0'
)
if
(
text_ptr
[
i
].
text
==
NULL
||
text_ptr
[
i
].
text
[
0
]
==
'\0'
)
{
{
text_length
=
0
;
text_length
=
0
;
#ifdef PNG_iTXt_SUPPORTED
#ifdef PNG_iTXt_SUPPORTED
...
@@ -712,11 +654,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
...
@@ -712,11 +654,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
textp
->
key
=
(
png_charp
)
png_malloc
(
png_ptr
,
textp
->
key
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
key_len
+
text_length
+
lang_len
+
lang_key_len
+
4
));
(
png_uint_32
)(
key_len
+
text_length
+
lang_len
+
lang_key_len
+
4
));
if
(
textp
->
key
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for text pointer"
);
return
;
}
png_debug2
(
2
,
"Allocated %d bytes at %x in png_set_text
\n
"
,
png_debug2
(
2
,
"Allocated %d bytes at %x in png_set_text
\n
"
,
key_len
+
lang_len
+
lang_key_len
+
text_length
+
4
,
(
int
)
textp
->
key
);
key_len
+
lang_len
+
lang_key_len
+
text_length
+
4
,
(
int
)
textp
->
key
);
...
@@ -804,11 +741,6 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
...
@@ -804,11 +741,6 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
png_ptr
->
trans
=
info_ptr
->
trans
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
trans
=
info_ptr
->
trans
=
(
png_bytep
)
png_malloc
(
png_ptr
,
num_trans
);
num_trans
);
if
(
png_ptr
->
trans
==
(
png_bytep
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for tRNS array"
);
return
;
}
png_memcpy
(
info_ptr
->
trans
,
trans
,
num_trans
);
png_memcpy
(
info_ptr
->
trans
,
trans
,
num_trans
);
#ifdef PNG_FREE_ME_SUPPORTED
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr
->
free_me
|=
PNG_FREE_TRNS
;
info_ptr
->
free_me
|=
PNG_FREE_TRNS
;
...
@@ -839,11 +771,6 @@ png_set_sPLT(png_structp png_ptr,
...
@@ -839,11 +771,6 @@ png_set_sPLT(png_structp png_ptr,
np
=
(
png_sPLT_tp
)
png_malloc
(
png_ptr
,
np
=
(
png_sPLT_tp
)
png_malloc
(
png_ptr
,
(
info_ptr
->
splt_palettes_num
+
nentries
)
*
sizeof
(
png_sPLT_t
));
(
info_ptr
->
splt_palettes_num
+
nentries
)
*
sizeof
(
png_sPLT_t
));
if
(
np
==
(
png_sPLT_tp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for sPLT"
);
return
;
}
png_memcpy
(
np
,
info_ptr
->
splt_palettes
,
png_memcpy
(
np
,
info_ptr
->
splt_palettes
,
info_ptr
->
splt_palettes_num
*
sizeof
(
png_sPLT_t
));
info_ptr
->
splt_palettes_num
*
sizeof
(
png_sPLT_t
));
...
@@ -860,18 +787,10 @@ png_set_sPLT(png_structp png_ptr,
...
@@ -860,18 +787,10 @@ png_set_sPLT(png_structp png_ptr,
png_strcpy
(
to
->
name
,
from
->
name
);
png_strcpy
(
to
->
name
,
from
->
name
);
to
->
entries
=
(
png_sPLT_entryp
)
png_malloc
(
png_ptr
,
to
->
entries
=
(
png_sPLT_entryp
)
png_malloc
(
png_ptr
,
from
->
nentries
*
sizeof
(
png_sPLT_t
));
from
->
nentries
*
sizeof
(
png_sPLT_t
));
if
(
to
->
entries
==
(
png_sPLT_entryp
)
NULL
)
png_memcpy
(
to
->
entries
,
from
->
entries
,
{
from
->
nentries
*
sizeof
(
png_sPLT_t
));
png_warning
(
png_ptr
,
"Could not allocate memory for sPLT entry"
);
to
->
nentries
=
from
->
nentries
;
nentries
=
i
;
to
->
depth
=
from
->
depth
;
}
else
{
png_memcpy
(
to
->
entries
,
from
->
entries
,
from
->
nentries
*
sizeof
(
png_sPLT_t
));
to
->
nentries
=
from
->
nentries
;
to
->
depth
=
from
->
depth
;
}
}
}
info_ptr
->
splt_palettes
=
np
;
info_ptr
->
splt_palettes
=
np
;
...
@@ -897,11 +816,6 @@ png_set_unknown_chunks(png_structp png_ptr,
...
@@ -897,11 +816,6 @@ png_set_unknown_chunks(png_structp png_ptr,
np
=
(
png_unknown_chunkp
)
png_malloc
(
png_ptr
,
np
=
(
png_unknown_chunkp
)
png_malloc
(
png_ptr
,
(
info_ptr
->
unknown_chunks_num
+
num_unknowns
)
*
(
info_ptr
->
unknown_chunks_num
+
num_unknowns
)
*
sizeof
(
png_unknown_chunk
));
sizeof
(
png_unknown_chunk
));
if
(
np
==
(
png_unknown_chunkp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate memory for unknown chunk"
);
return
;
}
png_memcpy
(
np
,
info_ptr
->
unknown_chunks
,
png_memcpy
(
np
,
info_ptr
->
unknown_chunks
,
info_ptr
->
unknown_chunks_num
*
sizeof
(
png_unknown_chunk
));
info_ptr
->
unknown_chunks_num
*
sizeof
(
png_unknown_chunk
));
...
@@ -915,19 +829,11 @@ png_set_unknown_chunks(png_structp png_ptr,
...
@@ -915,19 +829,11 @@ png_set_unknown_chunks(png_structp png_ptr,
png_strcpy
((
png_charp
)
to
->
name
,
(
png_charp
)
from
->
name
);
png_strcpy
((
png_charp
)
to
->
name
,
(
png_charp
)
from
->
name
);
to
->
data
=
(
png_bytep
)
png_malloc
(
png_ptr
,
from
->
size
);
to
->
data
=
(
png_bytep
)
png_malloc
(
png_ptr
,
from
->
size
);
if
(
to
->
data
==
(
png_bytep
)
NULL
)
png_memcpy
(
to
->
data
,
from
->
data
,
from
->
size
);
{
to
->
size
=
from
->
size
;
png_warning
(
png_ptr
,
"Could not allocate memory for unknown entry"
);
num_unknowns
=
i
;
}
else
{
png_memcpy
(
to
->
data
,
from
->
data
,
from
->
size
);
to
->
size
=
from
->
size
;
/* note our location in the read or write sequence */
/* note our location in the read or write sequence */
to
->
location
=
(
png_byte
)(
png_ptr
->
mode
&
0xff
);
to
->
location
=
(
png_byte
)(
png_ptr
->
mode
&
0xff
);
}
}
}
info_ptr
->
unknown_chunks
=
np
;
info_ptr
->
unknown_chunks
=
np
;
...
@@ -999,7 +905,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
...
@@ -999,7 +905,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
return
;
return
;
old_num_chunks
=
png_ptr
->
num_chunk_list
;
old_num_chunks
=
png_ptr
->
num_chunk_list
;
new_list
=
(
png_bytep
)
png_malloc
(
png_ptr
,
5
*
(
num_chunks
+
old_num_chunks
));
new_list
=
(
png_bytep
)
png_malloc
(
png_ptr
,
5
*
(
num_chunks
+
old_num_chunks
));
if
(
png_ptr
->
chunk_list
!=
(
png_bytep
)
NULL
)
if
(
png_ptr
->
chunk_list
!=
NULL
)
{
{
png_memcpy
(
new_list
,
png_ptr
->
chunk_list
,
5
*
old_num_chunks
);
png_memcpy
(
new_list
,
png_ptr
->
chunk_list
,
5
*
old_num_chunks
);
png_free
(
png_ptr
,
png_ptr
->
chunk_list
);
png_free
(
png_ptr
,
png_ptr
->
chunk_list
);
...
@@ -1051,8 +957,6 @@ png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
...
@@ -1051,8 +957,6 @@ png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
png_free
(
png_ptr
,
png_ptr
->
zbuf
);
png_free
(
png_ptr
,
png_ptr
->
zbuf
);
png_ptr
->
zbuf_size
=
(
png_size_t
)
size
;
png_ptr
->
zbuf_size
=
(
png_size_t
)
size
;
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
size
);
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
size
);
if
(
!
png_ptr
->
zbuf
)
png_error
(
png_ptr
,
"Unable to malloc zbuf"
);
png_ptr
->
zstream
.
next_out
=
png_ptr
->
zbuf
;
png_ptr
->
zstream
.
next_out
=
png_ptr
->
zbuf
;
png_ptr
->
zstream
.
avail_out
=
(
uInt
)
png_ptr
->
zbuf_size
;
png_ptr
->
zstream
.
avail_out
=
(
uInt
)
png_ptr
->
zbuf_size
;
}
}
...
...
pngtest.c
浏览文件 @
82ae3833
/* pngtest.c - a simple test program to test libpng
/* pngtest.c - a simple test program to test libpng
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -1028,18 +1028,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
...
@@ -1028,18 +1028,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
row_buf
=
(
png_bytep
)
png_malloc
(
read_ptr
,
row_buf
=
(
png_bytep
)
png_malloc
(
read_ptr
,
png_get_rowbytes
(
read_ptr
,
read_info_ptr
));
png_get_rowbytes
(
read_ptr
,
read_info_ptr
));
png_debug1
(
0
,
"0x%08lx
\n\n
"
,
(
unsigned
long
)
row_buf
);
png_debug1
(
0
,
"0x%08lx
\n\n
"
,
(
unsigned
long
)
row_buf
);
if
(
row_buf
==
NULL
)
{
fprintf
(
STDERR
,
"No memory to allocate row buffer
\n
"
);
png_destroy_read_struct
(
&
read_ptr
,
&
read_info_ptr
,
(
png_infopp
)
NULL
);
#ifdef PNG_WRITE_SUPPORTED
png_destroy_info_struct
(
write_ptr
,
&
write_end_info_ptr
);
png_destroy_write_struct
(
&
write_ptr
,
&
write_info_ptr
);
#endif
FCLOSE
(
fpin
);
FCLOSE
(
fpout
);
return
(
1
);
}
#endif
/* SINGLE_ROWBUF_ALLOC */
#endif
/* SINGLE_ROWBUF_ALLOC */
png_debug
(
0
,
"Writing row data
\n
"
);
png_debug
(
0
,
"Writing row data
\n
"
);
...
@@ -1523,4 +1511,4 @@ main(int argc, char *argv[])
...
@@ -1523,4 +1511,4 @@ main(int argc, char *argv[])
}
}
/* Generate a compiler error if there is an old png.h in the search path. */
/* Generate a compiler error if there is an old png.h in the search path. */
typedef
version_1_0_11
beta3
your_png_h_is_not_version_1_0_11beta3
;
typedef
version_1_0_11
rc1
your_png_h_is_not_version_1_0_11rc1
;
pngtrans.c
浏览文件 @
82ae3833
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
...
pngvcrd.c
浏览文件 @
82ae3833
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
*
*
* For Intel x86 CPU and Microsoft Visual C++ compiler
* For Intel x86 CPU and Microsoft Visual C++ compiler
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, Intel Corporation
...
...
pngwio.c
浏览文件 @
82ae3833
/* pngwio.c - functions for data output
/* pngwio.c - functions for data output
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
...
pngwrite.c
浏览文件 @
82ae3833
/* pngwrite.c - general routines to write a PNG file
/* pngwrite.c - general routines to write a PNG file
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -512,8 +512,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
...
@@ -512,8 +512,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
(
png_uint_32
)
png_ptr
->
zbuf_size
);
if
(
png_ptr
->
zbuf
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate zbuf for writing"
);
png_set_write_fn
(
png_ptr
,
NULL
,
NULL
,
NULL
);
png_set_write_fn
(
png_ptr
,
NULL
,
NULL
,
NULL
);
...
@@ -583,8 +581,6 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
...
@@ -583,8 +581,6 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf_size
=
PNG_ZBUF_SIZE
;
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
zbuf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
(
png_uint_32
)
png_ptr
->
zbuf_size
);
if
(
png_ptr
->
zbuf
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate zbuf for writing"
);
png_set_write_fn
(
png_ptr
,
NULL
,
NULL
,
NULL
);
png_set_write_fn
(
png_ptr
,
NULL
,
NULL
,
NULL
);
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
...
@@ -1033,8 +1029,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
...
@@ -1033,8 +1029,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
{
png_ptr
->
sub_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
sub_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
sub_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate sub_row"
);
png_ptr
->
sub_row
[
0
]
=
PNG_FILTER_VALUE_SUB
;
png_ptr
->
sub_row
[
0
]
=
PNG_FILTER_VALUE_SUB
;
}
}
...
@@ -1049,10 +1043,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
...
@@ -1049,10 +1043,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
{
png_ptr
->
up_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
up_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
up_row
==
(
png_bytep
)
NULL
)
{
png_error
(
png_ptr
,
"Could not allocate sub_row"
);
}
png_ptr
->
up_row
[
0
]
=
PNG_FILTER_VALUE_UP
;
png_ptr
->
up_row
[
0
]
=
PNG_FILTER_VALUE_UP
;
}
}
}
}
...
@@ -1068,8 +1058,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
...
@@ -1068,8 +1058,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
{
png_ptr
->
avg_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
avg_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
avg_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate avg_row"
);
png_ptr
->
avg_row
[
0
]
=
PNG_FILTER_VALUE_AVG
;
png_ptr
->
avg_row
[
0
]
=
PNG_FILTER_VALUE_AVG
;
}
}
}
}
...
@@ -1086,8 +1074,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
...
@@ -1086,8 +1074,6 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
{
png_ptr
->
paeth_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
paeth_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
paeth_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate avg_row"
);
png_ptr
->
paeth_row
[
0
]
=
PNG_FILTER_VALUE_PAETH
;
png_ptr
->
paeth_row
[
0
]
=
PNG_FILTER_VALUE_PAETH
;
}
}
}
}
...
@@ -1143,13 +1129,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
...
@@ -1143,13 +1129,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
png_ptr
->
prev_filters
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
prev_filters
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
(
png_byte
)
*
num_weights
));
(
png_uint_32
)(
sizeof
(
png_byte
)
*
num_weights
));
if
(
png_ptr
->
prev_filters
!=
(
png_bytep
)
NULL
)
/* To make sure that the weighting starts out fairly */
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
{
{
/* To make sure that the weighting starts out fairly */
png_ptr
->
prev_filters
[
i
]
=
255
;
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
{
png_ptr
->
prev_filters
[
i
]
=
255
;
}
}
}
}
}
...
@@ -1160,22 +1143,11 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
...
@@ -1160,22 +1143,11 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
png_ptr
->
inv_filter_weights
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
png_ptr
->
inv_filter_weights
=
(
png_uint_16p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
sizeof
(
png_uint_16
)
*
num_weights
));
(
png_uint_32
)(
sizeof
(
png_uint_16
)
*
num_weights
));
if
(
png_ptr
->
inv_filter_weights
==
(
png_uint_16p
)
NULL
)
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
{
{
png_free
(
png_ptr
,
png_ptr
->
filter_weights
);
png_ptr
->
inv_filter_weights
[
i
]
=
png_ptr
->
filter_weights
=
NULL
;
png_ptr
->
filter_weights
[
i
]
=
PNG_WEIGHT_FACTOR
;
}
if
(
png_ptr
->
filter_weights
!=
(
png_uint_16p
)
NULL
&&
png_ptr
->
inv_filter_weights
!=
(
png_uint_16p
)
NULL
)
{
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
{
png_ptr
->
inv_filter_weights
[
i
]
=
png_ptr
->
filter_weights
[
i
]
=
PNG_WEIGHT_FACTOR
;
}
}
}
else
num_weights
=
0
;
}
}
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
for
(
i
=
0
;
i
<
num_weights
;
i
++
)
...
@@ -1387,7 +1359,7 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
...
@@ -1387,7 +1359,7 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* It is REQUIRED to call this to finish writing the rest of the file */
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end
(
png_ptr
,
info_ptr
);
png_write_end
(
png_ptr
,
info_ptr
);
if
(
transforms
==
0
||
params
==
(
voidp
)
NULL
)
if
(
transforms
==
0
||
params
==
NULL
)
/* quiet compiler warnings */
return
;
/* quiet compiler warnings */
return
;
}
}
#endif
#endif
...
...
pngwtran.c
浏览文件 @
82ae3833
/* pngwtran.c - transforms the data in a row for PNG writers
/* pngwtran.c - transforms the data in a row for PNG writers
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
...
pngwutil.c
浏览文件 @
82ae3833
/* pngwutil.c - utilities to write a PNG file
/* pngwutil.c - utilities to write a PNG file
*
*
* libpng 1.0.11
beta3 - April 15
, 2001
* libpng 1.0.11
rc1 - April 20
, 2001
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
...
@@ -235,11 +235,6 @@ png_text_compress(png_structp png_ptr,
...
@@ -235,11 +235,6 @@ png_text_compress(png_structp png_ptr,
old_ptr
=
comp
->
output_ptr
;
old_ptr
=
comp
->
output_ptr
;
comp
->
output_ptr
=
(
png_charpp
)
png_malloc
(
png_ptr
,
comp
->
output_ptr
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
comp
->
max_output_ptr
*
sizeof
(
png_charpp
)));
(
png_uint_32
)(
comp
->
max_output_ptr
*
sizeof
(
png_charpp
)));
if
(
comp
->
output_ptr
==
(
png_charpp
)
NULL
)
{
png_warning
(
png_ptr
,
"Cannot allocate compression buffer"
);
comp
->
output_ptr
=
old_ptr
;
}
png_memcpy
(
comp
->
output_ptr
,
old_ptr
,
old_max
png_memcpy
(
comp
->
output_ptr
,
old_ptr
,
old_max
*
sizeof
(
png_charp
));
*
sizeof
(
png_charp
));
png_free
(
png_ptr
,
old_ptr
);
png_free
(
png_ptr
,
old_ptr
);
...
@@ -247,23 +242,14 @@ png_text_compress(png_structp png_ptr,
...
@@ -247,23 +242,14 @@ png_text_compress(png_structp png_ptr,
else
else
comp
->
output_ptr
=
(
png_charpp
)
png_malloc
(
png_ptr
,
comp
->
output_ptr
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
comp
->
max_output_ptr
*
sizeof
(
png_charp
)));
(
png_uint_32
)(
comp
->
max_output_ptr
*
sizeof
(
png_charp
)));
if
(
comp
->
output_ptr
==
(
png_charpp
)
NULL
)
{
png_warning
(
png_ptr
,
"Cannot allocate compression buffer"
);
}
}
}
/* save the data */
/* save the data */
comp
->
output_ptr
[
comp
->
num_output_ptr
]
=
(
png_charp
)
png_malloc
(
png_ptr
,
comp
->
output_ptr
[
comp
->
num_output_ptr
]
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
(
png_uint_32
)
png_ptr
->
zbuf_size
);
if
(
comp
->
output_ptr
[
comp
->
num_output_ptr
]
==
(
png_charp
)
NULL
)
png_memcpy
(
comp
->
output_ptr
[
comp
->
num_output_ptr
],
png_ptr
->
zbuf
,
png_warning
(
png_ptr
,
"Cannot allocate compression buffer"
);
png_ptr
->
zbuf_size
);
else
comp
->
num_output_ptr
++
;
{
png_memcpy
(
comp
->
output_ptr
[
comp
->
num_output_ptr
],
png_ptr
->
zbuf
,
png_ptr
->
zbuf_size
);
comp
->
num_output_ptr
++
;
}
/* and reset the buffer */
/* and reset the buffer */
png_ptr
->
zstream
.
avail_out
=
(
uInt
)
png_ptr
->
zbuf_size
;
png_ptr
->
zstream
.
avail_out
=
(
uInt
)
png_ptr
->
zbuf_size
;
...
@@ -298,8 +284,7 @@ png_text_compress(png_structp png_ptr,
...
@@ -298,8 +284,7 @@ png_text_compress(png_structp png_ptr,
/* This could be optimized to realloc() */
/* This could be optimized to realloc() */
comp
->
output_ptr
=
(
png_charpp
)
png_malloc
(
png_ptr
,
comp
->
output_ptr
=
(
png_charpp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
comp
->
max_output_ptr
*
sizeof
(
png_charpp
)));
(
png_uint_32
)(
comp
->
max_output_ptr
*
sizeof
(
png_charpp
)));
if
(
comp
->
output_ptr
!=
(
png_charpp
)
NULL
)
png_memcpy
(
comp
->
output_ptr
,
old_ptr
,
png_memcpy
(
comp
->
output_ptr
,
old_ptr
,
old_max
*
sizeof
(
png_charp
));
old_max
*
sizeof
(
png_charp
));
png_free
(
png_ptr
,
old_ptr
);
png_free
(
png_ptr
,
old_ptr
);
}
}
...
@@ -311,14 +296,9 @@ png_text_compress(png_structp png_ptr,
...
@@ -311,14 +296,9 @@ png_text_compress(png_structp png_ptr,
/* save off the data */
/* save off the data */
comp
->
output_ptr
[
comp
->
num_output_ptr
]
=
comp
->
output_ptr
[
comp
->
num_output_ptr
]
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
png_ptr
->
zbuf_size
);
if
(
comp
->
output_ptr
[
comp
->
num_output_ptr
]
==
(
png_charp
)
NULL
)
png_memcpy
(
comp
->
output_ptr
[
comp
->
num_output_ptr
],
png_ptr
->
zbuf
,
png_warning
(
png_ptr
,
"Cannot allocate compression buffer"
);
png_ptr
->
zbuf_size
);
else
comp
->
num_output_ptr
++
;
{
png_memcpy
(
comp
->
output_ptr
[
comp
->
num_output_ptr
],
png_ptr
->
zbuf
,
png_ptr
->
zbuf_size
);
comp
->
num_output_ptr
++
;
}
/* and reset the buffer pointers */
/* and reset the buffer pointers */
png_ptr
->
zstream
.
avail_out
=
(
uInt
)
png_ptr
->
zbuf_size
;
png_ptr
->
zstream
.
avail_out
=
(
uInt
)
png_ptr
->
zbuf_size
;
...
@@ -1130,12 +1110,6 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
...
@@ -1130,12 +1110,6 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
*
new_key
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
key_len
+
2
));
*
new_key
=
(
png_charp
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
key_len
+
2
));
if
(
*
new_key
==
(
png_charp
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate new key; keyword not checked"
);
return
key_len
;
}
/* Replace non-printing characters with a blank and print a warning */
/* Replace non-printing characters with a blank and print a warning */
for
(
kp
=
key
,
dp
=
*
new_key
;
*
kp
!=
'\0'
;
kp
++
,
dp
++
)
for
(
kp
=
key
,
dp
=
*
new_key
;
*
kp
!=
'\0'
;
kp
++
,
dp
++
)
{
{
...
@@ -1451,12 +1425,6 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
...
@@ -1451,12 +1425,6 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
params_len
=
(
png_uint_32p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
nparams
params_len
=
(
png_uint_32p
)
png_malloc
(
png_ptr
,
(
png_uint_32
)(
nparams
*
sizeof
(
png_uint_32
)));
*
sizeof
(
png_uint_32
)));
if
(
params_len
==
(
png_uint_32p
)
NULL
)
{
png_warning
(
png_ptr
,
"Could not allocate params for pCAL"
);
return
;
}
/* Find the length of each parameter, making sure we don't count the
/* Find the length of each parameter, making sure we don't count the
null terminator for the last parameter. */
null terminator for the last parameter. */
for
(
i
=
0
;
i
<
nparams
;
i
++
)
for
(
i
=
0
;
i
<
nparams
;
i
++
)
...
@@ -1640,8 +1608,6 @@ png_write_start_row(png_structp png_ptr)
...
@@ -1640,8 +1608,6 @@ png_write_start_row(png_structp png_ptr)
/* set up row buffer */
/* set up row buffer */
png_ptr
->
row_buf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
buf_size
);
png_ptr
->
row_buf
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_uint_32
)
buf_size
);
if
(
png_ptr
->
row_buf
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate row buffer"
);
png_ptr
->
row_buf
[
0
]
=
PNG_FILTER_VALUE_NONE
;
png_ptr
->
row_buf
[
0
]
=
PNG_FILTER_VALUE_NONE
;
/* set up filtering buffer, if using this filter */
/* set up filtering buffer, if using this filter */
...
@@ -1649,8 +1615,6 @@ png_write_start_row(png_structp png_ptr)
...
@@ -1649,8 +1615,6 @@ png_write_start_row(png_structp png_ptr)
{
{
png_ptr
->
sub_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
sub_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
sub_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate sub row buffer"
);
png_ptr
->
sub_row
[
0
]
=
PNG_FILTER_VALUE_SUB
;
png_ptr
->
sub_row
[
0
]
=
PNG_FILTER_VALUE_SUB
;
}
}
...
@@ -1665,8 +1629,6 @@ png_write_start_row(png_structp png_ptr)
...
@@ -1665,8 +1629,6 @@ png_write_start_row(png_structp png_ptr)
{
{
png_ptr
->
up_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
up_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
up_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate up row buffer"
);
png_ptr
->
up_row
[
0
]
=
PNG_FILTER_VALUE_UP
;
png_ptr
->
up_row
[
0
]
=
PNG_FILTER_VALUE_UP
;
}
}
...
@@ -1674,8 +1636,6 @@ png_write_start_row(png_structp png_ptr)
...
@@ -1674,8 +1636,6 @@ png_write_start_row(png_structp png_ptr)
{
{
png_ptr
->
avg_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
avg_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
avg_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate avg row buffer"
);
png_ptr
->
avg_row
[
0
]
=
PNG_FILTER_VALUE_AVG
;
png_ptr
->
avg_row
[
0
]
=
PNG_FILTER_VALUE_AVG
;
}
}
...
@@ -1683,8 +1643,6 @@ png_write_start_row(png_structp png_ptr)
...
@@ -1683,8 +1643,6 @@ png_write_start_row(png_structp png_ptr)
{
{
png_ptr
->
paeth_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
png_ptr
->
paeth_row
=
(
png_bytep
)
png_malloc
(
png_ptr
,
(
png_ptr
->
rowbytes
+
1
));
(
png_ptr
->
rowbytes
+
1
));
if
(
png_ptr
->
paeth_row
==
(
png_bytep
)
NULL
)
png_error
(
png_ptr
,
"Could not allocate paeth row buffer"
);
png_ptr
->
paeth_row
[
0
]
=
PNG_FILTER_VALUE_PAETH
;
png_ptr
->
paeth_row
[
0
]
=
PNG_FILTER_VALUE_PAETH
;
}
}
}
}
...
...
projects/msvc/README.txt
浏览文件 @
82ae3833
Microsoft Developer Studio Build File, Format Version 6.00 for
Microsoft Developer Studio Build File, Format Version 6.00 for
libpng 1.0.11
beta3 (April 15
, 2001) and zlib
libpng 1.0.11
rc1 (April 20
, 2001) and zlib
Copyright (C) 2000 Simon-Pierre Cadieux
Copyright (C) 2000 Simon-Pierre Cadieux
For conditions of distribution and use, see copyright notice in png.h
For conditions of distribution and use, see copyright notice in png.h
...
...
projects/msvc/png32ms.def
浏览文件 @
82ae3833
...
@@ -6,7 +6,7 @@ LIBRARY
...
@@ -6,7 +6,7 @@ LIBRARY
DESCRIPTION "PNG image compression library for Windows"
DESCRIPTION "PNG image compression library for Windows"
EXPORTS
EXPORTS
;Version 1.0.11
beta3
;Version 1.0.11
rc1
png_build_grayscale_palette @1
png_build_grayscale_palette @1
png_check_sig @2
png_check_sig @2
png_chunk_error @3
png_chunk_error @3
...
...
projects/wince/READMEE.WCE
浏览文件 @
82ae3833
...
@@ -8,9 +8,9 @@ libpng for WindowsCE Rel.1.0
...
@@ -8,9 +8,9 @@ libpng for WindowsCE Rel.1.0
Introduction
Introduction
============
============
This is libpng 1.0.11
beta3
ported to WindowsCE 2.0 and 2.11.
This is libpng 1.0.11
rc1
ported to WindowsCE 2.0 and 2.11.
libpng 1.0.11
beta3
is a PNG reference library.
libpng 1.0.11
rc1
is a PNG reference library.
See README, a document of original libpng 1.0.11
beta3
.
See README, a document of original libpng 1.0.11
rc1
.
zlib for WindowsCE
zlib for WindowsCE
==================
==================
...
@@ -23,7 +23,7 @@ This software is provided 'as-is', without any express or implied
...
@@ -23,7 +23,7 @@ This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
arising from the use of this software.
See README and LICENSE, documents of original libpng 1.0.11
beta3
, for conditions
See README and LICENSE, documents of original libpng 1.0.11
rc1
, for conditions
of use and distribution.
of use and distribution.
Files
Files
...
...
projects/wince/READMEJ.WCE
浏览文件 @
82ae3833
...
@@ -24,7 +24,7 @@ libpng
...
@@ -24,7 +24,7 @@ libpng
になったいかなる被害についても、作者、配布者、その他利用者以外の人物、
になったいかなる被害についても、作者、配布者、その他利用者以外の人物、
団体に責任をとる義務はないものとします。
団体に責任をとる義務はないものとします。
その他、このソフトウェアの利用条件については、原版である libpng 1.0.11
beta3
に
その他、このソフトウェアの利用条件については、原版である libpng 1.0.11
rc1
に
準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。
準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。
収録内容
収録内容
...
...
projects/wince/png32ce.def
浏览文件 @
82ae3833
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
LIBRARY lpngce
LIBRARY lpngce
EXPORTS
EXPORTS
;Version 1.0.11
beta3
;Version 1.0.11
rc1
png_build_grayscale_palette @1
png_build_grayscale_palette @1
png_check_sig @2
png_check_sig @2
png_chunk_error @3
png_chunk_error @3
...
...
scripts/makefile.aix
浏览文件 @
82ae3833
...
@@ -18,7 +18,7 @@ RM = rm -f
...
@@ -18,7 +18,7 @@ RM = rm -f
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
prefix
=
/usr/local
prefix
=
/usr/local
...
...
scripts/makefile.beos
浏览文件 @
82ae3833
...
@@ -13,7 +13,7 @@ ZLIBINC=/usr/local/include
...
@@ -13,7 +13,7 @@ ZLIBINC=/usr/local/include
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
ALIGN
=
ALIGN
=
...
...
scripts/makefile.cygwin
浏览文件 @
82ae3833
...
@@ -39,8 +39,8 @@ CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
...
@@ -39,8 +39,8 @@ CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
#PNGDLL = $1# msvc
#PNGDLL = $1# msvc
PNGDLL
=
2# cygwin 1.0.11
beta3
PNGDLL
=
2# cygwin 1.0.11
rc1
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGMIN_BASE
=
1.0.11
PNGMIN_BASE
=
1.0.11
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
...
...
scripts/makefile.dec
浏览文件 @
82ae3833
...
@@ -17,7 +17,7 @@ ZLIBINC=../zlib
...
@@ -17,7 +17,7 @@ ZLIBINC=../zlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
CC
=
cc
CC
=
cc
...
...
scripts/makefile.gcmmx
浏览文件 @
82ae3833
...
@@ -51,7 +51,7 @@ RANLIB=ranlib
...
@@ -51,7 +51,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
INCPATH
=
$(prefix)
/include
INCPATH
=
$(prefix)
/include
...
...
scripts/makefile.hpgcc
浏览文件 @
82ae3833
...
@@ -34,7 +34,7 @@ RANLIB=ranlib
...
@@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
INCPATH
=
$(prefix)
/include
INCPATH
=
$(prefix)
/include
...
...
scripts/makefile.hpux
浏览文件 @
82ae3833
...
@@ -19,7 +19,7 @@ RANLIB=ranlib
...
@@ -19,7 +19,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
# where make install puts libpng.a and png.h
# where make install puts libpng.a and png.h
...
...
scripts/makefile.linux
浏览文件 @
82ae3833
...
@@ -34,7 +34,7 @@ RANLIB=ranlib
...
@@ -34,7 +34,7 @@ RANLIB=ranlib
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
INCPATH
=
$(prefix)
/include
INCPATH
=
$(prefix)
/include
...
...
scripts/makefile.netbsd
0 → 100644
浏览文件 @
82ae3833
# makefile for libpng on NetBSD
# Copyright (C) 2001 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h
# where make install puts libpng.a and png.h
# pkgsrc will want prefix=${PREFIX}
prefix
=
/usr/local
INCPATH
=
$(prefix)
/include
LIBPATH
=
$(prefix)
/lib
# The zlib library and include files are part of the standard system
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ
=
2
PNGMIN
=
1.0.11rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
CC
=
cc
# You can define PNG_ASSEMBLER_CODE_SUPPORTED if building for Intel x86
CFLAGS
=
-O2
-DPNG_USE_PNGGCCRD
# -DPNG_ASSEMBLER_CODE_SUPPORTED -g -DPNG_DEBUG=1
LDFLAGS
=
-Wl
,-R
${LIBPATH}
-L
.
-lpng
-lz
-lm
#RANLIB=echo
RANLIB
=
ranlib
OBJS
=
pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o
\
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o
\
pngwtran.o pngmem.o pngerror.o pngpread.o
all
:
libpng.so libpng.a pngtest
libpng.a
:
$(OBJS)
ar rc
$@
$(OBJS)
$(RANLIB)
$@
libpng.so
:
libpng.so.$(PNGMAJ)
ln
-f
-s
libpng.so.
$(PNGMAJ)
libpng.so
libpng.so.$(PNGMAJ)
:
libpng.so.$(PNGVER)
ln
-f
-s
libpng.so.
$(PNGVER)
libpng.so.
$(PNGMAJ)
libpng.so.$(PNGVER)
:
$(OBJS)
$(CC)
-shared
-o
$@
$(OBJS)
-L
$(ZLIBLIB)
-lz
-lm
pngtest
:
pngtest.o libpng.a
$(CC)
-o
pngtest
$(CFLAGS)
pngtest.o
$(LDFLAGS)
test
:
pngtest
./pngtest
install
:
libpng.a libpng.so.$(PNGVER)
-
@mkdir
$(INCPATH)
-
@mkdir
$(LIBPATH)
cp
png.h
$(INCPATH)
cp
pngconf.h
$(INCPATH)
chmod
644
$(INCPATH)
/png.h
chmod
644
$(INCPATH)
/pngconf.h
cp
libpng.a
$(LIBPATH)
cp
libpng.so.
$(PNGVER)
$(LIBPATH)
chmod
644
$(LIBPATH)
/libpng.a
chmod
644
$(LIBPATH)
/libpng.so.
$(PNGVER)
-
@/bin/rm
-f
$(LIBPATH)
/libpng.so.
$(PNGMAJ)
$(LIBPATH)
/libpng.so
(
cd
$(LIBPATH)
;
ln
-f
-s
libpng.so.
$(PNGVER)
libpng.so.
$(PNGMAJ)
;
\
ln
-f
-s
libpng.so.
$(PNGMAJ)
libpng.so
)
clean
:
rm
-f
*
.o libpng.a pngtest pngout.png libpng.so
*
# DO NOT DELETE THIS LINE -- make depend depends on it.
pnggccrd.o
:
png.h pngconf.h
png.o
:
png.h pngconf.h
pngerror.o
:
png.h pngconf.h
pngrio.o
:
png.h pngconf.h
pngwio.o
:
png.h pngconf.h
pngmem.o
:
png.h pngconf.h
pngset.o
:
png.h pngconf.h
pngget.o
:
png.h pngconf.h
pngread.o
:
png.h pngconf.h
pngrtran.o
:
png.h pngconf.h
pngrutil.o
:
png.h pngconf.h
pngtest.o
:
png.h pngconf.h
pngtrans.o
:
png.h pngconf.h
pngwrite.o
:
png.h pngconf.h
pngwtran.o
:
png.h pngconf.h
pngwutil.o
:
png.h pngconf.h
pngpread.o
:
png.h pngconf.h
scripts/makefile.sco
浏览文件 @
82ae3833
...
@@ -25,7 +25,7 @@ RANLIB=echo
...
@@ -25,7 +25,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
INCPATH
=
$(prefix)
/include
INCPATH
=
$(prefix)
/include
...
...
scripts/makefile.sggcc
浏览文件 @
82ae3833
...
@@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
...
@@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
LDSHARED
=
gcc
-shared
LDSHARED
=
gcc
-shared
VER
=
1.0.11
beta3
VER
=
1.0.11
rc1
LIBS
=
libpng.so.1.0.11
beta3
LIBS
=
libpng.so.1.0.11
rc1
SHAREDLIB
=
libpng.so
SHAREDLIB
=
libpng.so
libdir
=
$(prefix)
/lib32
libdir
=
$(prefix)
/lib32
...
...
scripts/makefile.sgi
浏览文件 @
82ae3833
...
@@ -25,7 +25,7 @@ CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
...
@@ -25,7 +25,7 @@ CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
LDFLAGS
=
-L
.
-L
$(ZLIBLIB)
-lpng
-lz
-lm
LDSHARED
=
cc
-shared
LDSHARED
=
cc
-shared
VER
=
1.0.11
beta3
VER
=
1.0.11
rc1
SONUM
=
2
SONUM
=
2
SHAREDLIB
=
libpng.so
SHAREDLIB
=
libpng.so
libdir
=
$(prefix)
libdir
=
$(prefix)
...
...
scripts/makefile.solaris
浏览文件 @
82ae3833
...
@@ -31,7 +31,7 @@ RANLIB=echo
...
@@ -31,7 +31,7 @@ RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
# have to change it.
PNGMAJ
=
2
PNGMAJ
=
2
PNGMIN
=
1.0.11
beta3
PNGMIN
=
1.0.11
rc1
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
PNGVER
=
$(PNGMAJ)
.
$(PNGMIN)
INCPATH
=
$(prefix)
/include
INCPATH
=
$(prefix)
/include
...
...
scripts/pngdef.pas
浏览文件 @
82ae3833
...
@@ -7,7 +7,7 @@ unit pngdef;
...
@@ -7,7 +7,7 @@ unit pngdef;
interface
interface
const
const
PNG_LIBPNG_VER_STRING
=
'1.0.11
beta3
'
;
PNG_LIBPNG_VER_STRING
=
'1.0.11
rc1
'
;
PNG_LIBPNG_VER
=
10011
;
PNG_LIBPNG_VER
=
10011
;
type
type
...
...
scripts/pngos2.def
浏览文件 @
82ae3833
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
; PNG.LIB module definition file for OS/2
; PNG.LIB module definition file for OS/2
;----------------------------------------
;----------------------------------------
; Version 1.0.11
beta3
; Version 1.0.11
rc1
LIBRARY PNG
LIBRARY PNG
DESCRIPTION "PNG image compression library for OS/2"
DESCRIPTION "PNG image compression library for OS/2"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录