[libpng10] Imported from libpng-1.0.27rc1.tar

This commit is contained in:
Glenn Randers-Pehrson 2007-07-31 12:45:25 -05:00
parent 1719fac606
commit 14ae6c1d94
83 changed files with 8742 additions and 4605 deletions

168
ANNOUNCE
View File

@ -1,47 +1,181 @@
Libpng 1.0.26 - May 15, 2007 Libpng 1.0.27rc1 - July 31, 2007
This is a public release of libpng, intended for use in production codes. This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
Files available for download: Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.0.26.tar.gz libpng-1.0.27rc1.tar.gz
libpng-1.0.26.tar.bz2 libpng-1.0.27rc1.tar.bz2
Source files with LF line endings (for Unix/Linux) without the Source files with LF line endings (for Unix/Linux) without the
"configure" script "configure" script
libpng-1.0.26-no-config.tar.gz libpng-1.0.27rc1-no-config.tar.gz
libpng-1.0.26-no-config.tar.bz2 libpng-1.0.27rc1-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lpng1026.zip lp1027r01.zip
lpng1026.tar.bz2 lp1027r01.tar.bz2
Project files Project files
libpng-1.0.26-project-netware.zip libpng-1.0.27rc1-project-netware.zip
libpng-1.0.26-project-wince.zip libpng-1.0.27rc1-project-wince.zip
Other information: Other information:
libpng-1.0.26-README.txt libpng-1.0.27rc1-README.txt
libpng-1.0.26-KNOWNBUGS.txt libpng-1.0.27rc1-KNOWNBUGS.txt
libpng-1.0.26-LICENSE.txt libpng-1.0.27rc1-LICENSE.txt
libpng-1.0.26-Y2K-compliance.txt libpng-1.0.27rc1-Y2K-compliance.txt
Changes since the last public release (1.0.25): Changes since the last public release (1.0.26):
version 1.0.26 [May 15, 2007] version 1.2.19beta1 [May 18, 2007]
Changed "const static" to "static PNG_CONST" everywhere, mostly undoing
change of libpng-1.2.17beta2. Changed other "const" to "PNG_CONST"
version 1.2.19beta2 [May 18, 2007]
Fixed png_do_expand() to only use the appropriate bits of tRNS value.
version 1.2.19beta3 [May 20, 2007]
Add some "png_byte" typecasts in png_check_keyword().
Write new_key instead of key in zTXt chunk.
version 1.2.19beta4 [May 21, 2007]
Add png_snprintf() function and use it in place of sprint() for improved
defense against buffer overflows.
version 1.2.19beta5 [May 21, 2007]
Fixed png_handle_tRNS() to only use the appropriate bits of tRNS value.
Changed handling of more unused parameters, to avoid compiler warnings.
Removed some PNG_CONST in pngwutil.c to avoid compiler warnings.
version 1.2.19beta6 [May 22, 2007]
Added some #ifdef PNG_MMX_CODE_SUPPORTED where needed in pngvcrd.c
Added a special "_MSC_VER" case that defines png_snprintf to _snprintf
version 1.2.19beta7 [May 22, 2007]
Squelched png_squelch_warnings() in pnggccrd.c and added an
#ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused
the warnings that png_squelch_warnings was squelching.
version 1.2.19beta8 [May 22, 2007]
Removed __MMX__ from test in pngconf.h.
version 1.2.19beta9 [May 23, 2007]
Made png_squelch_warnings() available via PNG_SQUELCH_WARNINGS macro.
Revised png_squelch_warnings() so it might work.
Updated makefile.sgcc and makefile.solaris; added makefile.solaris-x86.
version 1.2.19beta10 [May 24, 2007]
Resquelched png_squelch_warnings(), use "__attribute__((used))" instead.
version 1.2.19beta11 [May 28, 2007]
Return 0 from png_get_sPLT() and png_get_unknown_chunks() if png_ptr is NULL;
changed three remaining instances of png_strcpy() to png_strncpy() (David
Hill).
Make test for NULL row_buf at the beginning of png_do_read_transformations
unconditional.
version 1.2.19beta12 [May 28, 2007]
Revised pnggccrd.c.
version 1.2.19beta13 [June 14, 2007]
Prefer PNG_USE_PNGVCRD when _MSC_VER is defined in pngconf.h
version 1.2.19beta14 [June 16, 2007]
Fix bug with handling of 16-bit transparency, introduced in 1.2.19beta2
version 1.2.19beta15 [June 17, 2007]
Revised pnggccrd.c.
version 1.2.19beta16 [June 18, 2007]
Revised pnggccrd.c again.
Updated contrib/gregbook.
Changed '#include "pnggccrd.c"' to 'include "$srcdir/pnggccrd.c"'
in configure.ac
version 1.2.19beta17 [June 19, 2007]
Revised many of the makefiles, to set -DPNG_NO_MMX_CODE where needed
and to not use -O3 unless -DPNG_NO_MMX_CODE is also set.
version 1.2.19beta18 [June 23, 2007]
Replaced some C++ style comments with C style comments in pnggccrd.c.
Copied optimized C code from pnggccrd.c to pngrutil.c, removed dependency
on pnggccrd.o from many makefiles.
Added sl and dylib to list of extensions be installed by Makefile.am
version 1.2.19beta19 [June 28, 2007]
Fixed testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN in pngrtran.c
More cleanup of pnggccrd.c and pngvcrd.c
version 1.2.19beta20 [June 29, 2007]
Rebuilt Makefile.in and configure using libtool-1.5.24.
Fixed typo in pnggccrd.c
version 1.2.19beta21 [June 30, 2007]
More revision of pnggccrd.c
Added "test" target to Makefile.in and Makefile.am
version 1.2.19beta22 [July 3, 2007]
Added info about pngrutil/pnggccrd/pngvcrd to png_get_header_version()
Fix type definition of dummy_value_a, b in pnggccrd.c
version 1.2.19beta23 [July 10, 2007]
Revert change to type definition of dummy_value_a, b in pnggccrd.c
Make sure __PIC__ is defined in pnggccrd.c when PIC is defined.
Make PNG_NO_MMX_CODE the default on x86_64 GNUC platforms.
version 1.2.19beta24 [July 14, 2007]
Added PNG_NO_READ_FILTER, PNG_NO_WRITE_FILTER, PNG_NO_WARNING macros.
Added contrib/pngminim to demonstrate building minimal encoder and decoder
version 1.2.19beta25 [July 15, 2007]
Removed the new PNG_NO_READ_FILTER macro since it would make the library
unable to read valid PNG files, and filtering is at the heart of the
PNG format.
version 1.2.19beta26 [July 16, 2007]
Changed "png_free(str)" to "png_free(png_ptr,str)" in pngrutil.c WinCE
code (Yves Piguet). This bug was introduced in libpng-1.2.14.
Updated scripts/CMakeLists.txt
Relocated a misplaced #endif in pnggccrd.c
version 1.2.19beta27 [July 17, 2007]
Fixed incorrect stride and number of bytes copied (was 4 instead of
6 bytes) in the cleanup loop of pnggccrd.c and pngvcrd.c for handling
the end of 48-bit interlaced rows (Glenn R-P).
version 1.2.19beta28 [July 19, 2007]
Removed requirement for gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW
on x86_64 platforms
Added png_warning() in pngrutil.c for short iCCP, iTXt, sPLT, or zTXT chunks.
Revised pngtest.c so warnings are displayed regardless of PNG_NO_STDIO.
version 1.2.19beta30 [July 26, 2007]
Revised pnggccrd.c
version 1.2.19beta31 [July 27, 2007]
Fix typos in pnggccrd.c
version 1.2.19beta32 [July 31, 2007]
Disable PNG_MMX_CODE_SUPPORTED when PNG_ASSEMBLER_CODE_SUPPORTED is off.
Enable PNG_MMX_READ_FILTER_* by default (they were inadvertently disabled in
libpng-1.2.19beta23).
Fix some debugging statements in pnggccrd.c and pngrutil.c
Added information about disabling the MMX code in libpng documentation.
Reverted the recent change to symbol-handling in configure script
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net to subscribe) or to glennrp at users.sourceforge.net

144
CHANGES
View File

@ -1469,7 +1469,7 @@ version 1.2.9beta5 [March 4, 2006]
Restored scripts/makefile.elf which was inadvertently deleted. Restored scripts/makefile.elf which was inadvertently deleted.
version 1.2.9beta6 [March 6, 2006] version 1.2.9beta6 [March 6, 2006]
Fixed typo (26) in configuration files. Fixed typo (27) in configuration files.
version 1.2.9beta7 [March 7, 2006] version 1.2.9beta7 [March 7, 2006]
Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am
@ -1712,12 +1712,152 @@ version 1.2.17rc4 [May 10, 2007]
version 1.0.25 [May 15, 2007] version 1.0.25 [May 15, 2007]
version 1.2.17 [May 15, 2007] version 1.2.17 [May 15, 2007]
Added "png_ptr->num_trans=0" before error return in png_handle_tRNS, Added "png_ptr->num_trans=0" before error return in png_handle_tRNS,
to eliminate a vulnerability (CVE-2007-2554, CERT VU#684664) to eliminate a vulnerability (CVE-2007-2445, CERT VU#684664)
version 1.0.26 [May 15, 2007] version 1.0.26 [May 15, 2007]
version 1.2.18 [May 15, 2007] version 1.2.18 [May 15, 2007]
Reverted the libpng-1.2.17rc3 change to symbol-handling in configure script Reverted the libpng-1.2.17rc3 change to symbol-handling in configure script
version 1.2.19beta1 [May 18, 2007]
Changed "const static" to "static PNG_CONST" everywhere, mostly undoing
change of libpng-1.2.17beta2. Changed other "const" to "PNG_CONST"
Changed some handling of unused parameters, to avoid compiler warnings.
"if (unused == NULL) return;" becomes "unused = unused".
version 1.2.19beta2 [May 18, 2007]
Only use the valid bits of tRNS value in png_do_expand() (Brian Cartier)
version 1.2.19beta3 [May 19, 2007]
Add some "png_byte" typecasts in png_check_keyword() and write new_key
instead of key in zTXt chunk (Kevin Ryde).
version 1.2.19beta4 [May 21, 2007]
Add png_snprintf() function and use it in place of sprint() for improved
defense against buffer overflows.
version 1.2.19beta5 [May 21, 2007]
Fixed png_handle_tRNS() to only use the valid bits of tRNS value.
Changed handling of more unused parameters, to avoid compiler warnings.
Removed some PNG_CONST in pngwutil.c to avoid compiler warnings.
version 1.2.19beta6 [May 22, 2007]
Added some #ifdef PNG_MMX_CODE_SUPPORTED where needed in pngvcrd.c
Added a special "_MSC_VER" case that defines png_snprintf to _snprintf
version 1.2.19beta7 [May 22, 2007]
Squelched png_squelch_warnings() in pnggccrd.c and added an
#ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused
the warnings that png_squelch_warnings was squelching.
version 1.2.19beta8 [May 22, 2007]
Removed __MMX__ from test in pngconf.h.
version 1.2.19beta9 [May 23, 2007]
Made png_squelch_warnings() available via PNG_SQUELCH_WARNINGS macro.
Revised png_squelch_warnings() so it might work.
Updated makefile.sgcc and makefile.solaris; added makefile.solaris-x86.
version 1.2.19beta10 [May 24, 2007]
Resquelched png_squelch_warnings(), use "__attribute__((used))" instead.
version 1.2.19beta11 [May 28, 2007]
Return 0 from png_get_sPLT() and png_get_unknown_chunks() if png_ptr is NULL;
changed three remaining instances of png_strcpy() to png_strncpy() (David
Hill).
Make test for NULL row_buf at the beginning of png_do_read_transformations
unconditional.
version 1.2.19beta12 [May 28, 2007]
Revised pnggccrd.c.
version 1.2.19beta13 [June 14, 2007]
Prefer PNG_USE_PNGVCRD when _MSC_VER is defined in pngconf.h
version 1.2.19beta14 [June 16, 2007]
Fix bug with handling of 16-bit transparency, introduced in 1.2.19beta2
version 1.2.19beta15 [June 17, 2007]
Revised pnggccrd.c.
version 1.2.19beta16 [June 18, 2007]
Revised pnggccrd.c again.
Updated contrib/gregbook.
Changed '#include "pnggccrd.c"' to 'include "$srcdir/pnggccrd.c"'
in configure.ac
version 1.2.19beta17 [June 19, 2007]
Revised many of the makefiles, to set -DPNG_NO_MMX_CODE where needed
and to not use -O3 unless -DPNG_NO_MMX_CODE is also set.
version 1.2.19beta18 [June 23, 2007]
Replaced some C++ style comments with C style comments in pnggccrd.c.
Copied optimized C code from pnggccrd.c to pngrutil.c, removed dependency
on pnggccrd.o from many makefiles.
Added sl and dylib to list of extensions be installed by Makefile.am
version 1.2.19beta19 [June 28, 2007]
Fixed testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN in pngrtran.c
More cleanup of pnggccrd.c and pngvcrd.c
version 1.2.19beta20 [June 29, 2007]
Rebuilt Makefile.in and configure using libtool-1.5.24.
Fixed typo in pnggccrd.c
version 1.2.19beta21 [June 30, 2007]
More revision of pnggccrd.c
Added "test" target to Makefile.in and Makefile.am
version 1.2.19beta22 [July 3, 2007]
Added info about pngrutil/pnggccrd/pngvcrd to png_get_header_version()
Fix type definition of dummy_value_a, b in pnggccrd.c
version 1.2.19beta23 [July 10, 2007]
Revert change to type definition of dummy_value_a, b in pnggccrd.c
Make sure __PIC__ is defined in pnggccrd.c when PIC is defined.
Require gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW on x86_64 platforms
version 1.2.19beta24 [July 14, 2007]
Added PNG_NO_READ_FILTER, PNG_NO_WRITE_FILTER, PNG_NO_WARNING macros.
Added contrib/pngminim to demonstrate building minimal encoder and decoder
version 1.2.19beta25 [July 15, 2007]
Removed the new PNG_NO_READ_FILTER macro since it would make the library
unable to read valid PNG files, and filtering is at the heart of the
PNG format.
version 1.2.19beta26 [July 16, 2007]
Changed "png_free(str)" to "png_free(png_ptr,str)" in pngrutil.c WinCE
code (Yves Piguet). This bug was introduced in libpng-1.2.14.
Updated scripts/CMakeLists.txt
Relocated a misplaced #endif in pnggccrd.c
version 1.2.19beta27 [July 17, 2007]
Fixed incorrect stride and number of bytes copied (was 4 instead of
6 bytes) in the cleanup loop of pnggccrd.c and pngvcrd.c for handling
the end of 48-bit interlaced rows (Glenn R-P).
version 1.2.19beta28 [July 19, 2007]
Removed requirement for gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW
on x86_64 platforms
Added png_warning() in pngrutil.c for short iCCP, iTXt, sPLT, or zTXT chunks.
Revised pngtest.c so warnings are displayed regardless of PNG_NO_STDIO.
version 1.2.19beta29 [July 20, 2007]
Fix typo in pnggccrd.c (%%eax should be %%ax in secondloop48)
version 1.2.19beta30 [July 26, 2007]
Revised pnggccrd.c
version 1.2.19beta31 [July 27, 2007]
Fix typos in pnggccrd.c
version 1.0.27rc1 and 1.2.19rc1 [July 31, 2007]
Disable PNG_MMX_CODE_SUPPORTED when PNG_ASSEMBLER_CODE_SUPPORTED is off.
Enable PNG_MMX_READ_FILTER_* by default, except when gcc-3.x is being
used (they were inadvertently disabled in libpng-1.2.19beta23).
Fix some debugging statements in pnggccrd.c and pngrutil.c
Added information about disabling the MMX code in libpng documentation.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement

22
INSTALL
View File

@ -1,5 +1,5 @@
Installing libpng version 1.0.26 - May 15, 2007 Installing libpng version 1.0.27rc1 - July 31, 2007
On Unix/Linux and similar systems, you can simply type On Unix/Linux and similar systems, you can simply type
@ -44,7 +44,7 @@ to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed. correspond to the 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.26" or "lpng109" and "zlib-1.2.1" might be called "libpng-1.0.27rc1" or "lpng109" and "zlib-1.2.1"
or "zlib121") so that you have directories called "zlib" and "libpng". or "zlib121") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@ -101,14 +101,14 @@ include
CMakeLists.txt => "cmake" script CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng10.so.0.1.0.26) gcc, creates libpng10.so.0.1.0.27rc1)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.26) (gcc, creates libpng10.so.0.1.0.27rc1)
makefile.gcmmx => Linux/ELF makefile makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.26, (gcc, creates libpng10.so.0.1.0.27rc1,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.nommx => Linux/ELF makefile makefile.nommx => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.26 (gcc, creates libpng10.so.0.1.0.27rc1
does not use Intel MMX assembler code) does not use Intel MMX assembler code)
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
@ -131,12 +131,14 @@ include
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
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, makefile.sggcc => Silicon Graphics (gcc,
creates libpng10.so.0.1.0.26) creates libpng10.so.0.1.0.27rc1)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng10.so.0.1.0.26) creates libpng10.so.0.1.0.27rc1)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
creates libpng10.so.0.1.0.27rc1)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng10.so.0.1.0.26) creates libpng10.so.0.1.0.27rc1)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
@ -216,7 +218,7 @@ which previously was done semi-automatically (if you didn't edit
scripts/makefile.* yourself, that is) scripts/makefile.* yourself, that is)
CFLAGS="-Wall -O3 -funroll-loops \ CFLAGS="-Wall -O -funroll-loops \
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \ -malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include --with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include

View File

@ -1,5 +1,5 @@
Known bugs in libpng version 1.0.26 Known bugs in libpng version 1.0.27rc1
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when 1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
reading interlaced PNG files, when assembler code is enabled but running reading interlaced PNG files, when assembler code is enabled but running
@ -19,10 +19,11 @@ Known bugs in libpng version 1.0.26
libpng12.so => libpng12.so.0.1.2.9betaN libpng12.so => libpng12.so.0.1.2.9betaN
that are generated by the custom makefiles. that are generated by the custom makefiles.
STATUS: For now, system library builders should use the custom makefiles. 4. June 28, 2007: Pnggccrd.c has been reported to be unreliable on
several 64-bit platforms running gcc-3.x. Although it appears to
build properly, it does not always read files correctly.
4. March 2007: Building 1.2.16 with PNG_ASSEMBLER_CODE_SUPPORTED; STATUS: Appears to be a bug in the 64-bit version of gcc-3.4.6.
PNG_MMX_CODE_SUPPORTED results in multiple definitions of png_combine_row, Workarounds are to define PNG_NO_MMX_FILTER_UP|AVG|PAETH (as in
png_do_read_interlace, and png_read_filter_row pngconf.h) or to upgrade gcc to a newer version.
STATUS: Investigating.

View File

@ -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.2.6, August 15, 2004, through 1.0.26, May 15, 2007, are libpng versions 1.2.6, August 15, 2004, through 1.0.27rc1, July 31, 2007, are
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
May 15, 2007 July 31, 2007

View File

@ -109,6 +109,8 @@ libpng.vers: libpng.sym
$(ECHO) 'local: *; };' >> $@.new $(ECHO) 'local: *; };' >> $@.new
mv $@.new $@ mv $@.new $@
test: check
# install the .../include headers as links to the new ones # install the .../include headers as links to the new ones
install-data-hook: install-data-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
@ -123,7 +125,7 @@ install-exec-hook:
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@set -x;\ @set -x;\
cd $(DESTDIR)$(libdir);\ cd $(DESTDIR)$(libdir);\
for ext in a la so; do\ for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\ rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\ if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\ $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
@ -137,7 +139,7 @@ uninstall-hook:
@if test -n "@compatlib@"; then\ @if test -n "@compatlib@"; then\
set -x;\ set -x;\
cd $(DESTDIR)$(libdir);\ cd $(DESTDIR)$(libdir);\
for ext in a la so; do\ for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\ rm -f libpng.$$ext;\
done;\ done;\
fi fi

View File

@ -1259,6 +1259,8 @@ libpng.vers: libpng.sym
$(ECHO) 'local: *; };' >> $@.new $(ECHO) 'local: *; };' >> $@.new
mv $@.new $@ mv $@.new $@
test: check
# install the .../include headers as links to the new ones # install the .../include headers as links to the new ones
install-data-hook: install-data-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
@ -1273,7 +1275,7 @@ install-exec-hook:
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@set -x;\ @set -x;\
cd $(DESTDIR)$(libdir);\ cd $(DESTDIR)$(libdir);\
for ext in a la so; do\ for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\ rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\ if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\ $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
@ -1287,7 +1289,7 @@ uninstall-hook:
@if test -n "@compatlib@"; then\ @if test -n "@compatlib@"; then\
set -x;\ set -x;\
cd $(DESTDIR)$(libdir);\ cd $(DESTDIR)$(libdir);\
for ext in a la so; do\ for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\ rm -f libpng.$$ext;\
done;\ done;\
fi fi

14
README
View File

@ -1,4 +1,4 @@
README for libpng version 1.0.26 - May 15, 2007 (shared library 10.0) README for libpng version 1.0.27rc1 - July 31, 2007 (shared library 10.0)
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.
@ -190,11 +190,11 @@ 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.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng10.so.0.1.0.26) gcc, creates libpng10.so.0.1.0.27rc1)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.26) (gcc, creates libpng10.so.0.1.0.27rc1)
makefile.gcmmx => Linux/ELF makefile makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.26, (gcc, creates libpng10.so.0.1.0.27rc1,
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
@ -216,12 +216,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics makefile.sggcc => Silicon Graphics
(gcc, creates libpng10.so.0.1.0.26) (gcc, creates libpng10.so.0.1.0.27rc1)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng10.so.0.1.0.26) (gcc, creates libpng10.so.0.1.0.27rc1)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng10.so.0.1.0.26) (gcc, creates libpng10.so.0.1.0.27rc1)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc

View File

@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
May 15, 2007 July 31, 2007
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.26 are Y2K compliant. It is my belief that earlier upward through 1.0.27rc1 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

1137
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -18,15 +18,15 @@ AC_PREREQ(2.59)
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng], [1.0.26], [png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng], [1.0.27rc1], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
PNGLIB_VERSION=1.0.26 PNGLIB_VERSION=1.0.27rc1
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=0 PNGLIB_MINOR=0
PNGLIB_RELEASE=26 PNGLIB_RELEASE=27
dnl End of version number stuff dnl End of version number stuff
@ -62,7 +62,7 @@ LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
AC_MSG_CHECKING( AC_MSG_CHECKING(
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE]) [if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include "pnggccrd.c"], [#include "$srcdir/pnggccrd.c"],
[return 0;], [return 0;],
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
LIBPNG_NO_MMX="", LIBPNG_NO_MMX="",

340
contrib/gregbook/COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,12 +1,19 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -23,4 +30,21 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------- ---------------------------------------------------------------------------

View File

@ -0,0 +1,130 @@
# Sample makefile for rpng-win / rpng2-win / wpng using mingw32-gcc and make.
# Greg Roelofs
# Last modified: 2 June 2007
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
#
# Invoke this makefile from a DOS-prompt window via:
#
# make -f Makefile.mingw32
#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are in subdirectories at the same level as the current subdirectory
# (as indicated by the PNGDIR and ZDIR macros below). It makes no assumptions
# at all about the mingw32 installation tree (W32DIR). Edit as appropriate.
#
# Note that the names of the dynamic and static libpng and zlib libraries
# used below may change in later releases of the libraries. This makefile
# builds both statically and dynamically linked executables by default.
# (You need only one set, but for testing it can be handy to have both.)
# macros --------------------------------------------------------------------
#PNGDIR = ../..# for libpng-x.y.z/contrib/gregbook builds
PNGDIR = ../libpng-win32
PNGINC = -I$(PNGDIR)
PNGLIBd = $(PNGDIR)/libpng.dll.a # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
#ZDIR = ../../../zlib-win32# for libpng-x.y.z/contrib/gregbook builds
ZDIR = ../zlib-win32
ZINC = -I$(ZDIR)
ZLIBd = $(ZDIR)/libzdll.a
ZLIBs = $(ZDIR)/libz.a
# change this to be the path where mingw32 installs its stuff:
W32DIR =
#W32DIR = /usr/local/cross-tools/i386-mingw32msvc
W32INC = -I$(W32DIR)/include
W32LIB = $(W32DIR)/lib/libuser32.a $(W32DIR)/lib/libgdi32.a
CC = gcc
#CC = i386-mingw32msvc-gcc # e.g., Linux -> Win32 cross-compilation
LD = $(CC)
RM = rm -f
CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS)
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
LDFLAGS = $(MINGW_LDFLAGS)
O = .o
E = .exe
INCS = $(PNGINC) $(ZINC) $(W32INC)
RLIBSd = $(PNGLIBd) $(ZLIBd) $(W32LIB) -lm
RLIBSs = $(PNGLIBs) $(ZLIBs) $(W32LIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd)
WLIBSs = $(PNGLIBs) $(ZLIBs)
RPNG = rpng-win
RPNG2 = rpng2-win
WPNG = wpng
ROBJSd = $(RPNG)$(O) readpng.pic$(O)
ROBJS2d = $(RPNG2)$(O) readpng2.pic$(O)
WOBJSd = $(WPNG)$(O) writepng.pic$(O)
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
ROBJSs = $(RPNG)$(O) readpng$(O)
ROBJS2s = $(RPNG2)$(O) readpng2$(O)
WOBJSs = $(WPNG)$(O) writepng$(O)
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
# implicit make rules -------------------------------------------------------
.c$(O):
$(CC) -c $(CFLAGS) $<
%.pic$(O): %.c
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
# dependencies --------------------------------------------------------------
all: $(EXES)
$(RPNGs)$(E): $(ROBJSs)
$(LD) $(LDFLAGS) -o $@ $(ROBJSs) $(RLIBSs)
$(RPNG)$(E): $(ROBJSd)
$(LD) $(LDFLAGS) -o $@ $(ROBJSd) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2s)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2s) $(RLIBSs)
$(RPNG2)$(E): $(ROBJS2d)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2d) $(RLIBSd)
$(WPNGs)$(E): $(WOBJSs)
$(LD) $(LDFLAGS) -o $@ $(WOBJSs) $(WLIBSs)
$(WPNG)$(E): $(WOBJSd)
$(LD) $(LDFLAGS) -o $@ $(WOBJSd) $(WLIBSd)
$(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h
$(WPNG)$(O): $(WPNG).c writepng.h
readpng$(O) readpng.pic$(O): readpng.c readpng.h
readpng2$(O) readpng2.pic$(O): readpng2.c readpng2.h
writepng$(O) writepng.pic$(O): writepng.c writepng.h
# maintenance ---------------------------------------------------------------
clean:
$(RM) $(EXES)
$(RM) $(ROBJSs) $(ROBJS2s) $(WOBJSs)
$(RM) $(ROBJSd) $(ROBJS2d) $(WOBJSd)

View File

@ -1,73 +1,92 @@
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make. # Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
# Greg Roelofs # Greg Roelofs
# Last modified: 7 March 2002 # Last modified: 2 June 2007
# #
# The programs built by this makefile are described in the book, # The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends # Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# and family, too. (Not that this is a blatant plug or anything.) # generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
# #
# Invoke this makefile from a shell prompt in the usual way; for example: # Invoke this makefile from a shell prompt in the usual way; for example:
# #
# make -f Makefile.unx # make -f Makefile.unx
# #
# This makefile assumes libpng and zlib have already been built or downloaded # This makefile assumes libpng and zlib have already been built or downloaded
# and are both installed in /usr/local/{include,lib} (as indicated by the # and are installed in /usr/local/{include,lib} or as otherwise indicated by
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of # the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of
# the PNGINC, PNGLIB, ZINC and ZLIB lines. # the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
# #
# This makefile builds statically linked executables (against libpng and zlib, # This makefile builds both dynamically and statically linked executables
# that is), but that can be changed by uncommenting the appropriate PNGLIB and # (against libpng and zlib, that is), but that can be changed by modifying
# ZLIB lines. # the "EXES =" line. (You need only one set, but for testing it can be handy
# to have both.)
# macros -------------------------------------------------------------------- # macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include/libpng12 #PNGDIR = /usr/local/lib
#PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng #PNGINC = -I/usr/local/include/libpng12
PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng #PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
# or: # or:
#PNGINC = -I../libpng PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
#PNGLIB = -L../libpng -lpng #PNGDIR = ../libpng
#PNGLIB = ../libpng/libpng.a PNGINC = -I$(PNGDIR)
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
ZDIR = /usr/local/lib
#ZDIR = /usr/lib64
ZINC = -I/usr/local/include ZINC = -I/usr/local/include
#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib
ZLIB = /usr/local/lib/libz.a # statically linked against zlib ZLIBs = $(ZDIR)/libz.a # statically linked against zlib
#ZINC = -I../zlib # or:
#ZLIB = -L../zlib -lz #ZDIR = ../zlib
#ZLIB = ../zlib/libz.a #ZINC = -I$(ZDIR)
#ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz # -rpath allows in-place testing
#ZLIBs = $(ZDIR)/libz.a
#XINC = -I/usr/include # old-style, stock X distributions #XINC = -I/usr/include # old-style, stock X distributions
#XLIB = -L/usr/lib/X11 -lX11 #XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows) #XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
#XLIB = -L/usr/openwin/lib -lX11 #XLIB = -L/usr/openwin/lib -lX11
XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.) XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
XLIB = -L/usr/X11R6/lib -lX11 XLIB = -L/usr/X11R6/lib -lX11
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
INCS = $(PNGINC) $(ZINC) $(XINC) INCS = $(PNGINC) $(ZINC) $(XINC)
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
WLIBS = $(PNGLIB) $(ZLIB) RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
WLIBSs = $(PNGLIBs) $(ZLIBs)
CC = gcc CC = gcc
LD = gcc LD = gcc
RM = rm -f RM = rm -f
CFLAGS = -O -Wall $(INCS) CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")] # [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used] # [-ansi, -pedantic and -W can also be used]
LDFLAGS = LDFLAGS =
O = .o O = .o
E = E =
RPNG = rpng-x RPNG = rpng-x
RPNG2 = rpng2-x RPNG2 = rpng2-x
WPNG = wpng WPNG = wpng
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
ROBJS = $(RPNG)$(O) readpng$(O) ROBJS = $(RPNG)$(O) readpng$(O)
ROBJS2 = $(RPNG2)$(O) readpng2$(O) ROBJS2 = $(RPNG2)$(O) readpng2$(O)
WOBJS = $(WPNG)$(O) writepng$(O) WOBJS = $(WPNG)$(O) writepng$(O)
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E) STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
# implicit make rules ------------------------------------------------------- # implicit make rules -------------------------------------------------------
@ -80,14 +99,23 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
all: $(EXES) all: $(EXES)
$(RPNGs)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
$(RPNG)$(E): $(ROBJS) $(RPNG)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS) $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
$(RPNG2)$(E): $(ROBJS2) $(RPNG2)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS) $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
$(WPNGs)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
$(WPNG)$(E): $(WOBJS) $(WPNG)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS) $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
$(RPNG)$(O): $(RPNG).c readpng.h $(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h $(RPNG2)$(O): $(RPNG2).c readpng2.h

View File

@ -1,11 +1,12 @@
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE. # Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
# Greg Roelofs # Greg Roelofs
# Last modified: 16 February 1999 # Last modified: 2 June 2007
# #
# The programs built by this makefile are described in the book, # The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
# Associates, 1999). Go buy a copy, eh? Buy some for friends # Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# and family, too. (Not that this is a blatant plug or anything.) # generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
# #
# Invoke this makefile from a DOS prompt window via: # Invoke this makefile from a DOS prompt window via:
# #
@ -53,7 +54,7 @@ CC = cl
LD = link LD = link
RM = del RM = del
CFLAGS = -nologo -O -W3 $(INCS) $(cvars) CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
# [note that -Wall is an MSVC-specific compilation flag ("all warnings on")] # [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
# [see %devstudio%\vc\include\win32.mak for cvars macro definition] # [see %devstudio%\vc\include\win32.mak for cvars macro definition]
O = .obj O = .obj
E = .exe E = .exe

View File

@ -22,7 +22,8 @@ below.
Files: Files:
README this file README this file
LICENSE terms of distribution and reuse (BSD-like) LICENSE terms of distribution and reuse (BSD-like or GNU GPL)
COPYING GNU General Public License (GPL)
Makefile.unx Unix makefile Makefile.unx Unix makefile
Makefile.w32 Windows (MSVC) makefile Makefile.w32 Windows (MSVC) makefile
@ -54,15 +55,15 @@ mation and links to the latest version of the source code, and Chapters
13-15 of the book for detailed discussion of the three programs. 13-15 of the book for detailed discussion of the three programs.
Greg Roelofs Greg Roelofs
newt@pobox.com http://pobox.com/~newt/greg_contact.html
30 June 2001 2 June 2007
BUILD INSTRUCTIONS BUILD INSTRUCTIONS
- Prerequisites (in order of compilation): - Prerequisites (in order of compilation):
- zlib http://www.gzip.org/zlib/ - zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html - libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html - pngbook http://www.libpng.org/pub/png/book/sources.html
@ -150,9 +151,9 @@ BUILD INSTRUCTIONS
To run the programs, they probably first need to be set up as "foreign To run the programs, they probably first need to be set up as "foreign
symbols," with "disk" and "dir" set appropriately: symbols," with "disk" and "dir" set appropriately:
$ rpng == "$disk:[dir]rpng-x.exe" $ rpng == "$disk:[dir]rpng-x.exe"
$ rpng2 == "$disk:[dir]rpng2-x.exe" $ rpng2 == "$disk:[dir]rpng2-x.exe"
$ wpng == "$disk:[dir]wpng.exe" $ wpng == "$disk:[dir]wpng.exe"
All three will print a basic usage screen when run without any command- All three will print a basic usage screen when run without any command-
line arguments; see the book for more details. Note that the options line arguments; see the book for more details. Note that the options
@ -176,7 +177,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
format (.pgm or .ppm) to PNG; for example, format (.pgm or .ppm) to PNG; for example,
wpng -time < toucan.ppm > toucan.png wpng -time < toucan-notrans.ppm > toucan-notrans.png
would convert the specified PPM file (using redirection) to PNG, auto- would convert the specified PPM file (using redirection) to PNG, auto-
matically setting the PNG modification-time chunk. matically setting the PNG modification-time chunk.

View File

@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>

View File

@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef TRUE #ifndef TRUE

View File

@ -4,19 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Changelog: Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
- 1.01: initial public release
- 1.02: added code to skip unused chunks (GR-P)
---------------------------------------------------------------------------
Copyright (c) 1998-2002 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -33,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
@ -56,7 +74,7 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
void readpng2_version_info(void) void readpng2_version_info(void)
{ {
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
(defined(__i386__) || defined(_M_IX86)) && \ (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/* /*
* WARNING: This preprocessor approach means that the following code * WARNING: This preprocessor approach means that the following code
@ -79,7 +97,12 @@ void readpng2_version_info(void)
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING, "with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
png_libpng_ver, compilerID == 1? "MSVC++" : png_libpng_ver, compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown")); (compilerID == 2? "GNU C" : "unknown"));
fprintf(stderr, " Processor %s MMX instructions.\n", fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
#if defined(__x86_64__)
"_64"
#else
"",
#endif
mmxsupport? "supports" : "does not support"); mmxsupport? "supports" : "does not support");
if (mmxsupport > 0) { if (mmxsupport > 0) {
int num_optims = 0; int num_optims = 0;
@ -179,40 +202,38 @@ int readpng2_init(mainprog_info *mainprog_ptr)
return 2; return 2;
} }
/* prepare the reader to ignore all recognized chunks whose data isn't
* going to be used, i.e., all chunks recognized by libpng except for
* IHDR, PLTE, IDAT, IEND, tRNS, bKGD, gAMA, and sRGB : */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* prepare the reader to ignore all recognized chunks whose data won't be
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
{ {
#ifndef HANDLE_CHUNK_NEVER /* These byte strings were copied from png.h. If a future libpng
/* prior to libpng-1.2.5, this macro was internal, so we define it here. */ * version recognizes more chunks, add them to this list. If a
# define HANDLE_CHUNK_NEVER 1 * future version of readpng2.c recognizes more chunks, delete them
#endif * from this list. */
/* these byte strings were copied from png.h. static const png_byte chunks_to_ignore[] = {
* If a future libpng version recognizes more chunks, add them 99, 72, 82, 77, '\0', /* cHRM */
* to this list. If a future version of readpng2.c recognizes 104, 73, 83, 84, '\0', /* hIST */
* more chunks, delete them from this list. */ 105, 67, 67, 80, '\0', /* iCCP */
png_byte png_chunk_types_to_ignore[]= 105, 84, 88, 116, '\0', /* iTXt */
{ 99, 72, 82, 77, '\0', /* cHRM */ 111, 70, 70, 115, '\0', /* oFFs */
104, 73, 83, 84, '\0', /* hIST */ 112, 67, 65, 76, '\0', /* pCAL */
105, 67, 67, 80, '\0', /* iCCP */ 112, 72, 89, 115, '\0', /* pHYs */
105, 84, 88, 116, '\0', /* iTXt */ 115, 66, 73, 84, '\0', /* sBIT */
111, 70, 70, 115, '\0', /* oFFs */ 115, 67, 65, 76, '\0', /* sCAL */
112, 67, 65, 76, '\0', /* pCAL */ 115, 80, 76, 84, '\0', /* sPLT */
115, 67, 65, 76, '\0', /* sCAL */ 115, 84, 69, 82, '\0', /* sTER */
112, 72, 89, 115, '\0', /* pHYs */ 116, 69, 88, 116, '\0', /* tEXt */
115, 66, 73, 84, '\0', /* sBIT */ 116, 73, 77, 69, '\0', /* tIME */
115, 80, 76, 84, '\0', /* sPLT */ 122, 84, 88, 116, '\0' /* zTXt */
116, 69, 88, 116, '\0', /* tEXt */ };
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0'}; /* zTXt */
#define NUM_PNG_CHUNK_TYPES_TO_IGNORE 13
png_set_keep_unknown_chunks(png_ptr, HANDLE_CHUNK_NEVER, png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
png_chunk_types_to_ignore, NUM_PNG_CHUNK_TYPES_TO_IGNORE); chunks_to_ignore, sizeof(chunks_to_ignore)/5);
} }
#endif #endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */
/* instead of doing png_init_io() here, now we set up our callback /* instead of doing png_init_io() here, now we set up our callback
* functions for progressive decoding */ * functions for progressive decoding */
@ -237,7 +258,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
* png_set_asm_flags (png_ptr, flags); * png_set_asm_flags (png_ptr, flags);
*/ */
#if (defined(__i386__) || defined(_M_IX86)) && \ #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/* /*
* WARNING: This preprocessor approach means that the following code * WARNING: This preprocessor approach means that the following code

View File

@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef TRUE #ifndef TRUE
@ -66,7 +90,7 @@ typedef struct _mainprog_info {
int rowbytes; int rowbytes;
int channels; int channels;
int need_bgcolor; int need_bgcolor;
#if (defined(__i386__) || defined(_M_IX86)) #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
int nommxfilters; int nommxfilters;
int nommxcombine; int nommxcombine;
int nommxinterlace; int nommxinterlace;

179
contrib/gregbook/readppm.c Normal file
View File

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------
rpng - simple PNG display program readppm.c
---------------------------------------------------------------------------
This is a special-purpose replacement for readpng.c that allows binary
PPM files to be used in place of PNG images.
---------------------------------------------------------------------------
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of
this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. Redistributions of source code must retain the above copyright
notice, disclaimer, and this list of conditions.
2. Redistributions in binary form must reproduce the above copyright
notice, disclaimer, and this list of conditions in the documenta-
tion and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
This product includes software developed by Greg Roelofs
and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "readpng.h" /* typedefs, common macros, public prototypes */
ulg width, height;
int bit_depth, color_type, channels;
uch *image_data = NULL;
FILE *saved_infile;
void readpng_version_info()
{
fprintf(stderr, " Compiled without libpng, zlib or PBMPLUS/NetPBM.\n");
}
/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */
int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
{
static uch ppmline[256];
int maxval;
saved_infile = infile;
fgets(ppmline, 256, infile);
if (ppmline[0] != 'P' || ppmline[1] != '6') {
fprintf(stderr, "ERROR: not a PPM file\n");
return 1;
}
/* possible color types: P5 = grayscale (0), P6 = RGB (2), P8 = RGBA (6) */
if (ppmline[1] == '6') {
color_type = 2;
channels = 3;
} else if (ppmline[1] == '8') {
color_type = 6;
channels = 4;
} else /* if (ppmline[1] == '5') */ {
color_type = 0;
channels = 1;
}
do {
fgets(ppmline, 256, infile);
} while (ppmline[0] == '#');
sscanf(ppmline, "%lu %lu", &width, &height);
do {
fgets(ppmline, 256, infile);
} while (ppmline[0] == '#');
sscanf(ppmline, "%d", &maxval);
if (maxval != 255) {
fprintf(stderr, "ERROR: maxval = %d\n", maxval);
return 2;
}
bit_depth = 8;
*pWidth = width;
*pHeight = height;
return 0;
}
/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error;
* scales values to 8-bit if necessary */
int readpng_get_bgcolor(uch *red, uch *green, uch *blue)
{
return 1;
}
/* display_exponent == LUT_exponent * CRT_exponent */
uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
{
ulg rowbytes;
/* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,
* transparency chunks to full alpha channel; strip 16-bit-per-sample
* images to 8 bits per sample; and convert grayscale to RGB[A] */
/* GRR WARNING: grayscale needs to be expanded and channels reset! */
*pRowbytes = rowbytes = channels*width;
*pChannels = channels;
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
return NULL;
}
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
/* now we can go ahead and just read the whole image */
fread(image_data, 1L, rowbytes*height, saved_infile);
return image_data;
}
void readpng_cleanup(int free_image_data)
{
if (free_image_data && image_data) {
free(image_data);
image_data = NULL;
}
}

View File

@ -22,16 +22,24 @@
- 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed - 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug command-line parsing bug
- 1.10: enabled "message window"/console (thanks to David Geldreich) - 1.10: enabled "message window"/console (thanks to David Geldreich)
- 2.00: dual-licensed (added GNU GPL)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -48,11 +56,28 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "rpng-win" #define PROGNAME "rpng-win"
#define LONGNAME "Simple PNG Viewer for Windows" #define LONGNAME "Simple PNG Viewer for Windows"
#define VERSION "1.20 of 28 May 2001" #define VERSION "2.00 of 2 June 2007"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -85,10 +110,9 @@ static void rpng_win_cleanup(void);
LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar; static char titlebar[1024];
static char *progname = PROGNAME; static char *progname = PROGNAME;
static char *appname = LONGNAME; static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename; static char *filename;
static FILE *infile; static FILE *infile;
@ -325,9 +349,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
* check for one in the PNG file--if not, the initialized values of 0 * check for one in the PNG file--if not, the initialized values of 0
* (black) will be used */ * (black) will be used */
if (have_bg) if (have_bg) {
sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue); unsigned r, g, b; /* this approach quiets compiler warnings */
else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b);
bg_red = (uch)r;
bg_green = (uch)g;
bg_blue = (uch)b;
} else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
readpng_cleanup(TRUE); readpng_cleanup(TRUE);
fprintf(stderr, PROGNAME fprintf(stderr, PROGNAME
": libpng error while checking for background color\n"); ": libpng error while checking for background color\n");

View File

@ -9,7 +9,7 @@
by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking). by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking).
to do: to do:
- 8-bit support - 8-bit (colormapped) X support
- use %.1023s to simplify truncation of title-bar string? - use %.1023s to simplify truncation of title-bar string?
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
@ -21,18 +21,27 @@
- 1.10: added support for non-default visuals; fixed X pixel-conversion - 1.10: added support for non-default visuals; fixed X pixel-conversion
- 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed - 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed
command-line parsing bug command-line parsing bug
- 1.12: fixed small X memory leak (thanks to Francois Petitjean) - 1.12: fixed some small X memory leaks (thanks to François Petitjean)
- 1.13: fixed XFreeGC() crash bug - 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche)
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
- 2.00: dual-licensed (added GNU GPL)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -49,11 +58,30 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "rpng-x" #define PROGNAME "rpng-x"
#define LONGNAME "Simple PNG Viewer for X" #define LONGNAME "Simple PNG Viewer for X"
#define VERSION "1.13 of 16 August 2001" #define VERSION "2.00 of 2 June 2007"
#define RESNAME "rpng" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -91,6 +119,8 @@ static int rpng_x_msb(ulg u32val);
static char titlebar[1024], *window_name = titlebar; static char titlebar[1024], *window_name = titlebar;
static char *appname = LONGNAME; static char *appname = LONGNAME;
static char *icon_name = PROGNAME; static char *icon_name = PROGNAME;
static char *res_name = RESNAME;
static char *res_class = RESCLASS;
static char *filename; static char *filename;
static FILE *infile; static FILE *infile;
@ -399,11 +429,12 @@ static int rpng_x_create_window(void)
XEvent e; XEvent e;
XGCValues gcvalues; XGCValues gcvalues;
XSetWindowAttributes attr; XSetWindowAttributes attr;
XSizeHints *size_hints;
XTextProperty windowName, *pWindowName = &windowName; XTextProperty windowName, *pWindowName = &windowName;
XTextProperty iconName, *pIconName = &iconName; XTextProperty iconName, *pIconName = &iconName;
XVisualInfo visual_info; XVisualInfo visual_info;
XSizeHints *size_hints;
XWMHints *wm_hints; XWMHints *wm_hints;
XClassHint *class_hints;
screen = DefaultScreen(display); screen = DefaultScreen(display);
@ -526,7 +557,7 @@ static int rpng_x_create_window(void)
if (!XStringListToTextProperty(&icon_name, 1, pIconName)) if (!XStringListToTextProperty(&icon_name, 1, pIconName))
pIconName = NULL; pIconName = NULL;
/* OK if either hints allocation fails; XSetWMProperties() allows NULLs */ /* OK if any hints allocation fails; XSetWMProperties() allows NULLs */
if ((size_hints = XAllocSizeHints()) != NULL) { if ((size_hints = XAllocSizeHints()) != NULL) {
/* window will not be resizable */ /* window will not be resizable */
@ -542,8 +573,13 @@ static int rpng_x_create_window(void)
wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ; wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ;
} }
if ((class_hints = XAllocClassHint()) != NULL) {
class_hints->res_name = res_name;
class_hints->res_class = res_class;
}
XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0, XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
size_hints, wm_hints, NULL); size_hints, wm_hints, class_hints);
/* various properties and hints no longer needed; free memory */ /* various properties and hints no longer needed; free memory */
if (pWindowName) if (pWindowName)
@ -554,6 +590,8 @@ static int rpng_x_create_window(void)
XFree(size_hints); XFree(size_hints);
if (wm_hints) if (wm_hints)
XFree(wm_hints); XFree(wm_hints);
if (class_hints)
XFree(class_hints);
XMapWindow(display, window); XMapWindow(display, window);

View File

@ -27,16 +27,25 @@
- 1.10: enabled "message window"/console (thanks to David Geldreich) - 1.10: enabled "message window"/console (thanks to David Geldreich)
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options - 1.20: added runtime MMX-enabling/disabling and new -mmx* options
- 1.21: made minor tweak to usage screen to fit within 25-line console - 1.21: made minor tweak to usage screen to fit within 25-line console
- 1.22: added AMD64/EM64T support (__x86_64__)
- 2.00: dual-licensed (added GNU GPL)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -53,11 +62,28 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "rpng2-win" #define PROGNAME "rpng2-win"
#define LONGNAME "Progressive PNG Viewer for Windows" #define LONGNAME "Progressive PNG Viewer for Windows"
#define VERSION "1.21 of 29 June 2001" #define VERSION "2.00 of 2 June 2007"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -119,10 +145,9 @@ static void rpng2_win_cleanup(void);
LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar; static char titlebar[1024];
static char *progname = PROGNAME; static char *progname = PROGNAME;
static char *appname = LONGNAME; static char *appname = LONGNAME;
static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename; static char *filename;
static FILE *infile; static FILE *infile;
@ -367,7 +392,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
} }
} else if (!strncmp(*argv, "-timing", 2)) { } else if (!strncmp(*argv, "-timing", 2)) {
timing = TRUE; timing = TRUE;
#if (defined(__i386__) || defined(_M_IX86)) #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
} else if (!strncmp(*argv, "-nommxfilters", 7)) { } else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE; rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) { } else if (!strncmp(*argv, "-nommxcombine", 7)) {
@ -432,7 +457,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
readpng2_version_info(); readpng2_version_info();
fprintf(stderr, "\n" fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n" "Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
#if (defined(__i386__) || defined(_M_IX86)) #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n" " %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
#endif #endif
" %*s file.png\n\n" " %*s file.png\n\n"
@ -447,17 +472,17 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
"\t\t transparent images; overrides -bgcolor option\n" "\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n" " -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n" "\t\t download of image (~36 Kbps)\n"
#if (defined(__i386__) || defined(_M_IX86)) #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n" " -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
"\t\t combining rows, and expanding interlacing, respectively\n" "\t\t combining rows, and expanding interlacing, respectively\n"
#endif #endif
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n" "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
"Press Q or Esc to quit this usage screen. ", "Press Q or Esc to quit this usage screen. ",
PROGNAME, PROGNAME,
#if (defined(__i386__) || defined(_M_IX86)) #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
strlen(PROGNAME), " ", (int)strlen(PROGNAME), " ",
#endif #endif
strlen(PROGNAME), " ", default_display_exponent, num_bgpat); (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
fflush(stderr); fflush(stderr);
do do
ch = _getch(); ch = _getch();

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,10 @@
This program converts certain NetPBM binary files (grayscale and RGB, This program converts certain NetPBM binary files (grayscale and RGB,
maxval = 255) to PNG. Non-interlaced PNGs are written progressively; maxval = 255) to PNG. Non-interlaced PNGs are written progressively;
interlaced PNGs are read and written in one memory-intensive blast. interlaced PNGs are read and written in one memory-intensive blast.
Thanks to Jean-loup Gailly for providing the necessary trick to read Thanks to Jean-loup Gailly for providing the necessary trick to read
interactive text from the keyboard while stdin is redirected. interactive text from the keyboard while stdin is redirected. Thanks
to Cosmin Truta for Cygwin fixes.
NOTE: includes provisional support for PNM type "8" (portable alphamap) NOTE: includes provisional support for PNM type "8" (portable alphamap)
images, presumed to be a 32-bit interleaved RGBA format; no pro- images, presumed to be a 32-bit interleaved RGBA format; no pro-
@ -24,16 +26,32 @@
- 1.02: modified to allow abbreviated options - 1.02: modified to allow abbreviated options
- 1.03: removed extraneous character from usage screen; fixed bug in - 1.03: removed extraneous character from usage screen; fixed bug in
command-line parsing command-line parsing
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
- 2.00: dual-licensed (added GNU GPL)
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
dose not work! In order to do something useful I needed to redirect
both input and output, with cygwin and with bcc32 as well. Under
Linux, the same wpng appears to work fine. I don't know what is
the problem."]
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -50,16 +68,35 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#define PROGNAME "wpng" #define PROGNAME "wpng"
#define VERSION "1.03 of 19 March 2000" #define VERSION "2.00 of 2 June 2007"
#define APPNAME "Simple PGM/PPM/PAM to PNG Converter" #define APPNAME "Simple PGM/PPM/PAM to PNG Converter"
#if defined(__MSDOS__) || defined(__OS2__) #if defined(__MSDOS__) || defined(__OS2__)
# define DOS_OS2_W32 # define DOS_OS2_W32
#elif defined(_WIN32) || defined(__WIN32__) #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define DOS_OS2_W32 # ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */
# define DOS_OS2_W32
# endif
#endif #endif
#include <stdio.h> #include <stdio.h>

View File

@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/

View File

@ -4,13 +4,20 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind, This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors express or implied. In no event shall the author or contributors
be held liable for any damages arising in any way from the use of be held liable for any damages arising in any way from the use of
this software. this software.
The contents of this file are DUAL-LICENSED. You may modify and/or
redistribute this software according to the terms of one of the
following two licenses (at your option):
LICENSE 1 ("BSD-like with advertising clause"):
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions: it freely, subject to the following restrictions:
@ -27,6 +34,23 @@
and contributors for the book, "PNG: The Definitive Guide," and contributors for the book, "PNG: The Definitive Guide,"
published by O'Reilly and Associates. published by O'Reilly and Associates.
LICENSE 2 (GNU GPL v2 or later):
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef TRUE #ifndef TRUE

View File

@ -1,6 +1,6 @@
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.26 - May 15, 2007 libpng version 1.0.27rc1 - July 31, 2007
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2007 Glenn Randers-Pehrson Copyright (c) 1998-2007 Glenn Randers-Pehrson
@ -2766,13 +2766,13 @@ application:
VIII. Y2K Compliance in libpng VIII. Y2K Compliance in libpng
May 15, 2007 July 31, 2007
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.26 are Y2K compliant. It is my belief that earlier upward through 1.0.27rc1 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

View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "May 15, 2007" .TH LIBPNG 3 "July 31, 2007"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.26 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.27rc1
.SH SYNOPSIS .SH SYNOPSIS
\fB \fB
#include <png.h>\fP #include <png.h>\fP
@ -410,7 +410,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.26 - May 15, 2007 libpng version 1.0.27rc1 - July 31, 2007
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2007 Glenn Randers-Pehrson Copyright (c) 1998-2007 Glenn Randers-Pehrson
@ -3176,13 +3176,13 @@ application:
.SH VIII. Y2K Compliance in libpng .SH VIII. Y2K Compliance in libpng
May 15, 2007 July 31, 2007
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.26 are Y2K compliant. It is my belief that earlier upward through 1.0.27rc1 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
@ -3371,6 +3371,9 @@ the first widely used release:
1.2.17 13 10217 12.so.0.17[.0] 1.2.17 13 10217 12.so.0.17[.0]
1.0.26 10 10026 10.so.0.26[.0] 1.0.26 10 10026 10.so.0.26[.0]
1.2.18 13 10218 12.so.0.18[.0] 1.2.18 13 10218 12.so.0.18[.0]
1.2.19beta1-31 13 10219 12.so.0.19[.0]
1.0.27rc1 10 10027 10.so.0.27[.0]
1.2.19rc1 13 10219 12.so.0.19[.0]
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
@ -3383,7 +3386,7 @@ version 1.0.6j; from then on they were given the upcoming public
release number plus "betaNN" or "rcN". release number plus "betaNN" or "rcN".
.SH "SEE ALSO" .SH "SEE ALSO"
libpngpf(3), png(5) .IR libpngpf(3) ", " png(5)
.LP .LP
.IR libpng : .IR libpng :
.IP .IP
@ -3426,7 +3429,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.26 - May 15, 2007: Libpng version 1.0.27rc1 - July 31, 2007:
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 (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -3447,7 +3450,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.2.6, August 15, 2004, through 1.0.26, May 15, 2007, are libpng versions 1.2.6, August 15, 2004, through 1.0.27rc1, July 31, 2007, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -3546,7 +3549,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
May 15, 2007 July 31, 2007
.\" end of man page .\" end of man page

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "May 15, 2007" .TH LIBPNGPF 3 "July 31, 2007"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.26 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.27rc1
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP
@ -269,6 +269,6 @@ are listed alphabetically here as an aid to libpng maintainers.
See png.h for more information on these functions. See png.h for more information on these functions.
.SH SEE ALSO .SH SEE ALSO
libpng(3), png(5) .IR libpng(3) ", " png(5)
.SH AUTHOR .SH AUTHOR
Glenn Randers-Pehrson Glenn Randers-Pehrson

4
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "May 15, 2007" .TH PNG 5 "July 31, 2007"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
platforms. platforms.
.SH "SEE ALSO" .SH "SEE ALSO"
.IR libpng(3), zlib(3), deflate(5), and zlib(5) .IR libpng(3) ", " zlib(3) ", " deflate(5) ", and " zlib(5)
.LP .LP
PNG specification (second edition), November 2003: PNG specification (second edition), November 2003:
.IP .IP

104
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.2.17 May 15, 2007 * Last changed in libpng 1.2.19 July 31, 2007
* 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-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -13,20 +13,20 @@
#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_26 Your_png_h_is_not_version_1_0_26; typedef version_1_0_27rc1 Your_png_h_is_not_version_1_0_27rc1;
/* 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] = PNG_LIBPNG_VER_STRING; PNG_CONST char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
/* 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. */
const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10}; PNG_CONST png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */
/* Invoke global declarations for constant strings for known chunk types */ /* Invoke global declarations for constant strings for known chunk types */
@ -56,32 +56,32 @@ PNG_zTXt;
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */ /* start of interlace block */
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* offset to next interlace block */ /* offset to next interlace block */
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* start of interlace block in the y direction */ /* start of interlace block in the y direction */
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* offset to next interlace block in the y direction */ /* offset to next interlace block in the y direction */
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* width of interlace block (used in assembler routines only) */ /* width of interlace block (used in assembler routines only) */
#ifdef PNG_HAVE_MMX_COMBINE_ROW #if defined(PNG_HAVE_MMX_COMBINE_ROW) || defined(PNG_OPTIMIZED_CODE_SUPPORTED)
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; PNG_CONST int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
#endif #endif
/* Height of interlace block. This is not currently used - if you need /* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h * it, uncomment it here and in png.h
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/ */
/* Mask to determine which pixels are valid in a pass */ /* Mask to determine which pixels are valid in a pass */
const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; PNG_CONST int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
/* Mask to determine which pixels to overwrite while displaying */ /* Mask to determine which pixels to overwrite while displaying */
const int FARDATA png_pass_dsp_mask[] PNG_CONST int FARDATA png_pass_dsp_mask[]
= {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */
@ -134,7 +134,7 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
#if defined(PNG_1_0_X) || defined(PNG_1_2_X) #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
/* (Obsolete) function to check signature bytes. It does not allow one /* (Obsolete) function to check signature bytes. It does not allow one
* to check a partial signature. This function might be removed in the * to check a partial signature. This function might be removed in the
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG. * future - use png_sig_cmp(). Returns true (nonzero) if the file is PNG.
*/ */
int PNGAPI int PNGAPI
png_check_sig(png_bytep sig, int num) png_check_sig(png_bytep sig, int num)
@ -674,7 +674,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
#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", png_snprintf6(near_time_buf,29,"%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);
@ -682,7 +682,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
29*png_sizeof(char)); 29*png_sizeof(char));
} }
#else #else
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000", png_snprintf6(png_ptr->time_buffer,29,"%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);
@ -705,12 +705,11 @@ png_sig_bytes(void)
png_charp PNGAPI png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
return ((png_charp) "\n libpng version 1.0.26 - May 15, 2007\n\ return ((png_charp) "\n libpng version 1.0.27rc1 - July 31, 2007\n\
Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\ Copyright (c) 1998-2007 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");
return ((png_charp) "");
} }
/* The following return the library version as a short string in the /* The following return the library version as a short string in the
@ -725,27 +724,70 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr) 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 */ png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING); return ((png_charp) PNG_LIBPNG_VER_STRING);
return ((png_charp) "");
} }
png_charp PNGAPI png_charp PNGAPI
png_get_header_ver(png_structp png_ptr) png_get_header_ver(png_structp png_ptr)
{ {
/* Version of *.h files used when building libpng */ /* Version of *.h files used when building libpng */
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING); return ((png_charp) PNG_LIBPNG_VER_STRING);
return ((png_charp) "");
} }
png_charp PNGAPI png_charp PNGAPI
png_get_header_version(png_structp png_ptr) png_get_header_version(png_structp png_ptr)
{ {
/* Returns longer string containing both version and date */ /* Returns longer string containing both version and date */
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
return ((png_charp) PNG_HEADER_VERSION_STRING); return ((png_charp) PNG_HEADER_VERSION_STRING
return ((png_charp) ""); #ifdef PNG_READ_SUPPORTED
# ifdef PNG_USE_PNGGCCRD
# ifdef __x86_64__
# ifdef __PIC__
" (PNGGCRD x86_64, PIC)\n"
# else
# ifdef PNG_THREAD_UNSAFE_OK
" (PNGGCRD x86_64, Thread unsafe)\n"
# else
" (PNGGCRD x86_64, Thread safe)\n"
# endif
# endif
# else
# ifdef PNG_THREAD_UNSAFE_OK
" (PNGGCRD, Thread unsafe)\n"
# else
" (PNGGCRD, Thread safe)\n"
# endif
# endif
# else
# ifdef PNG_USE_PNGVCRD
# ifdef __x86_64__
" (x86_64 PNGVCRD)\n"
# else
" (PNGVCRD)\n"
# endif
# else
# ifdef __x86_64__
# ifdef PNG_OPTIMIZED_CODE_SUPPORTED
" (x86_64 OPTIMIZED)\n"
# else
" (x86_64 NOT OPTIMIZED)\n"
# endif
# else
# ifdef PNG_OPTIMIZED_CODE_SUPPORTED
" (OPTIMIZED)\n"
# else
" (NOT OPTIMIZED)\n"
# endif
# endif
# endif
# endif
#else
" (NO READ SUPPORT)\n"
#endif
);
} }
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@ -756,7 +798,7 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
/* check chunk_name and return "keep" value if it's on the list, else 0 */ /* check chunk_name and return "keep" value if it's on the list, else 0 */
int i; int i;
png_bytep p; png_bytep p;
if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0) if(png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0)
return 0; return 0;
p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5; p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5;
for (i = png_ptr->num_chunk_list; i; i--, p-=5) for (i = png_ptr->num_chunk_list; i; i--, p-=5)
@ -843,8 +885,8 @@ png_mmx_support(void)
return -1; return -1;
} }
#endif #endif
#endif /* PNG_1_0_X && PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* PNG_1_0_X */
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED && PNG_ASSEMBLER_CODE_SUPPORTED */
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifdef PNG_SIZE_T #ifdef PNG_SIZE_T

139
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.0.26 - May 15, 2007 * libpng version 1.0.27rc1 - July 31, 2007
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 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 @@
* 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.26 - May 15, 2007: Glenn * libpng versions 0.97, January 1998, through 1.0.27rc1 - July 31, 2007: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -150,6 +150,9 @@
* 1.2.17 13 10217 12.so.0.17[.0] * 1.2.17 13 10217 12.so.0.17[.0]
* 1.0.26 10 10026 10.so.0.26[.0] * 1.0.26 10 10026 10.so.0.26[.0]
* 1.2.18 13 10218 12.so.0.18[.0] * 1.2.18 13 10218 12.so.0.18[.0]
* 1.2.19beta1-31 13 10219 12.so.0.19[.0]
* 1.0.27rc1 10 10027 10.so.0.27[.0]
* 1.2.19rc1 13 10219 12.so.0.19[.0]
* *
* 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
@ -179,7 +182,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.2.6, August 15, 2004, through 1.0.26, May 15, 2007, are * libpng versions 1.2.6, August 15, 2004, through 1.0.27rc1, July 31, 2007, are
* Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -291,13 +294,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* May 15, 2007 * July 31, 2007
* *
* 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.26 are Y2K compliant. It is my belief that earlier * upward through 1.0.27rc1 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
@ -353,9 +356,9 @@
*/ */
/* 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.26" #define PNG_LIBPNG_VER_STRING "1.0.27rc1"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.26 - May 15, 2007 (header)\n" " libpng version 1.0.27rc1 - July 31, 2007\n"
#define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 10 #define PNG_LIBPNG_VER_DLLNUM 10
@ -363,11 +366,11 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 0 #define PNG_LIBPNG_VER_MINOR 0
#define PNG_LIBPNG_VER_RELEASE 26 #define PNG_LIBPNG_VER_RELEASE 27
/* 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 0 #define PNG_LIBPNG_VER_BUILD 1
/* Release Status */ /* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1 #define PNG_LIBPNG_BUILD_ALPHA 1
@ -384,14 +387,14 @@
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
PNG_LIBPNG_BUILD_PRIVATE */ PNG_LIBPNG_BUILD_PRIVATE */
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_RC
/* 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.
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
#define PNG_LIBPNG_VER 10026 /* 1.0.26 */ #define PNG_LIBPNG_VER 10027 /* 1.0.27 */
#ifndef PNG_VERSION_INFO_ONLY #ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */ /* include the compression library's header */
@ -479,7 +482,7 @@ extern "C" {
* the version above. * the version above.
*/ */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const char) png_libpng_ver[18]; PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
/* need room for 99.99.99beta99z */ /* need room for 99.99.99beta99z */
#else #else
#define png_libpng_ver png_get_header_ver(NULL) #define png_libpng_ver png_get_header_ver(NULL)
@ -488,17 +491,17 @@ PNG_EXPORT_VAR (const char) png_libpng_ver[18];
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
/* This was removed in version 1.0.5c */ /* This was removed in version 1.0.5c */
/* Structures to facilitate easy interlacing. See png.c for more details */ /* Structures to facilitate easy interlacing. See png.c for more details */
PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
#ifdef PNG_USE_PNGGCCRD #if defined(PNG_HAVE_MMX_COMBINE_ROW) || defined(PNG_OPTIMIZED_CODE_SUPPORTED)
PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_width[7];
#endif #endif
/* This isn't currently used. If you need it, see png.c for more details. /* This isn't currently used. If you need it, see png.c for more details.
PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7]; PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
*/ */
#endif #endif
@ -1352,7 +1355,7 @@ struct png_struct_def
png_byte filter_type; png_byte filter_type;
#endif #endif
#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)) #if defined(PNG_1_0_X)
/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ /* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
png_uint_32 row_buf_size; png_uint_32 row_buf_size;
#endif #endif
@ -1406,7 +1409,7 @@ struct png_struct_def
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef png_structp version_1_0_26; typedef png_structp version_1_0_27rc1;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@ -2062,13 +2065,17 @@ extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
png_const_charp error_message)); png_const_charp error_message));
#ifndef PNG_NO_WARNINGS
/* Non-fatal error in libpng. Can continue, but may have a problem. */ /* Non-fatal error in libpng. Can continue, but may have a problem. */
extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#ifdef PNG_READ_SUPPORTED
/* Non-fatal error in libpng, chunk name is prepended to message. */ /* Non-fatal error in libpng, chunk name is prepended to message. */
extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_READ_SUPPORTED */
#endif /* PNG_NO_WARNINGS */
/* The png_set_<chunk> functions are for storing values in the png_info_struct. /* The png_set_<chunk> functions are for storing values in the png_info_struct.
* Similarly, the png_get_<chunk> calls are used to read values from the * Similarly, the png_get_<chunk> calls are used to read values from the
@ -2817,7 +2824,7 @@ extern PNG_EXPORT(void,png_save_uint_16)
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
/* place to hold the signature string for a PNG file. */ /* place to hold the signature string for a PNG file. */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
#else #else
#if 0 #if 0
#define png_sig png_sig_bytes(NULL) #define png_sig png_sig_bytes(NULL)
@ -2829,50 +2836,50 @@ extern PNG_EXPORT(void,png_save_uint_16)
* define the name here, and add an invocation of the macro in png.c and * define the name here, and add an invocation of the macro in png.c and
* wherever it's needed. * wherever it's needed.
*/ */
#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} #define PNG_IHDR png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} #define PNG_IDAT png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} #define PNG_IEND png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} #define PNG_PLTE png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} #define PNG_bKGD png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} #define PNG_cHRM png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} #define PNG_gAMA png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} #define PNG_hIST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} #define PNG_iCCP png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} #define PNG_iTXt png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} #define PNG_oFFs png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} #define PNG_pCAL png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} #define PNG_sCAL png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} #define PNG_pHYs png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} #define PNG_sBIT png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} #define PNG_sPLT png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} #define PNG_sRGB png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} #define PNG_tEXt png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} #define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} #define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} #define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
#endif /* PNG_USE_GLOBAL_ARRAYS */ #endif /* PNG_USE_GLOBAL_ARRAYS */
#if defined(PNG_1_0_X) || defined (PNG_1_2_X) #if defined(PNG_1_0_X) || defined (PNG_1_2_X)

161
pngconf.h
View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.0.26 - May 15, 2007 * libpng version 1.0.27rc1 - July 31, 2007
* 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-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -270,6 +270,7 @@
# define PNGARG(arglist) arglist # define PNGARG(arglist) arglist
#endif /* _NO_PROTO */ #endif /* _NO_PROTO */
#endif /* OF */ #endif /* OF */
#endif /* PNGARG */ #endif /* PNGARG */
@ -588,16 +589,16 @@
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
#if !defined(PNG_NO_PROGRESSIVE_READ) && \ #if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
#endif /* about interlacing capability! You'll */ #endif /* about interlacing capability! You'll */
/* still have interlacing unless you change the following line: */ /* still have interlacing unless you change the following line: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
#ifndef PNG_NO_READ_COMPOSITE_NODIV #ifndef PNG_NO_READ_COMPOSITE_NODIV
# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
# endif # endif
#endif #endif
@ -717,35 +718,46 @@
/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
* even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined. * even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined.
* *
* PNG_NO_ASSEMBLER_CODE disables use of all assembler code and optimized C, * PNG_NO_ASSEMBLER_CODE disables use of all assembler code,
* and removes or includes several functions in the API. * and removes several functions from the API.
* *
* PNG_NO_MMX_CODE disables the use of MMX code without changing the API. * PNG_NO_MMX_CODE disables the use of MMX code without changing the API.
* When MMX code is off, then optimized C replacement functions are used. * When MMX code is off, then optimized C replacement functions are used,
* if PNG_NO_OPTIMIZED_CODE is not enabled. This was added in version
* 1.2.19.
*/ */
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
# ifndef PNG_OPTIMIZED_CODE_SUPPORTED
# define PNG_OPTIMIZED_CODE_SUPPORTED
# endif
#endif
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
# ifndef PNG_ASSEMBLER_CODE_SUPPORTED # ifndef PNG_ASSEMBLER_CODE_SUPPORTED
# define PNG_ASSEMBLER_CODE_SUPPORTED # define PNG_ASSEMBLER_CODE_SUPPORTED
# endif # endif
# if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE)
/* work around Intel-Mac compiler bug */ # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
# define PNG_NO_MMX_CODE
# endif
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \
defined(__MMX__)
# define PNG_MMX_CODE_SUPPORTED # define PNG_MMX_CODE_SUPPORTED
# endif # endif
# if !defined(PNG_USE_PNGGCCRD) && !defined(PNG_NO_MMX_CODE) && \
!defined(PNG_USE_PNGVCRD) && defined(__MMX__)
# define PNG_USE_PNGGCCRD
# endif
#endif
/* If you are sure that you don't need thread safety and you are compiling # if !defined(PNG_USE_PNGVCRD) && defined(PNG_MMX_CODE_SUPPORTED) && \
with PNG_USE_PNGCCRD for an MMX application, you can define this for defined(_MSC_VER)
faster execution. See pnggccrd.c. # define PNG_USE_PNGVCRD
#define PNG_THREAD_UNSAFE_OK # endif
*/
# if !defined(PNG_USE_PNGGCCRD) && defined(PNG_MMX_CODE_SUPPORTED) && \
!defined(PNG_USE_PNGVCRD)
# define PNG_USE_PNGGCCRD
/* If you are sure that you don't need thread safety and you are compiling
with PNG_USE_PNGCCRD for an MMX application, you can define this for
faster execution. See pnggccrd.c.
# define PNG_THREAD_UNSAFE_OK
*/
# endif
#endif
#if !defined(PNG_1_0_X) #if !defined(PNG_1_0_X)
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
@ -1404,6 +1416,7 @@ typedef z_stream FAR * png_zstreamp;
# define NOCHECK 0 # define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
# define png_snprintf _fsnprintf /* Added to v 1.2.19 */
# define png_strcpy _fstrcpy # define png_strcpy _fstrcpy
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ # define png_strncpy _fstrncpy /* Added to v 1.2.6 */
# define png_strlen _fstrlen # define png_strlen _fstrlen
@ -1413,6 +1426,27 @@ typedef z_stream FAR * png_zstreamp;
#else /* use the usual functions */ #else /* use the usual functions */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# ifndef PNG_NO_SNPRINTF
# ifdef _MSC_VER
# define png_snprintf _snprintf /* Added to v 1.2.19 */
# define png_snprintf2 _snprintf
# define png_snprintf6 _snprintf
# else
# define png_snprintf snprintf /* Added to v 1.2.19 */
# define png_snprintf2 snprintf
# define png_snprintf6 snprintf
# endif
# else
/* You don't have or don't want to use snprintf(). Caution: Using
* sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from
* Portable OpenSSH). */
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
# endif
# define png_strcpy strcpy # define png_strcpy strcpy
# define png_strncpy strncpy /* Added to v 1.2.6 */ # define png_strncpy strncpy /* Added to v 1.2.6 */
# define png_strlen strlen # define png_strlen strlen
@ -1434,39 +1468,48 @@ typedef z_stream FAR * png_zstreamp;
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */ /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
#if defined(PNG_INTERNAL) #if defined(PNG_INTERNAL)
/* These are the default thresholds before the MMX code kicks in; if either #if defined(PNG_USE_PNGGCCRD) || defined(PNG_USE_PNGVCRD)
* rowbytes or bitdepth is below the threshold, plain C code is used. These /* Platform must be Pentium. Makefile must assemble and load
* can be overridden at runtime via the png_set_mmx_thresholds() call in * pnggccrd.c or pngvcrd.c. MMX will be detected at run time and
* libpng 1.2.0 and later. The values below were chosen by Intel. * used if present.
*/ */
# ifndef PNG_NO_MMX_COMBINE_ROW
#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT # define PNG_HAVE_MMX_COMBINE_ROW
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */ # endif
#endif # ifndef PNG_NO_MMX_READ_INTERLACE
#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT # define PNG_HAVE_MMX_READ_INTERLACE
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */ # endif
#endif # ifndef PNG_NO_MMX_READ_FILTER_ROW
# define PNG_HAVE_MMX_READ_FILTER_ROW
/* Set this in the makefile for VC++ on Pentium, not here. */ # ifndef PNG_NO_MMX_FILTER_SUB
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c . # define PNG_MMX_READ_FILTER_SUB_SUPPORTED
* MMX will be detected at run time and used if present. # endif
*/ # if !(defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4))
#ifdef PNG_USE_PNGVCRD /* work around 64-bit gcc compiler bugs in gcc-3.x */
# define PNG_HAVE_MMX_COMBINE_ROW # ifndef PNG_NO_MMX_FILTER_UP
# define PNG_HAVE_MMX_READ_INTERLACE # define PNG_MMX_READ_FILTER_UP_SUPPORTED
# define PNG_HAVE_MMX_READ_FILTER_ROW # endif
#endif # ifndef PNG_NO_MMX_FILTER_AVG
# define PNG_MMX_READ_FILTER_AVG_SUPPORTED
/* Set this in the makefile for gcc/as on Pentium, not here. */ # endif
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c . # ifndef PNG_NO_MMX_FILTER_PAETH
* MMX will be detected at run time and used if present. # define PNG_MMX_READ_FILTER_PAETH_SUPPORTED
*/ # endif
#ifdef PNG_USE_PNGGCCRD # endif /* !((__x86_64__) && (GNUC < 4)) */
# define PNG_HAVE_MMX_COMBINE_ROW # endif
# define PNG_HAVE_MMX_READ_INTERLACE /* These are the default thresholds before the MMX code kicks in; if either
# define PNG_HAVE_MMX_READ_FILTER_ROW * rowbytes or bitdepth is below the threshold, plain C code is used. These
#endif * can be overridden at runtime via the png_set_mmx_thresholds() call in
/* - see pnggccrd.c for info about what is currently enabled */ * libpng 1.2.0 and later. The values below were chosen by Intel.
*/
# ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
# endif
# ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
# endif
#endif /* PNG_USE_PNGGCCRD || PNG_USE_PNGVCRD */
/* - see pngvcrd.c or pnggccrd.c for info about what is currently enabled */
#endif /* PNG_INTERNAL */ #endif /* PNG_INTERNAL */
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */

View File

@ -1,9 +1,9 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.19 July 31, 2007
* 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-2006 Glenn Randers-Pehrson * Copyright (c) 1998-2007 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.)
* *
@ -20,9 +20,11 @@
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr, png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message)); png_const_charp error_message));
#ifndef PNG_NO_WARNINGS
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_NO_WARNINGS */
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently, * should not be changed. If there is a need to handle errors differently,
@ -76,6 +78,7 @@ png_error(png_structp png_ptr, png_const_charp error_message)
png_default_error(png_ptr, error_message); png_default_error(png_ptr, error_message);
} }
#ifndef PNG_NO_WARNINGS
/* This function is called whenever there is a non-fatal error. This function /* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently, * should not be changed. If there is a need to handle warnings differently,
* you should supply a replacement warning function and use * you should supply a replacement warning function and use
@ -105,6 +108,8 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
else else
png_default_warning(png_ptr, warning_message+offset); png_default_warning(png_ptr, warning_message+offset);
} }
#endif /* PNG_NO_WARNINGS */
/* These utilities are used internally to build an error message that relates /* These utilities are used internally to build an error message that relates
* to the current chunk. The chunk name comes from png_ptr->chunk_name, * to the current chunk. The chunk name comes from png_ptr->chunk_name,
@ -113,7 +118,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
* if the character is invalid. * if the character is invalid.
*/ */
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
const static PNG_CONST char png_digit[16] = { static PNG_CONST char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F' 'A', 'B', 'C', 'D', 'E', 'F'
}; };
@ -151,6 +156,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
} }
} }
#ifdef PNG_READ_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp error_message) png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{ {
@ -164,6 +170,7 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
} }
} }
#ifndef PNG_NO_WARNINGS
void PNGAPI void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
@ -176,6 +183,9 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
} }
#endif /* PNG_NO_WARNINGS */
#endif /* PNG_READ_SUPPORTED */
/* This is the default error handling function. Note that replacements for /* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This * this function MUST NOT RETURN, or the program will likely crash. This
@ -217,7 +227,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
# ifdef USE_FAR_KEYWORD # ifdef USE_FAR_KEYWORD
{ {
jmp_buf jmpbuf; jmp_buf jmpbuf;
png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf)); png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
longjmp(jmpbuf, 1); longjmp(jmpbuf, 1);
} }
# else # else
@ -228,12 +238,11 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
PNG_ABORT(); PNG_ABORT();
#endif #endif
#ifdef PNG_NO_CONSOLE_IO #ifdef PNG_NO_CONSOLE_IO
/* make compiler happy */ ; error_message = error_message; /* make compiler happy */
if (&error_message != NULL)
return;
#endif #endif
} }
#ifndef PNG_NO_WARNINGS
/* This function is called when there is a warning, but the library thinks /* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything * it can continue anyway. Replacement functions don't have to do anything
* here if you don't want them to. In the default configuration, png_ptr is * here if you don't want them to. In the default configuration, png_ptr is
@ -267,14 +276,11 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
# endif # endif
fprintf(stderr, "libpng warning: %s\n", warning_message); fprintf(stderr, "libpng warning: %s\n", warning_message);
#else #else
/* make compiler happy */ ; warning_message = warning_message; /* make compiler happy */
if (warning_message)
return;
#endif #endif
/* make compiler happy */ ; png_ptr = png_ptr; /* make compiler happy */
if (png_ptr)
return;
} }
#endif /* PNG_NO_WARNINGS */
/* This function is called when the application wants to use another method /* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT * of handling errors and warnings. Note that the error function MUST NOT

6006
pnggccrd.c

File diff suppressed because it is too large Load Diff

View File

@ -512,8 +512,11 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes) png_sPLT_tpp spalettes)
{ {
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
{
*spalettes = info_ptr->splt_palettes; *spalettes = info_ptr->splt_palettes;
return ((png_uint_32)info_ptr->splt_palettes_num); return ((png_uint_32)info_ptr->splt_palettes_num);
}
return (0);
} }
#endif #endif
@ -800,8 +803,11 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns) png_unknown_chunkpp unknowns)
{ {
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
{
*unknowns = info_ptr->unknown_chunks; *unknowns = info_ptr->unknown_chunks;
return ((png_uint_32)info_ptr->unknown_chunks_num); return ((png_uint_32)info_ptr->unknown_chunks_num);
}
return (0);
} }
#endif #endif
@ -951,5 +957,6 @@ png_get_user_height_max (png_structp png_ptr)
return (png_ptr? png_ptr->user_height_max : 0); return (png_ptr? png_ptr->user_height_max : 0);
} }
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.2.17 May 15, 2007 * Last changed in libpng 1.2.19 July 31, 2007
* 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-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -137,60 +137,60 @@ void /* PRIVATE */
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IHDR; PNG_CONST PNG_IHDR;
PNG_IDAT; PNG_CONST PNG_IDAT;
PNG_IEND; PNG_CONST PNG_IEND;
PNG_PLTE; PNG_CONST PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
PNG_bKGD; PNG_CONST PNG_bKGD;
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
PNG_cHRM; PNG_CONST PNG_cHRM;
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
PNG_gAMA; PNG_CONST PNG_gAMA;
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
PNG_hIST; PNG_CONST PNG_hIST;
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
PNG_iCCP; PNG_CONST PNG_iCCP;
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
PNG_iTXt; PNG_CONST PNG_iTXt;
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
PNG_oFFs; PNG_CONST PNG_oFFs;
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
PNG_pCAL; PNG_CONST PNG_pCAL;
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
PNG_pHYs; PNG_CONST PNG_pHYs;
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
PNG_sBIT; PNG_CONST PNG_sBIT;
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
PNG_sCAL; PNG_CONST PNG_sCAL;
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
PNG_sRGB; PNG_CONST PNG_sRGB;
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
PNG_sPLT; PNG_CONST PNG_sPLT;
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
PNG_tEXt; PNG_CONST PNG_tEXt;
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
PNG_tIME; PNG_CONST PNG_tIME;
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
PNG_tRNS; PNG_CONST PNG_tRNS;
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
/* First we make sure we have enough data for the 4 byte chunk name /* First we make sure we have enough data for the 4 byte chunk name
@ -660,7 +660,7 @@ void /* PRIVATE */
png_push_read_IDAT(png_structp png_ptr) png_push_read_IDAT(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IDAT; PNG_CONST PNG_IDAT;
#endif #endif
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
{ {
@ -990,25 +990,25 @@ png_read_push_finish_row(png_structp png_ptr)
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */ /* start of interlace block */
const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* offset to next interlace block */ /* offset to next interlace block */
const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* start of interlace block in the y direction */ /* start of interlace block in the y direction */
const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* offset to next interlace block in the y direction */ /* offset to next interlace block in the y direction */
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* Width of interlace block. This is not currently used - if you need /* Width of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h * it, uncomment it here and in png.h
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; PNG_CONST int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
*/ */
/* Height of interlace block. This is not currently used - if you need /* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h * it, uncomment it here and in png.h
const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/ */
#endif #endif
@ -1062,8 +1062,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
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))
{ {
png_error(png_ptr, "Out of place tEXt"); png_error(png_ptr, "Out of place tEXt");
/* to quiet some compiler warnings */ info_ptr = info_ptr; /* to quiet some compiler warnings */
if(info_ptr == NULL) return;
} }
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
@ -1159,8 +1158,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
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))
{ {
png_error(png_ptr, "Out of place zTXt"); png_error(png_ptr, "Out of place zTXt");
/* to quiet some compiler warnings */ info_ptr = info_ptr; /* to quiet some compiler warnings */
if(info_ptr == NULL) return;
} }
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
@ -1352,8 +1350,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
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))
{ {
png_error(png_ptr, "Out of place iTXt"); png_error(png_ptr, "Out of place iTXt");
/* to quiet some compiler warnings */ info_ptr = info_ptr; /* to quiet some compiler warnings */
if(info_ptr == NULL) return;
} }
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
@ -1480,9 +1477,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif #endif
png_chunk_error(png_ptr, "unknown critical chunk"); png_chunk_error(png_ptr, "unknown critical chunk");
/* to quiet compiler warnings about unused info_ptr */ info_ptr = info_ptr; /* to quiet some compiler warnings */
if (info_ptr == NULL)
return;
} }
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
@ -1496,8 +1491,9 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length = (png_uint_32)65535L; length = (png_uint_32)65535L;
} }
#endif #endif
png_strcpy((png_charp)png_ptr->unknown_chunk.name, png_strncpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name); (png_charp)png_ptr->chunk_name,
png_sizeof((png_charp)png_ptr->chunk_name));
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
png_ptr->unknown_chunk.size = (png_size_t)length; png_ptr->unknown_chunk.size = (png_size_t)length;
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
@ -1559,7 +1555,7 @@ png_progressive_combine_row (png_structp png_ptr,
png_bytep old_row, png_bytep new_row) png_bytep old_row, png_bytep new_row)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
const int FARDATA png_pass_dsp_mask[7] = PNG_CONST int FARDATA png_pass_dsp_mask[7] =
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif #endif
if(png_ptr == NULL) return; if(png_ptr == NULL) return;

109
pngread.c
View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.2.15 January 5, 2007 * Last changed in libpng 1.2.19 July 31, 2007
* 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-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -117,11 +117,13 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
char msg[80]; char msg[80];
if (user_png_ver) if (user_png_ver)
{ {
sprintf(msg, "Application was compiled with png.h from libpng-%.20s", png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver); user_png_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
sprintf(msg, "Application is running with png.c from libpng-%.20s", png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver); png_libpng_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
#endif #endif
@ -197,11 +199,13 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->warning_fn=NULL; png_ptr->warning_fn=NULL;
if (user_png_ver) if (user_png_ver)
{ {
sprintf(msg, "Application was compiled with png.h from libpng-%.20s", png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver); user_png_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
sprintf(msg, "Application is running with png.c from libpng-%.20s", png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver); png_libpng_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
@ -346,60 +350,60 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
for(;;) for(;;)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IHDR; PNG_CONST PNG_IHDR;
PNG_IDAT; PNG_CONST PNG_IDAT;
PNG_IEND; PNG_CONST PNG_IEND;
PNG_PLTE; PNG_CONST PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
PNG_bKGD; PNG_CONST PNG_bKGD;
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
PNG_cHRM; PNG_CONST PNG_cHRM;
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
PNG_gAMA; PNG_CONST PNG_gAMA;
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
PNG_hIST; PNG_CONST PNG_hIST;
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
PNG_iCCP; PNG_CONST PNG_iCCP;
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
PNG_iTXt; PNG_CONST PNG_iTXt;
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
PNG_oFFs; PNG_CONST PNG_oFFs;
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
PNG_pCAL; PNG_CONST PNG_pCAL;
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
PNG_pHYs; PNG_CONST PNG_pHYs;
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
PNG_sBIT; PNG_CONST PNG_sBIT;
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
PNG_sCAL; PNG_CONST PNG_sCAL;
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
PNG_sPLT; PNG_CONST PNG_sPLT;
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
PNG_sRGB; PNG_CONST PNG_sRGB;
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
PNG_tEXt; PNG_CONST PNG_tEXt;
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
PNG_tIME; PNG_CONST PNG_tIME;
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
PNG_tRNS; PNG_CONST PNG_tRNS;
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
png_byte chunk_length[4]; png_byte chunk_length[4];
@ -567,9 +571,10 @@ void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IDAT; PNG_CONST PNG_IDAT;
const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; 0xff};
PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
#endif #endif
int ret; int ret;
if(png_ptr == NULL) return; if(png_ptr == NULL) return;
@ -925,60 +930,60 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
do do
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IHDR; PNG_CONST PNG_IHDR;
PNG_IDAT; PNG_CONST PNG_IDAT;
PNG_IEND; PNG_CONST PNG_IEND;
PNG_PLTE; PNG_CONST PNG_PLTE;
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
PNG_bKGD; PNG_CONST PNG_bKGD;
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
PNG_cHRM; PNG_CONST PNG_cHRM;
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
PNG_gAMA; PNG_CONST PNG_gAMA;
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
PNG_hIST; PNG_CONST PNG_hIST;
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
PNG_iCCP; PNG_CONST PNG_iCCP;
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
PNG_iTXt; PNG_CONST PNG_iTXt;
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
PNG_oFFs; PNG_CONST PNG_oFFs;
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
PNG_pCAL; PNG_CONST PNG_pCAL;
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
PNG_pHYs; PNG_CONST PNG_pHYs;
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
PNG_sBIT; PNG_CONST PNG_sBIT;
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
PNG_sCAL; PNG_CONST PNG_sCAL;
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
PNG_sPLT; PNG_CONST PNG_sPLT;
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
PNG_sRGB; PNG_CONST PNG_sRGB;
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
PNG_tEXt; PNG_CONST PNG_tEXt;
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
PNG_tIME; PNG_CONST PNG_tIME;
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
PNG_tRNS; PNG_CONST PNG_tRNS;
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
@ -1464,8 +1469,8 @@ 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 == NULL) transforms = transforms; /* quiet compiler warnings */
/* quiet compiler warnings */ return; params = params;
} }
#endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_INFO_IMAGE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.2.15 January 5, 2007 * Last changed in libpng 1.2.19 July 31, 2007
* 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-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -1244,20 +1244,19 @@ void /* PRIVATE */
png_do_read_transformations(png_structp png_ptr) png_do_read_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_do_read_transformations\n"); png_debug(1, "in png_do_read_transformations\n");
#if !defined(PNG_USELESS_TESTS_SUPPORTED)
if (png_ptr->row_buf == NULL) if (png_ptr->row_buf == NULL)
{ {
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
char msg[50]; char msg[50];
sprintf(msg, "NULL row buffer for row %ld, pass %d", png_ptr->row_number, png_snprintf2(msg, 50,
"NULL row buffer for row %ld, pass %d", png_ptr->row_number,
png_ptr->pass); png_ptr->pass);
png_error(png_ptr, msg); png_error(png_ptr, msg);
#else #else
png_error(png_ptr, "NULL row buffer"); png_error(png_ptr, "NULL row buffer");
#endif #endif
} }
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED) #if defined(PNG_READ_EXPAND_SUPPORTED)
if (png_ptr->transformations & PNG_EXPAND) if (png_ptr->transformations & PNG_EXPAND)
@ -1269,7 +1268,8 @@ png_do_read_transformations(png_structp png_ptr)
} }
else else
{ {
if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS)) if (png_ptr->num_trans &&
(png_ptr->transformations & PNG_EXPAND_tRNS))
png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->trans_values)); &(png_ptr->trans_values));
else else
@ -1293,9 +1293,11 @@ png_do_read_transformations(png_structp png_ptr)
if(rgb_error) if(rgb_error)
{ {
png_ptr->rgb_to_gray_status=1; png_ptr->rgb_to_gray_status=1;
if(png_ptr->transformations & PNG_RGB_TO_GRAY_WARN) if((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
PNG_RGB_TO_GRAY_WARN)
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel"); png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
if(png_ptr->transformations & PNG_RGB_TO_GRAY_ERR) if((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
PNG_RGB_TO_GRAY_ERR)
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
} }
} }
@ -3699,7 +3701,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
{ {
case 1: case 1:
{ {
gray = (png_uint_16)(gray*0xff); gray = (png_uint_16)((gray&0x01)*0xff);
sp = row + (png_size_t)((row_width - 1) >> 3); sp = row + (png_size_t)((row_width - 1) >> 3);
dp = row + (png_size_t)row_width - 1; dp = row + (png_size_t)row_width - 1;
shift = 7 - (int)((row_width + 7) & 0x07); shift = 7 - (int)((row_width + 7) & 0x07);
@ -3723,7 +3725,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
} }
case 2: case 2:
{ {
gray = (png_uint_16)(gray*0x55); gray = (png_uint_16)((gray&0x03)*0x55);
sp = row + (png_size_t)((row_width - 1) >> 2); sp = row + (png_size_t)((row_width - 1) >> 2);
dp = row + (png_size_t)row_width - 1; dp = row + (png_size_t)row_width - 1;
shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
@ -3746,7 +3748,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
} }
case 4: case 4:
{ {
gray = (png_uint_16)(gray*0x11); gray = (png_uint_16)((gray&0x0f)*0x11);
sp = row + (png_size_t)((row_width - 1) >> 1); sp = row + (png_size_t)((row_width - 1) >> 1);
dp = row + (png_size_t)row_width - 1; dp = row + (png_size_t)row_width - 1;
shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
@ -3776,6 +3778,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
gray = gray & 0xff;
sp = row + (png_size_t)row_width - 1; sp = row + (png_size_t)row_width - 1;
dp = row + (png_size_t)(row_width << 1) - 1; dp = row + (png_size_t)(row_width << 1) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
@ -3789,12 +3792,13 @@ png_do_expand(png_row_infop row_info, png_bytep row,
} }
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
png_byte gray_high = (gray >> 8) & 0xff;
png_byte gray_low = gray & 0xff;
sp = row + row_info->rowbytes - 1; sp = row + row_info->rowbytes - 1;
dp = row + (row_info->rowbytes << 1) - 1; dp = row + (row_info->rowbytes << 1) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
if (((png_uint_16)*(sp) | if (*(sp-1) == gray_high && *(sp) == gray_low)
((png_uint_16)*(sp - 1) << 8)) == gray)
{ {
*dp-- = 0; *dp-- = 0;
*dp-- = 0; *dp-- = 0;
@ -3819,13 +3823,14 @@ png_do_expand(png_row_infop row_info, png_bytep row,
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
png_byte red = trans_value->red & 0xff;
png_byte green = trans_value->green & 0xff;
png_byte blue = trans_value->blue & 0xff;
sp = row + (png_size_t)row_info->rowbytes - 1; sp = row + (png_size_t)row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 2) - 1; dp = row + (png_size_t)(row_width << 2) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
if (*(sp - 2) == trans_value->red && if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
*(sp - 1) == trans_value->green &&
*(sp - 0) == trans_value->blue)
*dp-- = 0; *dp-- = 0;
else else
*dp-- = 0xff; *dp-- = 0xff;
@ -3836,16 +3841,22 @@ png_do_expand(png_row_infop row_info, png_bytep row,
} }
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
png_byte red_high = (trans_value->red > 8) & 0xff;
png_byte green_high = (trans_value->green > 8) & 0xff;
png_byte blue_high = (trans_value->blue > 8) & 0xff;
png_byte red_low = trans_value->red & 0xff;
png_byte green_low = trans_value->green & 0xff;
png_byte blue_low = trans_value->blue & 0xff;
sp = row + row_info->rowbytes - 1; sp = row + row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 3) - 1; dp = row + (png_size_t)(row_width << 3) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
if ((((png_uint_16)*(sp - 4) | if (*(sp - 5) == red_high &&
((png_uint_16)*(sp - 5) << 8)) == trans_value->red) && *(sp - 4) == red_low &&
(((png_uint_16)*(sp - 2) | *(sp - 3) == green_high &&
((png_uint_16)*(sp - 3) << 8)) == trans_value->green) && *(sp - 2) == green_low &&
(((png_uint_16)*(sp - 0) | *(sp - 1) == blue_high &&
((png_uint_16)*(sp - 1) << 8)) == trans_value->blue)) *(sp ) == blue_low)
{ {
*dp-- = 0; *dp-- = 0;
*dp-- = 0; *dp-- = 0;
@ -3965,7 +3976,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED)
const static int png_gamma_shift[] = static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00}; {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit

1153
pngrutil.c

File diff suppressed because it is too large Load Diff

View File

@ -353,7 +353,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
/* check for potential overflow */ /* check for potential overflow */
if ( width > (PNG_UINT_32_MAX if (width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RGBA pixels */ >> 3) /* 8-byte RGBA pixels */
- 64 /* bigrowbuf hack */ - 64 /* bigrowbuf hack */
- 1 /* filter byte */ - 1 /* filter byte */
@ -484,7 +484,8 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_width == NULL) if (info_ptr->scal_s_width == NULL)
{ {
png_warning(png_ptr, "Memory allocation failed while processing sCAL."); png_warning(png_ptr,
"Memory allocation failed while processing sCAL.");
} }
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
@ -494,7 +495,8 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
if (info_ptr->scal_s_height == NULL) if (info_ptr->scal_s_height == NULL)
{ {
png_free (png_ptr, info_ptr->scal_s_width); png_free (png_ptr, info_ptr->scal_s_width);
png_warning(png_ptr, "Memory allocation failed while processing sCAL."); png_warning(png_ptr,
"Memory allocation failed while processing sCAL.");
} }
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
@ -688,7 +690,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_warning(png_ptr, "Insufficient memory to process iCCP chunk."); png_warning(png_ptr, "Insufficient memory to process iCCP chunk.");
return; return;
} }
png_strcpy(new_iccp_name, name); png_strncpy(new_iccp_name, name, png_sizeof(new_iccp_name));
new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen);
if (new_iccp_profile == NULL) if (new_iccp_profile == NULL)
{ {
@ -973,15 +975,27 @@ png_set_sPLT(png_structp png_ptr,
png_sPLT_tp to = np + info_ptr->splt_palettes_num + i; png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
png_sPLT_tp from = entries + i; png_sPLT_tp from = entries + i;
to->name = (png_charp)png_malloc(png_ptr, to->name = (png_charp)png_malloc_warn(png_ptr,
png_strlen(from->name) + 1); png_strlen(from->name) + 1);
if (to->name == NULL)
{
png_warning(png_ptr,
"Out of memory while processing sPLT chunk");
}
/* TODO: use png_malloc_warn */ /* TODO: use png_malloc_warn */
png_strcpy(to->name, from->name); png_strncpy(to->name, from->name, png_strlen(from->name));
to->entries = (png_sPLT_entryp)png_malloc(png_ptr, to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
from->nentries * png_sizeof(png_sPLT_entry)); from->nentries * png_sizeof(png_sPLT_entry));
/* TODO: use png_malloc_warn */ /* TODO: use png_malloc_warn */
png_memcpy(to->entries, from->entries, png_memcpy(to->entries, from->entries,
from->nentries * png_sizeof(png_sPLT_entry)); from->nentries * png_sizeof(png_sPLT_entry));
if (to->entries == NULL)
{
png_warning(png_ptr,
"Out of memory while processing sPLT chunk");
png_free(png_ptr,to->name);
to->name = NULL;
}
to->nentries = from->nentries; to->nentries = from->nentries;
to->depth = from->depth; to->depth = from->depth;
} }
@ -1011,7 +1025,8 @@ png_set_unknown_chunks(png_structp png_ptr,
png_sizeof(png_unknown_chunk)); png_sizeof(png_unknown_chunk));
if (np == NULL) if (np == NULL)
{ {
png_warning(png_ptr, "Out of memory while processing unknown chunk."); png_warning(png_ptr,
"Out of memory while processing unknown chunk.");
return; return;
} }
@ -1029,7 +1044,8 @@ png_set_unknown_chunks(png_structp png_ptr,
to->data = (png_bytep)png_malloc_warn(png_ptr, from->size); to->data = (png_bytep)png_malloc_warn(png_ptr, from->size);
if (to->data == NULL) if (to->data == NULL)
{ {
png_warning(png_ptr, "Out of memory processing unknown chunk."); png_warning(png_ptr,
"Out of memory while processing unknown chunk.");
} }
else else
{ {

View File

@ -434,8 +434,9 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
} }
} }
#endif /* USE_FAR_KEYWORD */ #endif /* USE_FAR_KEYWORD */
#endif /* PNG_NO_STDIO */
/* END of code to validate stdio-free compilation */
/* This function is called when there is a warning, but the library thinks /* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything * it can continue anyway. Replacement functions don't have to do anything
@ -463,8 +464,6 @@ pngtest_error(png_structp png_ptr, png_const_charp message)
/* We can return because png_error calls the default handler, which is /* We can return because png_error calls the default handler, which is
* actually OK in this case. */ * actually OK in this case. */
} }
#endif /* PNG_NO_STDIO */
/* END of code to validate stdio-free compilation */
/* START of code to validate memory allocation and deallocation */ /* START of code to validate memory allocation and deallocation */
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
@ -658,10 +657,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL, read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL); png_error_ptr_NULL, png_error_ptr_NULL);
#endif #endif
#if defined(PNG_NO_STDIO)
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error, png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning); pngtest_warning);
#endif
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL, write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
@ -671,10 +668,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL, write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL); png_error_ptr_NULL, png_error_ptr_NULL);
#endif #endif
#if defined(PNG_NO_STDIO)
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error, png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning); pngtest_warning);
#endif
#endif #endif
png_debug(0, "Allocating read_info, write_info and end_info structures\n"); png_debug(0, "Allocating read_info, write_info and end_info structures\n");
read_info_ptr = png_create_info_struct(read_ptr); read_info_ptr = png_create_info_struct(read_ptr);
@ -1007,10 +1002,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_set_tIME(write_ptr, write_info_ptr, mod_time); png_set_tIME(write_ptr, write_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
/* we have to use png_strcpy instead of "=" because the string /* we have to use png_strncpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */ we use it */
png_strcpy(tIME_string,png_convert_to_rfc1123(read_ptr, mod_time)); png_strncpy(tIME_string,png_convert_to_rfc1123(read_ptr,
mod_time),30);
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */
} }
@ -1147,10 +1143,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_set_tIME(write_ptr, write_end_info_ptr, mod_time); png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
/* we have to use png_strcpy instead of "=" because the string /* we have to use png_strncpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */ we use it */
png_strcpy(tIME_string,png_convert_to_rfc1123(read_ptr, mod_time)); png_strncpy(tIME_string,png_convert_to_rfc1123(read_ptr,
mod_time),30);
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */
} }
@ -1551,4 +1548,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_26 your_png_h_is_not_version_1_0_26; typedef version_1_0_27rc1 your_png_h_is_not_version_1_0_27rc1;

View File

@ -1,9 +1,9 @@
/* 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)
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.17 May 15, 2007
* 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-2006 Glenn Randers-Pehrson * Copyright (c) 1998-2007 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.)
*/ */
@ -252,7 +252,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
#endif #endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
const static PNG_CONST png_byte onebppswaptable[256] = { static PNG_CONST png_byte onebppswaptable[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
@ -287,7 +287,7 @@ const static PNG_CONST png_byte onebppswaptable[256] = {
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
}; };
const static PNG_CONST png_byte twobppswaptable[256] = { static PNG_CONST png_byte twobppswaptable[256] = {
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
@ -322,7 +322,7 @@ const static PNG_CONST png_byte twobppswaptable[256] = {
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
}; };
const static PNG_CONST png_byte fourbppswaptable[256] = { static PNG_CONST png_byte fourbppswaptable[256] = {
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,

1221
pngvcrd.c

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.13 November 13, 2006
* 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-2002 Glenn Randers-Pehrson * Copyright (c) 1998-2006 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.)
* *

View File

@ -517,11 +517,13 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
char msg[80]; char msg[80];
if (user_png_ver) if (user_png_ver)
{ {
sprintf(msg, "Application was compiled with png.h from libpng-%.20s", png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver); user_png_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
sprintf(msg, "Application is running with png.c from libpng-%.20s", png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver); png_libpng_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
#endif #endif
@ -587,11 +589,13 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->warning_fn=NULL; png_ptr->warning_fn=NULL;
if (user_png_ver) if (user_png_ver)
{ {
sprintf(msg, "Application was compiled with png.h from libpng-%.20s", png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver); user_png_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
sprintf(msg, "Application is running with png.c from libpng-%.20s", png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver); png_libpng_ver);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
@ -1137,15 +1141,26 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{ {
switch (filters & (PNG_ALL_FILTERS | 0x07)) switch (filters & (PNG_ALL_FILTERS | 0x07))
{ {
#ifndef PNG_NO_WRITE_FILTER
case 5: case 5:
case 6: case 6:
case 7: png_warning(png_ptr, "Unknown row filter for method 0"); case 7: png_warning(png_ptr, "Unknown row filter for method 0");
case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break; #endif /* PNG_NO_WRITE_FILTER */
case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break; case PNG_FILTER_VALUE_NONE:
case PNG_FILTER_VALUE_UP: png_ptr->do_filter=PNG_FILTER_UP; break; png_ptr->do_filter=PNG_FILTER_NONE; break;
case PNG_FILTER_VALUE_AVG: png_ptr->do_filter=PNG_FILTER_AVG; break; #ifndef PNG_NO_WRITE_FILTER
case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter=PNG_FILTER_PAETH;break; case PNG_FILTER_VALUE_SUB:
png_ptr->do_filter=PNG_FILTER_SUB; break;
case PNG_FILTER_VALUE_UP:
png_ptr->do_filter=PNG_FILTER_UP; break;
case PNG_FILTER_VALUE_AVG:
png_ptr->do_filter=PNG_FILTER_AVG; break;
case PNG_FILTER_VALUE_PAETH:
png_ptr->do_filter=PNG_FILTER_PAETH; break;
default: png_ptr->do_filter = (png_byte)filters; break; default: png_ptr->do_filter = (png_byte)filters; break;
#else
default: png_warning(png_ptr, "Unknown row filter for method 0");
#endif /* PNG_NO_WRITE_FILTER */
} }
/* If we have allocated the row_buf, this means we have already started /* If we have allocated the row_buf, this means we have already started
@ -1159,6 +1174,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
*/ */
if (png_ptr->row_buf != NULL) if (png_ptr->row_buf != NULL)
{ {
#ifndef PNG_NO_WRITE_FILTER
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
{ {
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
@ -1213,6 +1229,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
} }
if (png_ptr->do_filter == PNG_NO_FILTERS) if (png_ptr->do_filter == PNG_NO_FILTERS)
#endif /* PNG_NO_WRITE_FILTER */
png_ptr->do_filter = PNG_FILTER_NONE; png_ptr->do_filter = PNG_FILTER_NONE;
} }
} }
@ -1511,8 +1528,8 @@ 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 == NULL) transforms = transforms; /* quiet compiler warnings */
/* quiet compiler warnings */ return; params = params;
} }
#endif #endif
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */

View File

@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.2.15 January 5, 2007 * Last changed in libpng 1.2.19 July 31, 2007
* 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-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -182,7 +182,7 @@ png_text_compress(png_structp png_ptr,
{ {
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
char msg[50]; char msg[50];
sprintf(msg, "Unknown compression type %d", compression); png_snprintf(msg, 50, "Unknown compression type %d", compression);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
#else #else
png_warning(png_ptr, "Unknown compression type"); png_warning(png_ptr, "Unknown compression type");
@ -578,7 +578,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_ptr->num_palette = (png_uint_16)num_pal; png_ptr->num_palette = (png_uint_16)num_pal;
png_debug1(3, "num_palette = %d\n", png_ptr->num_palette); png_debug1(3, "num_palette = %d\n", png_ptr->num_palette);
png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, num_pal * 3); png_write_chunk_start(png_ptr, png_PLTE, num_pal * 3);
#ifndef PNG_NO_POINTER_INDEXING #ifndef PNG_NO_POINTER_INDEXING
for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
{ {
@ -783,7 +783,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
PNG_COMPRESSION_TYPE_BASE, &comp); PNG_COMPRESSION_TYPE_BASE, &comp);
/* make sure we include the NULL after the name and the compression type */ /* make sure we include the NULL after the name and the compression type */
png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, png_write_chunk_start(png_ptr, png_iCCP,
(png_uint_32)name_len+profile_len+2); (png_uint_32)name_len+profile_len+2);
new_name[name_len+1]=0x00; new_name[name_len+1]=0x00;
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 2); png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 2);
@ -823,7 +823,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
} }
/* make sure we include the NULL after the name */ /* make sure we include the NULL after the name */
png_write_chunk_start(png_ptr, (png_bytep)png_sPLT, png_write_chunk_start(png_ptr, png_sPLT,
(png_uint_32)(name_len + 2 + palette_size)); (png_uint_32)(name_len + 2 + palette_size));
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1); png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1);
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1); png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1);
@ -1180,7 +1180,7 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
return; return;
} }
png_write_chunk_start(png_ptr, (png_bytep)png_hIST, (png_uint_32)(num_hist * 2)); png_write_chunk_start(png_ptr, png_hIST, (png_uint_32)(num_hist * 2));
for (i = 0; i < num_hist; i++) for (i = 0; i < num_hist; i++)
{ {
png_save_uint_16(buf, hist[i]); png_save_uint_16(buf, hist[i]);
@ -1231,12 +1231,14 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
/* 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++)
{ {
if (*kp < 0x20 || (*kp > 0x7E && (png_byte)*kp < 0xA1)) if ((png_byte)*kp < 0x20 ||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
{ {
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
char msg[40]; char msg[40];
sprintf(msg, "invalid keyword character 0x%02X", *kp); png_snprintf(msg, 40,
"invalid keyword character 0x%02X", (png_byte)*kp);
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
#else #else
png_warning(png_ptr, "invalid character in keyword"); png_warning(png_ptr, "invalid character in keyword");
@ -1397,8 +1399,6 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
text_len = png_strlen(text); text_len = png_strlen(text);
png_free(png_ptr, new_key);
/* compute the compressed data; do it now for the length */ /* compute the compressed data; do it now for the length */
text_len = png_text_compress(png_ptr, text, text_len, compression, text_len = png_text_compress(png_ptr, text, text_len, compression,
&comp); &comp);
@ -1407,7 +1407,9 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32) png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32)
(key_len+text_len+2)); (key_len+text_len+2));
/* write key */ /* write key */
png_write_chunk_data(png_ptr, (png_bytep)key, key_len + 1); png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1);
png_free(png_ptr, new_key);
buf[0] = (png_byte)compression; buf[0] = (png_byte)compression;
/* write compression */ /* write compression */
png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1); png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1);
@ -1527,10 +1529,9 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
png_save_int_32(buf + 4, y_offset); png_save_int_32(buf + 4, y_offset);
buf[8] = (png_byte)unit_type; buf[8] = (png_byte)unit_type;
png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9); png_write_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
} }
#endif #endif
#if defined(PNG_WRITE_pCAL_SUPPORTED) #if defined(PNG_WRITE_pCAL_SUPPORTED)
/* write the pCAL chunk (described in the PNG extensions document) */ /* write the pCAL chunk (described in the PNG extensions document) */
void /* PRIVATE */ void /* PRIVATE */
@ -1569,7 +1570,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
} }
png_debug1(3, "pCAL total length = %d\n", (int)total_len); png_debug1(3, "pCAL total length = %d\n", (int)total_len);
png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len); png_write_chunk_start(png_ptr, png_pCAL, (png_uint_32)total_len);
png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len); png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len);
png_save_int_32(buf, X0); png_save_int_32(buf, X0);
png_save_int_32(buf + 4, X1); png_save_int_32(buf + 4, X1);
@ -1622,14 +1623,14 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
total_len += wc_len; total_len += wc_len;
} }
#else #else
sprintf(buf + 1, "%12.12e", width); png_snprintf(buf + 1, 63, "%12.12e", width);
total_len = 1 + png_strlen(buf + 1) + 1; total_len = 1 + png_strlen(buf + 1) + 1;
sprintf(buf + total_len, "%12.12e", height); png_snprintf(buf + total_len, 64-total_len, "%12.12e", height);
total_len += png_strlen(buf + total_len); total_len += png_strlen(buf + total_len);
#endif #endif
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len); png_write_chunk(png_ptr, png_sCAL, (png_bytep)buf, total_len);
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
@ -1659,7 +1660,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */ png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len); png_write_chunk(png_ptr, png_sCAL, buf, total_len);
} }
#endif #endif
#endif #endif
@ -1685,7 +1686,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
png_save_uint_32(buf + 4, y_pixels_per_unit); png_save_uint_32(buf + 4, y_pixels_per_unit);
buf[8] = (png_byte)unit_type; buf[8] = (png_byte)unit_type;
png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9); png_write_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
} }
#endif #endif
@ -1717,7 +1718,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
buf[5] = mod_time->minute; buf[5] = mod_time->minute;
buf[6] = mod_time->second; buf[6] = mod_time->second;
png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7); png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
} }
#endif #endif
@ -1751,6 +1752,7 @@ png_write_start_row(png_structp png_ptr)
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);
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
#ifndef PNG_NO_WRITE_FILTERING
/* set up filtering buffer, if using this filter */ /* set up filtering buffer, if using this filter */
if (png_ptr->do_filter & PNG_FILTER_SUB) if (png_ptr->do_filter & PNG_FILTER_SUB)
{ {
@ -1768,7 +1770,7 @@ png_write_start_row(png_structp png_ptr)
if (png_ptr->do_filter & PNG_FILTER_UP) if (png_ptr->do_filter & PNG_FILTER_UP)
{ {
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));
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
} }
@ -1782,10 +1784,11 @@ png_write_start_row(png_structp png_ptr)
if (png_ptr->do_filter & PNG_FILTER_PAETH) if (png_ptr->do_filter & PNG_FILTER_PAETH)
{ {
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));
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
} }
#endif /* PNG_NO_WRITE_FILTERING */
} }
#ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_WRITE_INTERLACING_SUPPORTED
@ -2121,6 +2124,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
prev_row = png_ptr->prev_row; prev_row = png_ptr->prev_row;
best_row = row_buf = png_ptr->row_buf; best_row = row_buf = png_ptr->row_buf;
#ifndef PNG_NO_WRITE_FILTER
mins = PNG_MAXSUM; mins = PNG_MAXSUM;
/* The prediction method we use is to find which method provides the /* The prediction method we use is to find which method provides the
@ -2695,7 +2699,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
best_row = png_ptr->paeth_row; best_row = png_ptr->paeth_row;
} }
} }
#endif /* PNG_NO_WRITE_FILTER */
/* Do the actual writing of the filtered row data from the chosen filter. */ /* Do the actual writing of the filtered row data from the chosen filter. */
png_write_filtered_row(png_ptr, best_row); png_write_filtered_row(png_ptr, best_row);

View File

@ -5,7 +5,7 @@ project(PNG)
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 0) set(PNGLIB_MINOR 0)
set(PNGLIB_RELEASE 26) set(PNGLIB_RELEASE 27)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@ -49,6 +49,12 @@ if(NOT WIN32)
set(png_asm_tmp "OFF") set(png_asm_tmp "OFF")
endif("uname_output" MATCHES "^.*i[1-9]86.*$") endif("uname_output" MATCHES "^.*i[1-9]86.*$")
endif(uname_executable) endif(uname_executable)
else(NOT WIN32)
# this env var is normally only set on win64
SET(TEXT "ProgramFiles(x86)")
if("$ENV{${TEXT}}" STREQUAL "")
set(png_asm_tmp "ON")
endif("$ENV{${TEXT}}" STREQUAL "")
endif(NOT WIN32) endif(NOT WIN32)
option(PNG_MMX "Use MMX assembler code (x86 only)" ${png_asm_tmp}) option(PNG_MMX "Use MMX assembler code (x86 only)" ${png_asm_tmp})
@ -90,31 +96,21 @@ set(pngtest_sources
# SOME NEEDED DEFINITIONS # SOME NEEDED DEFINITIONS
add_definitions(-DZLIB_DLL) add_definitions(-DZLIB_DLL)
if(MSVC) if(PNG_MMX)
add_definitions(-DPNG_USE_PNGVCRD -DPNG_NO_MODULEDEF if(MSVC)
-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
set(libpng_sources ${libpng_sources} set(libpng_sources ${libpng_sources}
pngvcrd.c pngvcrd.c
) )
else(MSVC) else(MSVC)
add_definitions(-DPNG_USE_PNGGCCRD) set(libpng_sources ${libpng_sources}
set(libpng_sources ${libpng_sources} pnggccrd.c
pnggccrd.c )
) endif(MSVC)
endif(MSVC) else(PNG_MMX)
add_definitions(-DLIBPNG_NO_MMX)
if(NOT MSVC) add_definitions(-DPNG_NO_MMX_CODE)
if(NOT PNG_MMX) endif(PNG_MMX)
add_definitions(-DLIBPNG_NO_MMX)
add_definitions(-DPNG_NO_MMX_CODE)
endif(NOT PNG_MMX)
else(NOT MSVC)
if(PNG_MMX)
# maybe add this to pngconf.h ?
add_definitions(-DPNG_MMX_CODE_SUPPORTED)
endif(PNG_MMX)
endif(NOT MSVC)
if(PNG_CONSOLE_IO_SUPPORTED) if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
@ -132,9 +128,9 @@ if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG) add_definitions(-DPNG_DEBUG)
endif(PNG_DEBUG) endif(PNG_DEBUG)
if(NOT M_LIBRARY) if(NOT M_LIBRARY AND NOT WIN32)
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED) add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
endif(NOT M_LIBRARY) endif(NOT M_LIBRARY AND NOT WIN32)
# NOW BUILD OUR TARGET # NOW BUILD OUR TARGET
include_directories(${PNG_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) include_directories(${PNG_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
@ -179,7 +175,7 @@ configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
# SET UP LINKS # SET UP LINKS
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.0.26 # VERSION 0.${PNGLIB_RELEASE}.1.0.27rc1
VERSION 0.${PNGLIB_RELEASE}.0 VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0 SOVERSION 0
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)

View File

@ -8,7 +8,7 @@
# Modeled after libxml-config. # Modeled after libxml-config.
version=1.0.26 version=1.0.27rc1
prefix="" prefix=""
libdir="" libdir=""
libs="" libs=""

View File

@ -5,6 +5,6 @@ includedir=@includedir@/libpng10
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.0.26 Version: 1.0.27rc1
Libs: -L${libdir} -lpng10 Libs: -L${libdir} -lpng10
Cflags: -I${includedir} @LIBPNG_NO_MMX@ Cflags: -I${includedir} @LIBPNG_NO_MMX@

View File

@ -5,6 +5,6 @@ includedir=@includedir@/libpng10
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.0.26 Version: 1.0.27rc1
Libs: -L${libdir} -lpng10 Libs: -L${libdir} -lpng10
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@ -20,7 +20,7 @@ LN_SF = ln -f -s
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local prefix=/usr/local

View File

@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@ -3,7 +3,7 @@
# of the library, and builds two copies of pngtest: one # of the library, and builds two copies of pngtest: one
# statically linked and one dynamically linked. # statically linked and one dynamically linked.
# #
# Copyright (C) 2002, 2006 Soren Anderson, Charles Wilson, # Copyright (C) 2002, 2006, 2007 Soren Anderson, Charles Wilson,
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by: # and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000 Greg Roelofs # Copyright (C) 1998-2000 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@ -31,9 +31,8 @@ endif
DESTDIR= DESTDIR=
# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to # To disable assembler optimizations, add '-DPNG_NO_MMX_CODE' to
# $CFLAGS, and include pnggccrd.o in $OBJS, below, and in the dependency # $CFLAGS. To enable, add pnggccrd.o to the dependencies.
# list at the bottom of this makefile.
CC=gcc CC=gcc
ifdef MINGW ifdef MINGW
@ -62,25 +61,23 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
### if you use the asm, add pnggccrd.o to the OBJS list
###
### if you don't need thread safety, but want the asm accel ### if you don't need thread safety, but want the asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD \ #CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \
# $(addprefix -I,$(ZLIBINC)) -Wall -O3 $(ALIGN) -funroll-loops \ # $(addprefix -I,$(ZLIBINC)) -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### if you need thread safety and want (minimal) asm accel ### if you need thread safety and want (minimal) asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_USE_PNGGCCRD $(addprefix -I,$(ZLIBINC)) \ #CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
# -Wall -O3 $(ALIGN) -funroll-loops \ # -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### Normal (non-asm) compilation ### Normal (non-asm) compilation
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
-Wall -O3 $(ALIGN) -funroll-loops \ -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
CYGDLL = 10 CYGDLL = 10
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(CYGDLL).dll SHAREDLIB=cygpng$(CYGDLL).dll
@ -159,19 +156,19 @@ shared: all-shared
all-static: $(STATLIB) pngtest-stat$(EXE) all-static: $(STATLIB) pngtest-stat$(EXE)
all-shared: $(SHAREDLIB) pngtest$(EXE) all-shared: $(SHAREDLIB) pngtest$(EXE)
pnggccrd.o: pnggccrd.c png.h pngconf.h # pnggccrd.o: pnggccrd.c png.h pngconf.h
@echo "" # @echo ""
@echo ' You can ignore the "control reaches end of non-void function"' # @echo ' You can ignore the "control reaches end of non-void function"'
@echo ' warning and "<variable> defined but not used" warnings:' # @echo ' warning and "<variable> defined but not used" warnings:'
@echo "" # @echo ""
$(CC) -c $(CFLAGS) -o $@ $< # $(CC) -c $(CFLAGS) -o $@ $<
pnggccrd.pic.o: pnggccrd.c png.h pngconf.h # pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
@echo "" # @echo ""
@echo ' You can ignore the "control reaches end of non-void function"' # @echo ' You can ignore the "control reaches end of non-void function"'
@echo ' warning and "<variable> defined but not used" warnings:' # @echo ' warning and "<variable> defined but not used" warnings:'
@echo "" # @echo ""
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $< # $(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
$(STATLIB): $(OBJS) $(STATLIB): $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
@ -308,6 +305,7 @@ pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
# pnggccrd.o pnggccrd.pic.o: png.h pngconf.h pnggccrd.c
pngtest.o: png.h pngconf.h pngtest.c pngtest.o: png.h pngconf.h pngtest.c
pngtest-stat.o: png.h pngconf.h pngtest.c pngtest-stat.o: png.h pngconf.h pngtest.c

View File

@ -19,7 +19,7 @@ ZLIBINC=../zlib
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -38,7 +38,8 @@ LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
RM_F=/bin/rm -f RM_F=/bin/rm -f
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops # CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -Wall -O -funroll-loops
LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@ -5,7 +5,7 @@
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10

View File

@ -12,7 +12,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@ -24,14 +24,14 @@ SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \
LDADD+= -lm -lz LDADD+= -lm -lz
DPADD+= ${LIBM} ${LIBZ} DPADD+= ${LIBM} ${LIBZ}
CFLAGS+= -I. -DPNG_USE_PNGGCCRD CFLAGS+= -I.
.if (${MACHINE_ARCH} != "i386") .if (${MACHINE_ARCH} != "i386")
CFLAGS+= -DPNG_NO_MMX_CODE CFLAGS+= -DPNG_NO_MMX_CODE
.endif .endif
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pnggccrd.c pngwtran.c pngmem.c pngerror.c pngpread.c
pngtest: pngtest.o libpng.a pngtest: pngtest.o libpng.a
${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -lpng -lz -lm ${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -lpng -lz -lm

View File

@ -16,7 +16,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -60,15 +60,15 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety # Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety
### for generic gcc: ### for generic gcc:
CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall \ CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \
-O3 $(ALIGN) -funroll-loops \ $(ALIGN) -funroll-loops \
-fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5 -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
### for gcc 2.95.2 on 686: ### for gcc 2.95.2 on 686:
#CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \ #CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \
# -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \ # -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
### for gcc 2.7.2.3 on 486 and up: ### for gcc 2.7.2.3 on 486 and up:
#CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \ #CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \
# -m486 -malign-double -ffast-math \ # -m486 -malign-double -ffast-math \
# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
@ -120,7 +120,7 @@ libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cppflags=\"-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD\"; \ echo cppflags=\"-DPNG_THREAD_UNSAFE_OK \"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \ echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \ echo libs=\"-lpng10 -lz -lm\"; \

View File

@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@ -1,5 +1,5 @@
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker. # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2006, 2007 Glenn Randers-Pehrson
# Copyright (C) 2001, Laurent faillie # Copyright (C) 2001, Laurent faillie
# Copyright (C) 1998, 1999 Greg Roelofs # Copyright (C) 1998, 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -53,7 +53,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm

View File

@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -45,7 +45,7 @@ LIBPATH=$(exec_prefix)/lib
MANPATH=$(prefix)/man MANPATH=$(prefix)/man
BINPATH=$(exec_prefix)/bin BINPATH=$(exec_prefix)/bin
CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 -DPNG_NO_MMX_CODE
# Caution: be sure you have built zlib with the same CFLAGS. # Caution: be sure you have built zlib with the same CFLAGS.
CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm

View File

@ -8,14 +8,6 @@
# To use, do "nmake /f scripts\makefile.intel" # To use, do "nmake /f scripts\makefile.intel"
# ------------------- Intel C/C++ Compiler 4.0 and later -------------------
# Caution: the assembler code was introduced at libpng version 1.0.4 and has
# not yet been thoroughly tested.
# Use assembler code
ASMCODE=-DPNG_USE_PNGVCRD
# Where the zlib library and include files are located # Where the zlib library and include files are located
ZLIBLIB=..\zlib ZLIBLIB=..\zlib
ZLIBINC=..\zlib ZLIBINC=..\zlib
@ -36,7 +28,7 @@ CALLING=r # __fastcall
CC=icl -c CC=icl -c
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) $(ASMCODE) -nologo CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) -nologo
LD=link LD=link
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
@ -44,8 +36,7 @@ O=.obj
OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) \ OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) \
pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O) \ pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O) \
pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O) pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O) pnggccrd$(O)
all: test all: test
@ -70,6 +61,9 @@ pngrtran$(O): png.h pngconf.h
pngrutil$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pnggccrd$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngvcrd$(O): png.h pngconf.h pngvcrd$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)

View File

@ -6,7 +6,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -47,7 +47,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm

View File

@ -6,15 +6,15 @@
# Built from makefile.cygwin # Built from makefile.cygwin
# Copyright (C) 2002, 2006 Soren Anderson, Charles Wilson, # Copyright (C) 2002, 2006 Soren Anderson, Charles Wilson,
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by: # and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000 Greg Roelofs # Copyright (C) 1998-2000, 2007 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# This makefile intends to support building outside the src directory # This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the # if desired. When invoking it, specify an argument to SRCDIR on the
# command line that points to the top of the directory where your source # command line that points to the top of the directory where your source
# is located. # is located.
ifdef SRCDIR ifdef SRCDIR
VPATH = $(SRCDIR) VPATH = $(SRCDIR)
else else
@ -29,20 +29,24 @@ endif
# If you're going to install into a temporary location # If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install. # you execute make install.
DESTDIR= DESTDIR=
# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to # If you're using a cross-compiler, add the appropriate prefix (e.g.,
# $CFLAGS, and include pnggccrd.o in $OBJS, below, and in the dependency # "i386-mingw32msvc-") to the following three commands:
# list at the bottom of this makefile.
CC=gcc CC=gcc
AR=ar
RANLIB=ranlib
MKDIR_P=/bin/mkdir -pv
# To disable assembler optimizations, add '-DPNG_NO_MMX_CODE' to
# $CFLAGS. To enable them, add pnggccrd.o to the dependencies.
# Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h # Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
ifndef prefix ifndef prefix
prefix=/usr prefix=/usr
$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr") $(warning "You haven't specified a 'prefix=' location. Defaulting to '/usr'")
endif endif
exec_prefix=$(prefix) exec_prefix=$(prefix)
@ -58,25 +62,23 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
### if you use the asm, add pnggccrd.o to the OBJS list
###
### if you don't need thread safety, but want the asm accel ### if you don't need thread safety, but want the asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD \ #CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \
# $(addprefix -I,$(ZLIBINC)) -Wall -O3 $(ALIGN) -funroll-loops \ # $(addprefix -I,$(ZLIBINC)) -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### if you need thread safety and want (minimal) asm accel ### if you need thread safety and want (minimal) asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_USE_PNGGCCRD $(addprefix -I,$(ZLIBINC)) \ #CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
# -Wall -O3 $(ALIGN) -funroll-loops \ # -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### Normal (non-asm) compilation ### Normal (non-asm) compilation
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
-Wall -O3 $(ALIGN) -funroll-loops \ -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
MINGDLL = 10 MINGDLL = 10
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=libpng$(MINGDLL).dll SHAREDLIB=libpng$(MINGDLL).dll
@ -90,10 +92,6 @@ LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS)) LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS))
LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
MKDIR_P=/bin/mkdir -pv
RANLIB=ranlib
#RANLIB=echo
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib LIBPATH=$(exec_prefix)/lib
@ -155,22 +153,8 @@ shared: all-shared
all-static: $(STATLIB) pngtest-stat$(EXE) all-static: $(STATLIB) pngtest-stat$(EXE)
all-shared: $(SHAREDLIB) pngtest$(EXE) all-shared: $(SHAREDLIB) pngtest$(EXE)
pnggccrd.o: pnggccrd.c png.h pngconf.h
@echo ""
@echo ' You can ignore the "control reaches end of non-void function"'
@echo ' warning and "<variable> defined but not used" warnings:'
@echo ""
$(CC) -c $(CFLAGS) -o $@ $<
pnggccrd.pic.o: pnggccrd.c png.h pngconf.h
@echo ""
@echo ' You can ignore the "control reaches end of non-void function"'
@echo ' warning and "<variable> defined but not used" warnings:'
@echo ""
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
$(STATLIB): $(OBJS) $(STATLIB): $(OBJS)
ar rc $@ $(OBJS) $(AR) rc $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
$(SHAREDDEF): scripts/pngw32.def $(SHAREDDEF): scripts/pngw32.def
@ -186,12 +170,6 @@ pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
pngtest-stat$(EXE): pngtest.o $(STATLIB) pngtest-stat$(EXE): pngtest.o $(STATLIB)
$(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@ $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
pngtest.pic.o: pngtest.c
$(CC) $(CFLAGS) -c $< -o $@
pngtest.o: pngtest.c
$(CC) $(CFLAGS) -c $< -o $@
test: test-static test-shared test: test-static test-shared
test-static: pngtest-stat$(EXE) test-static: pngtest-stat$(EXE)
@ -278,8 +256,8 @@ test-installed:
clean: clean:
/bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \ /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \ pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
libpng-config libpng.pc pngtesti$(EXE) libpng-config libpng.pc pngtesti$(EXE)
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:
@ -304,9 +282,9 @@ pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
# pnggccrd.o pnggccrd.pic.o: png.h pngconf.h pnggccrd.c
pngtest.o: png.h pngconf.h pngtest.c pngtest.o pngtest.pic.o: png.h pngconf.h pngtest.c
pngtest-stat.o: png.h pngconf.h pngtest.c

View File

@ -14,14 +14,14 @@ INCSDIR=${LOCALBASE}/include/libpng10
LIB= png12 LIB= png12
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.26 SHLIB_MINOR= 1.0.27rc1
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c
INCS= png.h pngconf.h INCS= png.h pngconf.h
MAN= libpng.3 libpngpf.3 png.5 MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} -DPNG_USE_PNGGCCRD CPPFLAGS+=-I${.CURDIR}
# something like this for mmx assembler, but it core dumps for me at the moment # something like this for mmx assembler, but it core dumps for me at the moment
# .if ${MACHINE_ARCH} == "i386" # .if ${MACHINE_ARCH} == "i386"

View File

@ -14,14 +14,14 @@ INCSDIR=${LOCALBASE}/include/libpng
LIB= png LIB= png
SHLIB_MAJOR= 3 SHLIB_MAJOR= 3
SHLIB_MINOR= 1.0.26 SHLIB_MINOR= 1.0.27rc1
SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c
INCS= png.h pngconf.h INCS= png.h pngconf.h
MAN= libpng.3 libpngpf.3 png.5 MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} -DPNG_USE_PNGGCCRD CPPFLAGS+=-I${.CURDIR}
# something like this for mmx assembler, but it core dumps for me at the moment # something like this for mmx assembler, but it core dumps for me at the moment
# .if ${MACHINE_ARCH} == "i386" # .if ${MACHINE_ARCH} == "i386"

View File

@ -7,7 +7,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -48,8 +48,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
-DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm

View File

@ -8,7 +8,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.26 SHLIB_MINOR= 1.0.27rc1
LIB= png LIB= png
SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \ SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
@ -18,7 +18,7 @@ SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
HDRS= png.h pngconf.h HDRS= png.h pngconf.h
CFLAGS+= -Wall CFLAGS+= -Wall
CPPFLAGS+= -I${.CURDIR} -DPNG_NO_MMX_CODE -DPNG_USE_PNGGCCRD CPPFLAGS+= -I${.CURDIR} -DPNG_NO_MMX_CODE
NOPROFILE= Yes NOPROFILE= Yes

View File

@ -9,7 +9,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -38,7 +38,7 @@ exec_prefix=$(prefix)
ZLIBLIB=../zlib ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
CFLAGS= -dy -belf -I$(ZLIBINC) -O3 CFLAGS= -dy -belf -I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm
INCPATH=$(prefix)/include/libpng INCPATH=$(prefix)/include/libpng

View File

@ -6,7 +6,7 @@
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -44,7 +44,7 @@ ZLIBINC=../zlib
ABI= ABI=
WARNMORE= # -g -DPNG_DEBUG=5 WARNMORE= # -g -DPNG_DEBUG=5
CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -fPIC -mabi=n32 -DPNG_NO_MMX_CODE
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
-set_version sgi$(PNGMAJ).0 -set_version sgi$(PNGMAJ).0
@ -73,7 +73,7 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -93,6 +93,7 @@ libpng-config:
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"$(ABI)\"; \ echo ccopts=\"$(ABI)\"; \
echo cppflags=\"-DPNG_NO_MMX_CODE\"; \
echo ldopts=\"$(ABI)\"; \ echo ldopts=\"$(ABI)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libdir=\"$(LIBPATH)\"; \ echo libdir=\"$(LIBPATH)\"; \
@ -234,5 +235,4 @@ pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pnggccrd.o: png.h pngconf.h

View File

@ -6,7 +6,7 @@
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -45,9 +45,8 @@ ABI=
WARNMORE=-fullwarn WARNMORE=-fullwarn
# Note: -KPIC is the default anyhow # Note: -KPIC is the default anyhow
#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5 #CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_NO_MMX_CODE # -g -DPNG_DEBUG=5
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD \ CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_NO_MMX_CODE
-DPNG_NO_MMX_CODE
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng10 -lz -lm
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
@ -77,7 +76,7 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -96,7 +95,7 @@ libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \ echo cppflags=\"-DPNG_NO_MMX_CODE\"; \
echo ccopts=\"$(ABI)\"; \ echo ccopts=\"$(ABI)\"; \
echo ldopts=\"$(ABI)\"; \ echo ldopts=\"$(ABI)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
@ -239,5 +238,4 @@ pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pnggccrd.o: png.h pngconf.h

View File

@ -8,7 +8,7 @@
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
@ -47,8 +47,8 @@ ZLIBINC=/usr/include
#WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 #CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -O3 CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.26 PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@ -44,6 +44,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -Wall -O \ CFLAGS=-I$(ZLIBINC) -Wall -O \
-DPNG_NO_MMX_CODE; \
# $(WARNMORE) -g -DPNG_DEBUG=5 # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
@ -91,7 +92,7 @@ libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \ echo cppflags=\"-DPNG_NO_MMX_CODE\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo R_opts=\"-R$(LIBPATH)\"; \ echo R_opts=\"-R$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \ echo libs=\"-lpng10 -lz -lm\"; \

View File

@ -0,0 +1,245 @@
# makefile for libpng on Solaris 2.x with gcc
# Copyright (C) 2004, 2006, 2007 Glenn Randers-Pehrson
# Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h
# Library name:
LIBNAME = libpng10
PNGMAJ = 0
PNGMIN = 1.0.27rc1
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOVER=$(LIBNAME).so.$(PNGVER)
OLDSO=libpng.so
OLDSOMAJ=libpng.so.2
OLDSOVER=libpng.so.2.$(PNGMIN)
# Utilities:
AR_RC=ar rc
CC=gcc
MKDIR_P=mkdir -p
LN_SF=ln -f -s
RANLIB=echo
RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng10.so*, and png.h
prefix=/usr/local
exec_prefix=$(prefix)
# Where the zlib library and include files are located
# Changing these to ../zlib poses a security risk. If you want
# to have zlib in an adjacent directory, specify the full path instead of "..".
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -Wall -O \
# $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng10 -lz -lm
INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib
MANPATH=$(prefix)/man
BINPATH=$(exec_prefix)/bin
# override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
OBJS = 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 pnggccrd.o
OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
.c.pic.o:
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
$(RANLIB) $@
libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo cppflags=\""; \
echo L_opts=\"-L$(LIBPATH)\"; \
echo R_opts=\"-R$(LIBPATH)\"; \
echo libs=\"-lpng10 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBSO): $(LIBSOMAJ)
$(LN_SF) $(LIBSOMAJ) $(LIBSO)
$(LIBSOMAJ): $(LIBSOVER)
$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
$(LIBSOVER): $(OBJSDLL)
@case "`type ld`" in *ucb*) \
echo; \
echo '## WARNING:'; \
echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
echo '## at all. If it is, things are likely to break because of'; \
echo '## the libucb dependency that is created.'; \
echo; \
;; \
esac
$(LD) -G -h $(LIBSOMAJ) \
-o $(LIBSOVER) $(OBJSDLL)
$(OLDSOVER): $(OBJS)
$(LD) -G -h $(OLDSOMAJ) \
-o $(OLDSOVER) $(OBJSDLL)
pngtest: pngtest.o $(LIBSO)
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
test: pngtest
./pngtest
install-headers: png.h pngconf.h
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
cp png.h pngconf.h $(DI)/$(LIBNAME)
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
-@$(RM_F) $(DI)/libpng
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
install-static: install-headers libpng.a
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(DL)/$(LIBNAME).a
-@$(RM_F) $(DL)/libpng.a
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
install-shared: install-headers $(LIBSOVER) libpng.pc \
$(OLDSOVER)
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
-@$(RM_F) $(DL)/$(LIBSOMAJ)
-@$(RM_F) $(DL)/$(OLDSO)
-@$(RM_F) $(DL)/$(OLDSOMAJ)
-@$(RM_F) $(DL)/$(OLDSOVER)*
cp $(LIBSOVER) $(DL)
cp $(OLDSOVER) $(DL)
chmod 755 $(DL)/$(LIBSOVER)
chmod 755 $(DL)/$(OLDSOVER)
(cd $(DL); \
$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
$(LN_SF) $(LIBSOVER) $(LIBSO); \
$(LN_SF) $(LIBSOVER) $(LIBSOMAJ))
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
install-man: libpng.3 libpngpf.3 png.5
-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
-@$(RM_F) $(DM)/man3/libpng.3
-@$(RM_F) $(DM)/man3/libpngpf.3
cp libpng.3 $(DM)/man3
cp libpngpf.3 $(DM)/man3
-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
-@$(RM_F) $(DM)/man5/png.5
cp png.5 $(DM)/man5
install-config: libpng-config
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
-@$(RM_F) $(DB)/libpng-config
-@$(RM_F) $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location. Use test-dd to test it
# before then.
test-dd:
echo
echo Testing installed dynamic shared library in $(DL).
$(CC) -I$(DI) -I$(ZLIBINC) \
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
./pngtestd pngtest.png
test-installed:
echo
echo Testing installed dynamic shared library.
$(CC) -I$(ZLIBINC) \
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
-L$(ZLIBLIB) -R$(ZLIBLIB)
./pngtesti pngtest.png
clean:
$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
libpng-config $(LIBSO) $(LIBSOMAJ)* \
$(OLDSOVER) \
libpng.pc
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
chmod a-w *.[ch35] $(DOCS) scripts/*
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h
pngerror.o pngerror.pic.o: png.h pngconf.h
pngrio.o pngrio.pic.o: png.h pngconf.h
pngwio.o pngwio.pic.o: png.h pngconf.h
pngmem.o pngmem.pic.o: png.h pngconf.h
pngset.o pngset.pic.o: png.h pngconf.h
pngget.o pngget.pic.o: png.h pngconf.h
pnggccrd.o pnggccrd.pic.o: png.h pngconf.h
pngread.o pngread.pic.o: png.h pngconf.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h
pngpread.o pngpread.pic.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@ -11,7 +11,7 @@
CC = cl CC = cl
LD = link LD = link
AR = lib AR = lib
CFLAGS = -nologo -MD -O2 -W3 -I..\zlib CFLAGS = -nologo -DPNG_NO_MMX_CODE -MD -O2 -W3 -I..\zlib
LDFLAGS = -nologo LDFLAGS = -nologo
ARFLAGS = -nologo ARFLAGS = -nologo
RM = del RM = del

View File

@ -2,7 +2,7 @@
; PNG.LIB module definition file for OS/2 ; PNG.LIB module definition file for OS/2
;---------------------------------------- ;----------------------------------------
; Version 1.0.26 ; Version 1.0.27rc1
LIBRARY PNG LIBRARY PNG
DESCRIPTION "PNG image compression library for OS/2" DESCRIPTION "PNG image compression library for OS/2"

View File

@ -5,7 +5,7 @@
LIBRARY LIBRARY
EXPORTS EXPORTS
;Version 1.0.26 ;Version 1.0.27rc1
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