-Libpng 1.2.5rc3 - September 18, 2002
+Libpng 1.2.6 - August 15, 2004
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.
-Changes since the last public release (1.2.4):
+Changes since the last public release (1.2.5):
-version 1.2.4patch01 [July 20, 2002]
- Revised makefile.cygwin to use DLL number 12 instead of 13.
-version 1.2.5beta1 [August 6, 2002]
- Added code to contrib/gregbook/readpng2.c to ignore unused chunks.
- Replaced toucan.png in contrib/gregbook (it has been corrupt since 1.0.11)
- Removed some stray *.o files from contrib/gregbook.
- Changed png_error() to png_warning() about "Too much data" in pngpread.c
- and about "Extra compressed data" in pngrutil.c.
- Prevent png_ptr->pass from exceeding 7 in png_push_finish_row().
- Updated makefile.hggcc
- Updated png.c and pnggccrd.c handling of return from png_mmx_support()
-version 1.2.5beta2 [August 15, 2002]
- Only issue png_warning() about "Too much data" in pngpread.c when avail_in
- is nonzero.
- Updated makefiles to install a separate libpng.so.3 with its own rpath.
-version 1.2.5rc1 and 1.0.15rc1 [August 24, 2002]
- Revised makefiles to not remove previous minor versions of shared libraries.
-version 1.2.5rc2 and 1.0.15rc2 [September 16, 2002]
- Revised 13 makefiles to remove "-lz" and "-L$(ZLIBLIB)", etc., from shared
- library loader directive.
- Added missing "$OBJSDLL" line to makefile.gcmmx.
- Added missing "; fi" to makefile.32sunu.
-version 1.2.5rc3 and 1.0.15rc3 [September 18, 2002]
- Revised libpng-config script.
+ Commented out warning about uninitialized mmx_support in pnggccrd.c.
+ Changed "IBMCPP__" flag to "__IBMCPP__" in pngconf.h.
+ Relocated two more misplaced PNGAPI lines in pngtest.c
+ Fixed memory overrun bug in png_do_read_filler() with 16-bit datastreams,
+ introduced in version 1.0.2.
+ Fixed potential overrun in pngerror.c by using strncpy instead of memcpy.
+ Revised makefile.macosx, makefile.dec, makefile.aix, and makefile.32sunu.
+ Changed the one instance of "ln -sf" to "ln -f -s" in each Sun makefile.
+ Fixed potential overrun in pngerror.c by using strncpy instead of memcpy.
+ Added "#!/bin/sh" at the top of configure, for recognition of the
+ 'x' flag under Cygwin (Cosmin).
+ Optimized vacuous tests that silence compiler warnings, in png.c (Cosmin).
+ Added support for PNG_USER_CONFIG, in pngconf.h (Cosmin).
+ Fixed the special memory handler for Borland C under DOS, in pngmem.c
+ (Cosmin).
+ Removed some spurious assignments in pngrutil.c (Cosmin).
+ Replaced 65536 with 65536L, and 0xffff with 0xffffL, to silence warnings
+ on 16-bit platforms (Cosmin).
+ Enclosed shift op expressions in parentheses, to silence warnings (Cosmin).
+ Used proper type png_fixed_point, to avoid problems on 16-bit platforms,
+ in png_handle_sRGB() (Cosmin).
+ Added compression_type to png_struct, and optimized the window size
+ inside the deflate stream (Cosmin).
+ Fixed definition of isnonalpha(), in pngerror.c and pngrutil.c (Cosmin).
+ Fixed handling of unknown chunks that come after IDAT (Cosmin).
+ Allowed png_error() and png_warning() to work even if png_ptr == NULL
+ (Cosmin).
+ Replaced row_info->rowbytes with row_bytes in png_write_find_filter()
+ (Cosmin).
+ Fixed definition of PNG_LIBPNG_VER_DLLNUM (Simon-Pierre).
+ Used PNG_LIBPNG_VER and PNG_LIBPNG_VER_STRING instead of the hardcoded
+ values in png.c (Simon-Pierre, Cosmin).
+ Initialized png_libpng_ver[] with PNG_LIBPNG_VER_STRING (Simon-Pierre).
+ Replaced PNG_LIBPNG_VER_MAJOR with PNG_LIBPNG_VER_DLLNUM in png.rc
+ (Simon-Pierre).
+ Moved the definition of PNG_HEADER_VERSION_STRING near the definitions
+ of the other PNG_LIBPNG_VER_... symbols in png.h (Cosmin).
+ Relocated #ifndef PNGAPI guards in pngconf.h (Simon-Pierre, Cosmin).
+ Updated scripts/makefile.vc(a)win32 (Cosmin).
+ Updated the MSVC project (Simon-Pierre, Cosmin).
+ Updated the Borland C++ Builder project (Cosmin).
+ Avoided access to asm_flags in pngvcrd.c, if PNG_1_0_X is defined (Cosmin).
+ Commented out warning about uninitialized mmx_support in pngvcrd.c (Cosmin).
+ Removed scripts/makefile.bd32 and scripts/pngdef.pas (Cosmin).
+ Added extra guard around inclusion of Turbo C memory headers, in pngconf.h
+ (Cosmin).
+ Renamed projects/msvc/ to projects/visualc6/, and projects/borland/ to
+ projects/cbuilder5/ (Cosmin).
+ Moved projects/visualc6/png32ms.def to scripts/pngw32.def,
+ and projects/visualc6/png.rc to scripts/pngw32.rc (Cosmin).
+ Added projects/visualc6/pngtest.dsp; removed contrib/msvctest/ (Cosmin).
+ Updated contrib/visupng/VisualPng.dsp (Cosmin).
+ Updated contrib/visupng/cexcept.h to version 2.0.0 (Cosmin).
+ Added a separate distribution with "configure" and supporting files (Junichi).
+ Added user ability to change png_size_t via a PNG_SIZE_T macro.
+ Added png_sizeof() and png_convert_size() functions.
+ Added PNG_SIZE_MAX (maximum value of a png_size_t variable.
+ Added check in png_malloc_default() for (size_t)size != (png_uint_32)size
+ which would indicate an overflow.
+ Changed sPLT failure action from png_error to png_warning and abandon chunk.
+ Changed sCAL and iCCP failures from png_error to png_warning and abandon.
+ Added png_get_uint_31(png_ptr, buf) function.
+ Added PNG_UINT_32_MAX macro.
+ Renamed PNG_MAX_UINT to PNG_UINT_31_MAX.
+ Made png_zalloc() issue a png_warning and return NULL on potential
+ overflow.
+ Revised "clobber list" in pnggccrd.c so it will compile under gcc-3.4.
+ Revised Borland portion of png_malloc() to return NULL or issue
+ png_error() according to setting of PNG_FLAG_MALLOC_NULL_MEM_OK.
+ Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
+ sequential read support.
+ Added some "#if PNG_WRITE_SUPPORTED" blocks.
+ #ifdef'ed out some redundancy in png_malloc_default().
+ Use png_malloc instead of png_zalloc to allocate the pallete.
+ Rearranged order of processing of color types in png_handle_tRNS().
+ Added PNG_ROWBYTES macro to calculate rowbytes without integer overflow.
+ Updated makefile.darwin and removed makefile.macosx from scripts directory.
+ Imposed default one million column, one-million row limits on the image
+ dimensions, and added png_set_user_limits() function and
+ PNG_SET_USER_LIMITS_SUPPORTED macro to override them.
+ Fixed wrong cast of returns from png_get_user_width|height_max().
+ Fixed buffer overflow vulnerability in png_handle_tRNS()
+ Fixed integer arithmetic overflow vulnerability in png_read_png().
+ Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
+ duplicate chunk types to go undetected.
+ Changed some "keep the compiler happy" from empty statements to returns,
+Revised libpng.txt to remove 1.2.x stuff from the 1.0.x distribution
+ Revised makefile.darwin and makefile.solaris. Removed makefile.macosx.
+ Revised pngtest's png_debug_malloc() to use png_malloc() instead of
+ png_malloc_default() which is not supposed to be exported.
+ Fixed old bug in RGB to Gray transformation.
+ Fixed problem with 64-bit compilers by casting arguments to abs()
+ to png_int_32.
+ Changed "ln -sf" to "ln -f -s" in three makefiles (solaris, sco, so9).
+ Changed "HANDLE_CHUNK_*" to "PNG_HANDLE_CHUNK_*" (Cosmin)
+ Added "-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)" to 15 *NIX makefiles.
+ Added code to update the row_info->colortype in png_do_read_filler() (MSB).
+ Eliminated use of "abs()" in testing cHRM and gAMA values, to avoid
+ trouble with some 64-bit compilers. Created PNG_OUT_OF_RANGE() macro.
+ Revised documentation of png_set_keep_unknown_chunks().
+ Check handle_as_unknown status in pngpread.c, as in pngread.c previously.
+ Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_INTERNAL section of png.h
+ Added "rim" definitions for CONST4 and CONST6 in pnggccrd.c
+ Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1.
Send comments/corrections/commendations to
-png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
+png-implement@ccrc.wustl.edu or to glennrp@users.sourceforge.net
Glenn R-P
Added missing "; fi" to makefile.32sunu.
version 1.2.5rc3 and 1.0.15rc3 [September 18, 2002]
Revised libpng-config script.
+version 1.2.5 and 1.0.15 [October 3, 2002]
+ Revised makefile.macosx, makefile.darwin, makefile.hpgcc, and makefile.hpux,
+ and makefile.aix.
+ Relocated two misplaced PNGAPI lines in pngtest.c
+version 1.2.6beta1 [October 22, 2002]
+ Commented out warning about uninitialized mmx_support in pnggccrd.c.
+ Changed "IBMCPP__" flag to "__IBMCPP__" in pngconf.h.
+ Relocated two more misplaced PNGAPI lines in pngtest.c
+ Fixed memory overrun bug in png_do_read_filler() with 16-bit datastreams,
+ introduced in version 1.0.2.
+ Revised makefile.macosx, makefile.dec, makefile.aix, and makefile.32sunu.
+version 1.2.6beta2 [November 1, 2002]
+ Added libpng-config "--ldopts" output.
+ Added "AR=ar" and "ARFLAGS=rc" and changed "ar rc" to "$(AR) $(ARFLAGS)"
+ in makefiles.
+version 1.2.6beta3 [July 18, 2004]
+ Reverted makefile changes from version 1.2.6beta2 and some of the changes
+ from version 1.2.6beta1; these will be postponed until version 1.2.7.
+ Version 1.2.6 is going to be a simple bugfix release.
+ Changed the one instance of "ln -sf" to "ln -f -s" in each Sun makefile.
+ Fixed potential overrun in pngerror.c by using strncpy instead of memcpy.
+ Added "#!/bin/sh" at the top of configure, for recognition of the
+ 'x' flag under Cygwin (Cosmin).
+ Optimized vacuous tests that silence compiler warnings, in png.c (Cosmin).
+ Added support for PNG_USER_CONFIG, in pngconf.h (Cosmin).
+ Fixed the special memory handler for Borland C under DOS, in pngmem.c
+ (Cosmin).
+ Removed some spurious assignments in pngrutil.c (Cosmin).
+ Replaced 65536 with 65536L, and 0xffff with 0xffffL, to silence warnings
+ on 16-bit platforms (Cosmin).
+ Enclosed shift op expressions in parentheses, to silence warnings (Cosmin).
+ Used proper type png_fixed_point, to avoid problems on 16-bit platforms,
+ in png_handle_sRGB() (Cosmin).
+ Added compression_type to png_struct, and optimized the window size
+ inside the deflate stream (Cosmin).
+ Fixed definition of isnonalpha(), in pngerror.c and pngrutil.c (Cosmin).
+ Fixed handling of unknown chunks that come after IDAT (Cosmin).
+ Allowed png_error() and png_warning() to work even if png_ptr == NULL
+ (Cosmin).
+ Replaced row_info->rowbytes with row_bytes in png_write_find_filter()
+ (Cosmin).
+ Fixed definition of PNG_LIBPNG_VER_DLLNUM (Simon-Pierre).
+ Used PNG_LIBPNG_VER and PNG_LIBPNG_VER_STRING instead of the hardcoded
+ values in png.c (Simon-Pierre, Cosmin).
+ Initialized png_libpng_ver[] with PNG_LIBPNG_VER_STRING (Simon-Pierre).
+ Replaced PNG_LIBPNG_VER_MAJOR with PNG_LIBPNG_VER_DLLNUM in png.rc
+ (Simon-Pierre).
+ Moved the definition of PNG_HEADER_VERSION_STRING near the definitions
+ of the other PNG_LIBPNG_VER_... symbols in png.h (Cosmin).
+ Relocated #ifndef PNGAPI guards in pngconf.h (Simon-Pierre, Cosmin).
+ Updated scripts/makefile.vc(a)win32 (Cosmin).
+ Updated the MSVC project (Simon-Pierre, Cosmin).
+ Updated the Borland C++ Builder project (Cosmin).
+ Avoided access to asm_flags in pngvcrd.c, if PNG_1_0_X is defined (Cosmin).
+ Commented out warning about uninitialized mmx_support in pngvcrd.c (Cosmin).
+ Removed scripts/makefile.bd32 and scripts/pngdef.pas (Cosmin).
+ Added extra guard around inclusion of Turbo C memory headers, in pngconf.h
+ (Cosmin).
+ Renamed projects/msvc/ to projects/visualc6/, and projects/borland/ to
+ projects/cbuilder5/ (Cosmin).
+ Moved projects/visualc6/png32ms.def to scripts/pngw32.def,
+ and projects/visualc6/png.rc to scripts/pngw32.rc (Cosmin).
+ Added projects/visualc6/pngtest.dsp; removed contrib/msvctest/ (Cosmin).
+ Changed line endings to DOS style in cbuilder5 and visualc6 files, even
+ in the tar.* distributions (Cosmin).
+ Updated contrib/visupng/VisualPng.dsp (Cosmin).
+ Updated contrib/visupng/cexcept.h to version 2.0.0 (Cosmin).
+ Added a separate distribution with "configure" and supporting files (Junichi).
+version 1.2.6beta4 [July 28, 2004]
+ Added user ability to change png_size_t via a PNG_SIZE_T macro.
+ Added png_sizeof() and png_convert_size() functions.
+ Added PNG_SIZE_MAX (maximum value of a png_size_t variable.
+ Added check in png_malloc_default() for (size_t)size != (png_uint_32)size
+ which would indicate an overflow.
+ Changed sPLT failure action from png_error to png_warning and abandon chunk.
+ Changed sCAL and iCCP failures from png_error to png_warning and abandon.
+ Added png_get_uint_31(png_ptr, buf) function.
+ Added PNG_UINT_32_MAX macro.
+ Renamed PNG_MAX_UINT to PNG_UINT_31_MAX.
+ Made png_zalloc() issue a png_warning and return NULL on potential
+ overflow.
+ Turn on PNG_NO_ZALLOC_ZERO by default in version 1.2.x
+ Revised "clobber list" in pnggccrd.c so it will compile under gcc-3.4.
+ Revised Borland portion of png_malloc() to return NULL or issue
+ png_error() according to setting of PNG_FLAG_MALLOC_NULL_MEM_OK.
+ Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
+ sequential read support.
+ Added some "#if PNG_WRITE_SUPPORTED" blocks.
+ #ifdef'ed out some redundancy in png_malloc_default().
+ Use png_malloc instead of png_zalloc to allocate the pallete.
+version 1.2.6rc1 [August 4, 2004]
+ Fixed buffer overflow vulnerability in png_handle_tRNS()
+ Fixed integer arithmetic overflow vulnerability in png_read_png().
+ Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
+ duplicate chunk types to go undetected.
+ Fixed some timestamps in the -config version
+ Rearranged order of processing of color types in png_handle_tRNS().
+ Added ROWBYTES macro to calculate rowbytes without integer overflow.
+ Updated makefile.darwin and removed makefile.macosx from scripts directory.
+ Imposed default one million column, one-million row limits on the image
+ dimensions, and added png_set_user_limits() function to override them.
+ Revised use of PNG_SET_USER_LIMITS_SUPPORTED macro.
+ Fixed wrong cast of returns from png_get_user_width|height_max().
+ Changed some "keep the compiler happy" from empty statements to returns,
+version 1.2.6rc2 [August 7, 2004]
+ Revised makefile.darwin and makefile.solaris. Removed makefile.macosx.
+ Revised pngtest's png_debug_malloc() to use png_malloc() instead of
+ png_malloc_default() which is not supposed to be exported.
+ Fixed off-by-one error in one of the conversions to PNG_ROWBYTES() in
+ pngpread.c. Bug was introduced in 1.2.6rc1.
+ Fixed bug in RGB to RGBX transformation introduced in 1.2.6rc1.
+ Fixed old bug in RGB to Gray transformation.
+ Fixed problem with 64-bit compilers by casting arguments to abs()
+ to png_int_32.
+ Changed "ln -sf" to "ln -f -s" in three makefiles (solaris, sco, so9).
+ Changed "HANDLE_CHUNK_*" to "PNG_HANDLE_CHUNK_*" (Cosmin)
+ Added "-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)" to 15 *NIX makefiles.
+ Added code to update the row_info->colortype in png_do_read_filler() (MSB).
+version 1.2.6rc3 [August 9, 2004]
+ Eliminated use of "abs()" in testing cHRM and gAMA values, to avoid
+ trouble with some 64-bit compilers. Created PNG_OUT_OF_RANGE() macro.
+ Revised documentation of png_set_keep_unknown_chunks().
+ Check handle_as_unknown status in pngpread.c, as in pngread.c previously.
+ Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_INTERNAL section of png.h
+ Added "rim" definitions for CONST4 and CONST6 in pnggccrd.c
+version 1.2.6rc4 [August 10, 2004]
+ Fixed mistake in pngtest.c introduced in 1.2.6rc2 (declaration of
+ "pinfo" was out of place).
+version 1.2.6rc5 [August 10, 2004]
+ Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_ASSEMBLER_CODE_SUPPORTED
+ section of png.h where they were inadvertently placed in version rc3.
+version 1.2.6rc6 [August 15, 2004]
+ Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1.
Send comments/corrections/commendations to
-png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
+png-implement@ccrc.wustl.edu or to glennrp@users.sourceforge.net
Glenn R-P
-Installing libpng version 1.2.5rc3 - September 18, 2002
+Installing libpng version 1.2.6 - August 15, 2004
Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be
version of zlib that's installed.
You can rename the directories that you downloaded (they
-might be called "libpng-1.2.5rc3" or "lpng109" and "zlib-1.1.4"
-or "zlib114") so that you have directories called "zlib" and "libpng".
+might be called "libpng-1.2.6" or "lpng109" and "zlib-1.1.3"
+or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
wince.txt
scripts
makefile.*
- libpng*.in
- mangle
- makefile.*
- mangle.in
pngtest.png
etc.
zlib
include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.5rc3)
- makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.5rc3,
+ makefile.linux => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.6)
+ makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.6,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
- makefile.aix => AIX makefile
+ makefile.aix => AIX/gcc makefile
makefile.cygwin => Cygwin/gcc makefile
- makefile.darwin => Darwin makefile
+ makefile.darwin => Darwin makefile, can use on MacosX
makefile.dec => DEC Alpha UNIX makefile
makefile.hpgcc => FreeBSD makefile
makefile.hpgcc => HPUX makefile using gcc
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
- makefile.macosx => MACOS X Makefile
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
makefile.ne0bsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng0.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.5rc3)
+ makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.6)
makefile.sunos => Sun makefile
- makefile.solaris => Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.5rc3)
- makefile.so9 => Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.5rc3)
+ makefile.solaris => Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.6)
+ makefile.so9 => Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.6)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
put the library in its final resting place (if you want to
do that, run "make install" in the zlib directory first if necessary).
Some also allow you to run "make test-installed" after you have
-run "make install". This will build and run executables called "pngtesti"
-and "mangle/pngtestm".
-
-The files that are presently available in the mangle directory include the
-following. The makefiles are automatically run by the corresponding makefiles
-in the scripts directory when you run "make", "make install", or
-"make test-installed".
-
- mangle.in => Function-decoration macros added to png.h by the
- makefiles.
- makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12m.so.0.1.2.5rc3)
- makefile.gcmmx => Linux/ELF makefile (gcc, creates
- libpng12.so.0m.1.2.5rc3, uses assembler code
- tuned for Intel MMX platform)
- makefile.sgi => Silicon Graphics (cc, creates libpng12m.so)
- makefile.sggcc => Silicon Graphics (gcc, creates libpng12m.so)
+run "make install".
+
+If you encounter a compiler error message complaining about the
+lines
+ __png.h__ already includes setjmp.h;
+ __dont__ include it again.;
+This means you have compiled another module that includes setjmp.h,
+which is hazardous because the two modules might not include exactly
+the same setjmp.h. If you are sure that you know what you are doing
+and that they are exactly the same, then you can comment out or
+delete the two lines. Better yet, use the cexcept interface
+instead, as demonstrated in contrib/visupng of the libpng distribution.
Further information can be found in the README and libpng.txt
-files, in the individual makefiles, in png.h, in the README files in
-subdirectories of the LIB directory, and the manual pages libpng.3 and png.5.
+files, in the individual makefiles, in png.h, and the manual pages
+libpng.3 and png.5.
-Known bugs in libpng version 1.2.5rc3
+Known bugs in libpng version 1.2.6
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
If you modify libpng you may insert additional notices immediately following
this sentence.
-libpng versions 1.0.7, July 1, 2000, through 1.2.5rc3, September 18, 2002, are
-Copyright (c) 2000-2002 Glenn Randers-Pehrson
-and are distributed according to the same disclaimer and license as libpng-1.0.6
+libpng version 1.2.6, August 15, 2004, is
+Copyright (c) 2004 Glenn Randers-Pehrson, and is
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
Simon-Pierre Cadieux
certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
-randeg@alum.rpi.edu
-September 18, 2002
+glennrp@users.sourceforge.net
+August 15, 2004
-README for libpng 1.2.5rc3 - September 18, 2002 (shared library 12.0)
+README for libpng version 1.2.6 - August 15, 2004 (shared library 12.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
-Libpng comes in two distribution formats. Get libpng-*.tar.gz if you
-want UNIX-style line endings in the text files, or lpng*.zip if you want
-DOS-style line endings.
+Libpng comes in several distribution formats. Get libpng-*.tar.gz
+or libpng-*.tar.bz2 if you want UNIX-style line endings in the text
+files, or lpng*.zip if you want DOS-style line endings.
Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in
This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG group.
-randeg@alum.rpi.edu
+glennrp@users.sourceforge.net
png-implement@ccrc.wustl.edu
You can't reach Guy, the original libpng author, at the addresses
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.5rc3)
+ (gcc, creates libpng12.so.0.1.2.5)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
- libpng12.so.0.1.2.5rc3, uses assembler code
+ libpng12.so.0.1.2.5, uses assembler code
tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
makefile.ne0bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng0.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
- makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.5rc3)
+ makefile.sggcc => Silicon Graphics (gcc, creates libpng12.so.0.1.2.5)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
- (gcc, creates libpng12.so.0.1.2.5rc3)
+ (gcc, creates libpng12.so.0.1.2.5)
makefile.so9 => Solaris 9 makefile
- (gcc, creates libpng12.so.0.1.2.5rc3)
+ (gcc, creates libpng12.so.0.1.2.5)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
mangle.in => Function-decoration macros added to png.h by the
makefiles.
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12m.so.0.1.2.5rc3)
+ (gcc, creates libpng12m.so.0.1.2.5)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
- libpng12.so.0m.1.2.5rc3, uses assembler code
+ libpng12.so.0m.1.2.5, uses assembler code
tuned for Intel MMX platform)
makefile.sgi => Silicon Graphics (cc, creates libpng12m.so)
makefile.sggcc => Silicon Graphics (gcc, creates libpng12m.so)
Y2K compliance in libpng:
=========================
- September 18, 2002
+ August 15, 2004
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
- upward through 1.2.5rc3 are Y2K compliant. It is my belief that earlier
+ upward through 1.2.6 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer
+#!/bin/sh
echo "
- There is no \"configure\" script for Libpng-1.2.5rc3. Instead, please
- copy the appropriate makefile for your system from the \"scripts\"
- directory. Read the INSTALL file for more details.
+ There is no \"configure\" script in this distribution of
+ libpng-1.2.6.
+
+ Instead, please copy the appropriate makefile for your system from the
+ \"scripts\" directory. Read the INSTALL file for more details.
+
+ Update, July 2004: you can get a "configure" based distribution
+ from the libpng distribution sites. Download the file
+ libpng-1.2.6-config.tar.gz
"
/* set the palette if there is one. REQUIRED for indexed-color images */
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
- * sizeof (png_color));
+ * png_sizeof (png_color));
/* ... set palette colors ... */
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
/* You must not free palette here, because png_set_PLTE only makes a link to
png_uint_32 k, height, width;
png_byte image[height][width*bytes_per_pixel];
png_bytep row_pointers[height];
+
for (k = 0; k < height; k++)
row_pointers[k] = image + k*width*bytes_per_pixel;
-.TH LIBPNG 3 "September 18, 2002"
+.TH LIBPNG 3 "August 15, 2004"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.5rc3
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6
.SH SYNOPSIS
\fI\fB
\fI\fB
-\fBpng_uint_32 png_get_asm_flags (png_structp \fIpng_ptr\fP\fB);\fP
-
-\fI\fB
-
\fBpng_byte png_get_bit_depth (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
-\fBpng_byte png_get_mmx_bitdepth_threshold (png_structp \fIpng_ptr\fP\fB);\fP
-
-\fI\fB
-
-\fBpng_uint_32 png_get_mmx_flagmask (int \fP\fIflag_select\fP\fB, int \fI*compilerID\fP\fB);\fP
-
-\fI\fB
-
-\fBpng_uint_32 png_get_mmx_rowbytes_threshold (png_structp \fIpng_ptr\fP\fB);\fP
-
-\fI\fB
-
\fBpng_uint_32 png_get_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*offset_x\fP\fB, png_uint_32 \fP\fI*offset_y\fP\fB, int \fI*unit_type\fP\fB);\fP
\fI\fB
\fI\fB
+\fBpng_uint_32 png_get_user_height_max( png_structp \fIpng_ptr\fP\fB);\fP
+
+\fI\fB
+
\fBpng_voidp png_get_user_transform_ptr (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
+\fBpng_uint_32 png_get_user_width_max (png_structp \fIpng_ptr\fP\fB);\fP
+
+\fI\fB
+
\fBpng_uint_32 png_get_valid (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIflag\fP\fB);\fP
\fI\fB
\fI\fB
-\fBpng_voidp png_malloc_warn (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP
-
-\fI\fB
-
\fBvoidp png_memcpy (png_voidp \fP\fIs1\fP\fB, png_voidp \fP\fIs2\fP\fB, png_size_t \fIsize\fP\fB);\fP
\fI\fB
\fI\fB
-\fBint png_mmx_support \fI(void\fP\fB);\fP
-
-\fI\fB
-
\fBDEPRECATED: void png_permit_empty_plte (png_structp \fP\fIpng_ptr\fP\fB, int \fIempty_plte_permitted\fP\fB);\fP
\fI\fB
\fI\fB
-\fBpng_set_asm_flags (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIasm_flags\fP\fB);\fP
-
-\fI\fB
-
\fBvoid png_set_background (png_structp \fP\fIpng_ptr\fP\fB, png_color_16p \fP\fIbackground_color\fP\fB, int \fP\fIbackground_gamma_code\fP\fB, int \fP\fIneed_expand\fP\fB, double \fIbackground_gamma\fP\fB);\fP
\fI\fB
\fI\fB
-\fBpng_set_mmx_thresholds (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fP\fImmx_bitdepth_threshold\fP\fB, png_uint_32 \fImmx_rowbytes_threshold\fP\fB);\fP
-
-\fI\fB
-
\fBvoid png_set_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIoffset_x\fP\fB, png_uint_32 \fP\fIoffset_y\fP\fB, int \fIunit_type\fP\fB);\fP
\fI\fB
\fI\fB
-\fBvoid png_set_strip_error_numbers (png_structp \fIpng_ptr,
-
-\fBpng_uint_32 \fIstrip_mode\fP\fB);\fP
-
-\fI\fB
-
\fBvoid png_set_swap (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
+\fBvoid png_set_user_limits (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIuser_width_max\fP\fB, png_uint_32 \fIuser_height_max\fP\fB);\fP
+
+\fI\fB
+
\fBvoid png_set_user_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_transform_ptr\fP\fB, int \fP\fIuser_transform_depth\fP\fB, int \fIuser_transform_channels\fP\fB);\fP
\fI\fB
\fI\fB
+\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
+
+\fI\fB
+
+\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
+
+\fI\fB
+
.SH DESCRIPTION
The
.I libpng
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
- libpng version 1.2.5rc3 - September 18, 2002
+ libpng version 1.2.6 - August 15, 2004
Updated and distributed by Glenn Randers-Pehrson
- <randeg@alum.rpi.edu>
- Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ <glennrp@users.sourceforge.net>
+ Copyright (c) 1998-2004 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h.
png_set_read_status_fn(png_ptr, read_row_callback);
+%-%.SS Width and height limits
+%-%
+%-%The PNG specification allows the width and height of an image to be as
+%-%large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
+%-%Since very few applications really need to process such large images,
+%-%we have imposed an arbitrary 1-million limit on rows and columns.
+%-%Larger images will be rejected immediately with a png_error() call. If
+%-%you wish to override this limit, you can use
+%-%
+%-% png_set_user_limits(png_ptr, width_max, height_max);
+%-%
+%-%to set your own limits, or use width_max = height_max = 0x7fffffffL
+%-%to allow all valid dimensions (libpng may reject some very large images
+%-%anyway because of potential buffer overflow conditions).
+%-%
+%-%You should put this statement after you create the PNG structure and
+%-%before calling png_read_info(), png_read_png(), or png_process_data().
+%-%If you need to retrieve the limits that are being applied, use
+%-%
+%-% width_max = png_get_user_width_max(png_ptr);
+%-% height_max = png_get_user_height_max(png_ptr);
+%-%
.SS Unknown-chunk handling
Now you get to set the way the library processes unknown chunks in the
various info_ptr members; unknown chunks will be discarded. To change
this, you can call:
- png_set_keep_unknown_chunks(png_ptr, info_ptr, keep,
+ png_set_keep_unknown_chunks(png_ptr, keep,
chunk_list, num_chunks);
- keep - 0: do not keep
- 1: keep only if safe-to-copy
- 2: keep even if unsafe-to-copy
+ keep - 0: do not handle as unknown
+ 1: do not keep
+ 2: keep only if safe-to-copy
+ 3: keep even if unsafe-to-copy
+ You can use these definitions:
+ PNG_HANDLE_CHUNK_AS_DEFAULT 0
+ PNG_HANDLE_CHUNK_NEVER 1
+ PNG_HANDLE_CHUNK_IF_SAFE 2
+ PNG_HANDLE_CHUNK_ALWAYS 3
chunk_list - list of chunks affected (a byte string,
five bytes per chunk, NULL or '\0' if
num_chunks is 0)
num_chunks - number of chunks affected; if 0, all
- unknown chunks are affected
+ unknown chunks are affected. If nonzero,
+ only the chunks in the list are affected
Unknown chunks declared in this way will be saved as raw data onto a
list of png_unknown_chunk structures. If a chunk that is normally
known to libpng is named in the list, it will be handled as unknown,
according to the "keep" directive. If a chunk is named in successive
instances of png_set_keep_unknown_chunks(), the final instance will
-take precedence.
+take precedence. The IHDR and IEND chunks should not be named in
+chunk_list; if they are, libpng will process them normally anyway.
.SS The high-level read interface
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
+ if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
+ png_error (png_ptr,
+ "Image is too tall to process in memory");
+ if (width > PNG_UINT_32_MAX/pixel_size)
+ png_error (png_ptr,
+ "Image is too wide to process in memory");
row_pointers = png_malloc(png_ptr,
- height*sizeof(png_bytep));
+ height*png_sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr,
width*pixel_size);
to use a different method of allocating and freeing data, you can use
png_create_read_struct_2() or png_create_write_struct_2() to register
your own functions as described above.
-
These functions also provide a void pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr);
png_size_t size);
void free_fn(png_structp png_ptr, png_voidp ptr);
-Your malloc_fn() should return NULL in case of failure. The png_malloc()
-function will call png_error() if it receives a NULL from the system
-memory allocator or from your replacement malloc_fn().
+Your malloc_fn() must return NULL in case of failure. The png_malloc()
+function will normally call png_error() if it receives a NULL from the
+system memory allocator or from your replacement malloc_fn().
Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in
having level = 0 will be printed. There aren't any such statements in
this version of libpng, but if you insert some they will be printed.
-.SH VI. Runtime optimization
-
-A new feature in libpng 1.2.0 is the ability to dynamically switch between
-standard and optimized versions of some routines. Currently these are
-limited to three computationally intensive tasks when reading PNG files:
-decoding row filters, expanding interlacing, and combining interlaced or
-transparent row data with previous row data. Currently the optimized
-versions are available only for x86 (Intel, AMD, etc.) platforms with
-MMX support, though this may change in future versions. (For example,
-the non-MMX assembler optimizations for zlib might become similarly
-runtime-selectable in future releases, in which case libpng could be
-extended to support them. Alternatively, the compile-time choice of
-floating-point versus integer routines for gamma correction might become
-runtime-selectable.)
-
-Because such optimizations tend to be very platform- and compiler-dependent,
-both in how they are written and in how they perform, the new runtime code
-in libpng has been written to allow programs to query, enable, and disable
-either specific optimizations or all such optimizations. For example, to
-enable all possible optimizations (bearing in mind that some "optimizations"
-may actually run more slowly in rare cases):
-
- #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
- png_uint_32 mask, flags;
-
- flags = png_get_asm_flags(png_ptr);
- mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
- png_set_asm_flags(png_ptr, flags | mask);
- #endif
-
-To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
-by itself when calling png_get_asm_flagmask(); similarly for optimizing
-only writing. To disable all optimizations:
-
- #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
- flags = png_get_asm_flags(png_ptr);
- mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
- png_set_asm_flags(png_ptr, flags & ~mask);
- #endif
-
-To enable or disable only MMX-related features, use png_get_mmx_flagmask()
-in place of png_get_asm_flagmask(). The mmx version takes one additional
-parameter:
-
- #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
- int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
- int compilerID;
-
- mask = png_get_mmx_flagmask(selection, &compilerID);
- #endif
-
-On return, compilerID will indicate which version of the MMX assembler
-optimizations was compiled. Currently two flavors exist: Microsoft
-Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
-On non-x86 platforms or on systems compiled without MMX optimizations, a
-value of -1 is used.
-
-Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
-all valid, settable optimization bits for the version of the library that's
-currently in use. In the case of shared (dynamically linked) libraries,
-this may include optimizations that did not exist at the time the code was
-written and compiled. It is also possible, of course, to enable only known,
-specific optimizations; for example:
-
- #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
- flags = PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
- | PNG_ASM_FLAG_MMX_READ_INTERLACE \
- | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
- | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
- | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
- | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
- png_set_asm_flags(png_ptr, flags);
- #endif
-
-This method would enable only the MMX read-optimizations available at the
-time of libpng 1.2.0's release, regardless of whether a later version of
-the DLL were actually being used. (Also note that these functions did not
-exist in versions older than 1.2.0, so any attempt to run a dynamically
-linked app on such an older version would fail.)
-
-To determine whether the processor supports MMX instructions at all, use
-the png_mmx_support() function:
-
- #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
- mmxsupport = png_mmx_support();
- #endif
-
-It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
-is compiled but MMX is not supported by the processor, or 1 if MMX support
-is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
-and png_get_asm_flagmask() all may be called without allocating and ini-
-tializing any PNG structures (for example, as part of a usage screen or
-"about" box).
-
-The following code can be used to prevent an application from using the
-thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
-defined:
-
-#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
- && defined(PNG_THREAD_UNSAFE_OK)
- /* Disable thread-unsafe features of pnggccrd */
- if (png_access_version() >= 10200)
- {
- png_uint_32 mmx_disable_mask = 0;
- png_uint_32 asm_flags;
-
- mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
- | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
- | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
- | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
- asm_flags = png_get_asm_flags(png_ptr);
- png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
- }
-#endif
-
-For more extensive examples of runtime querying, enabling and disabling
-of optimized features, see contrib/gregbook/readpng2.c in the libpng
-source-code distribution.
-
-
-.SH VII. MNG support
+%-%.SH VI. Runtime optimization
+%-%
+%-%A new feature in libpng 1.2.0 is the ability to dynamically switch between
+%-%standard and optimized versions of some routines. Currently these are
+%-%limited to three computationally intensive tasks when reading PNG files:
+%-%decoding row filters, expanding interlacing, and combining interlaced or
+%-%transparent row data with previous row data. Currently the optimized
+%-%versions are available only for x86 (Intel, AMD, etc.) platforms with
+%-%MMX support, though this may change in future versions. (For example,
+%-%the non-MMX assembler optimizations for zlib might become similarly
+%-%runtime-selectable in future releases, in which case libpng could be
+%-%extended to support them. Alternatively, the compile-time choice of
+%-%floating-point versus integer routines for gamma correction might become
+%-%runtime-selectable.)
+%-%
+%-%Because such optimizations tend to be very platform- and compiler-dependent,
+%-%both in how they are written and in how they perform, the new runtime code
+%-%in libpng has been written to allow programs to query, enable, and disable
+%-%either specific optimizations or all such optimizations. For example, to
+%-%enable all possible optimizations (bearing in mind that some "optimizations"
+%-%may actually run more slowly in rare cases):
+%-%
+%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
+%-% png_uint_32 mask, flags;
+%-%
+%-% flags = png_get_asm_flags(png_ptr);
+%-% mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
+%-% png_set_asm_flags(png_ptr, flags | mask);
+%-% #endif
+%-%
+%-%To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ
+%-%by itself when calling png_get_asm_flagmask(); similarly for optimizing
+%-%only writing. To disable all optimizations:
+%-%
+%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
+%-% flags = png_get_asm_flags(png_ptr);
+%-% mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE);
+%-% png_set_asm_flags(png_ptr, flags & ~mask);
+%-% #endif
+%-%
+%-%To enable or disable only MMX-related features, use png_get_mmx_flagmask()
+%-%in place of png_get_asm_flagmask(). The mmx version takes one additional
+%-%parameter:
+%-%
+%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
+%-% int selection = PNG_SELECT_READ | PNG_SELECT_WRITE;
+%-% int compilerID;
+%-%
+%-% mask = png_get_mmx_flagmask(selection, &compilerID);
+%-% #endif
+%-%
+%-%On return, compilerID will indicate which version of the MMX assembler
+%-%optimizations was compiled. Currently two flavors exist: Microsoft
+%-%Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2).
+%-%On non-x86 platforms or on systems compiled without MMX optimizations, a
+%-%value of -1 is used.
+%-%
+%-%Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return
+%-%all valid, settable optimization bits for the version of the library that's
+%-%currently in use. In the case of shared (dynamically linked) libraries,
+%-%this may include optimizations that did not exist at the time the code was
+%-%written and compiled. It is also possible, of course, to enable only known,
+%-%specific optimizations; for example:
+%-%
+%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
+%-% flags = PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
+%-% | PNG_ASM_FLAG_MMX_READ_INTERLACE \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_UP \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ;
+%-% png_set_asm_flags(png_ptr, flags);
+%-% #endif
+%-%
+%-%This method would enable only the MMX read-optimizations available at the
+%-%time of libpng 1.2.0's release, regardless of whether a later version of
+%-%the DLL were actually being used. (Also note that these functions did not
+%-%exist in versions older than 1.2.0, so any attempt to run a dynamically
+%-%linked app on such an older version would fail.)
+%-%
+%-%To determine whether the processor supports MMX instructions at all, use
+%-%the png_mmx_support() function:
+%-%
+%-% #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
+%-% mmxsupport = png_mmx_support();
+%-% #endif
+%-%
+%-%It returns -1 if MMX support is not compiled into libpng, 0 if MMX code
+%-%is compiled but MMX is not supported by the processor, or 1 if MMX support
+%-%is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(),
+%-%and png_get_asm_flagmask() all may be called without allocating and ini-
+%-%tializing any PNG structures (for example, as part of a usage screen or
+%-%"about" box).
+%-%
+%-%The following code can be used to prevent an application from using the
+%-%thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK
+%-%defined:
+%-%
+%-%#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
+%-% && defined(PNG_THREAD_UNSAFE_OK)
+%-% /* Disable thread-unsafe features of pnggccrd */
+%-% if (png_access_version() >= 10200)
+%-% {
+%-% png_uint_32 mmx_disable_mask = 0;
+%-% png_uint_32 asm_flags;
+%-%
+%-% mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
+%-% | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
+%-% asm_flags = png_get_asm_flags(png_ptr);
+%-% png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
+%-% }
+%-%#endif
+%-%
+%-%For more extensive examples of runtime querying, enabling and disabling
+%-%of optimized features, see contrib/gregbook/readpng2.c in the libpng
+%-%source-code distribution.
+%-%
+.SH VI. MNG support
The MNG specification (available at http://www.libpng.org/pub/mng) allows
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
PNG_FLAG_MNG_EMPTY_PLTE
PNG_FLAG_MNG_FILTER_64
PNG_ALL_MNG_FEATURES
- feature_set is a png_32_uint that is the logical AND of
+ feature_set is a png_uint_32 that is the logical AND of
your mask with the set of MNG features that is
supported by the version of libpng that you are using.
them. You may wish to consider using libmng (available at
http://www.libmng.com) instead.
-.SH VIII. Changes to Libpng from version 0.88
+.SH VII. Changes to Libpng from version 0.88
It should be noted that versions of libpng later than 0.96 are not
distributed by the original libpng author, Guy Schalnat, nor by
png_uint_32 application_vn = PNG_LIBPNG_VER;
-.SH IX. Y2K Compliance in libpng
+.SH VII. Y2K Compliance in libpng
-September 18, 2002
+August 15, 2004
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.5rc3 are Y2K compliant. It is my belief that earlier
+upward through 1.2.6 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
1.2.4rc1 13 10204 12.so.0.1.2.4rc1
1.0.14 10 10014 10.so.0.1.0.14
1.2.4 13 10204 12.so.0.1.2.4
- 1.2.5beta1,2 13 10205 12.so.0.1.2.5beta1,2
- 1.2.5rc1,3 13 10205 12.so.0.1.2.5rc1,3
- 1.0.15rc1,3 10 10015 10.so.0.1.0.15rc1,3
+ 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
+ 1.0.15rc1 10 10015 10.so.0.1.0.15rc1
+ 1.0.15 10 10015 10.so.0.1.0.15
+ 1.2.5 13 10205 12.so.0.1.2.5
+ 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
+ 1.2.6rc1-5 13 10206 12.so.0.1.2.6rc1-5
+ 1.0.16 10 10016 10.so.0.1.0.16
+ 1.2.6 13 10206 12.so.0.1.2.6
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
.SH AUTHORS
This man page: Glenn Randers-Pehrson
-<randeg@alum.rpi.edu>
+<glennrp@users.sourceforge.net>
The contributing authors would like to thank all those who helped
with testing, bug fixes, and patience. This wouldn't have been
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.2.5rc3 - September 18, 2002:
+Libpng version 1.2.6 - August 15, 2004:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
-Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
+Currently maintained by Glenn Randers-Pehrson (glennrp@users.sourceforge.net).
Supported by the PNG development group
.br
If you modify libpng you may insert additional notices immediately following
this sentence.
-libpng versions 1.0.7, July 1, 2000, through 1.2.5rc3, September 18, 2002, are
+libpng version 1.2.6, August 15, 2004, is
+Copyright (c) 2004 Glenn Randers-Pehrson, and is
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
-randeg@alum.rpi.edu
-September 18, 2002
+glennrp@users.sourceforge.net
+August 15, 2004
.\" end of man page
libpng.txt - A description on how to use and modify libpng
- libpng version 1.2.5rc3 - September 18, 2002
+ libpng version 1.2.6 - August 15, 2004
Updated and distributed by Glenn Randers-Pehrson
- <randeg@alum.rpi.edu>
- Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ <glennrp@users.sourceforge.net>
+ Copyright (c) 1998-2004 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h.
png_set_read_status_fn(png_ptr, read_row_callback);
+Width and height limits
+
+The PNG specification allows the width and height of an image to be as
+large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
+Since very few applications really need to process such large images,
+we have imposed an arbitrary 1-million limit on rows and columns.
+Larger images will be rejected immediately with a png_error() call. If
+you wish to override this limit, you can use
+
+ png_set_user_limits(png_ptr, width_max, height_max);
+
+to set your own limits, or use width_max = height_max = 0x7fffffffL
+to allow all valid dimensions (libpng may reject some very large images
+anyway because of potential buffer overflow conditions).
+
+You should put this statement after you create the PNG structure and
+before calling png_read_info(), png_read_png(), or png_process_data().
+If you need to retrieve the limits that are being applied, use
+
+ width_max = png_get_user_width_max(png_ptr);
+ height_max = png_get_user_height_max(png_ptr);
+
Unknown-chunk handling
Now you get to set the way the library processes unknown chunks in the
various info_ptr members; unknown chunks will be discarded. To change
this, you can call:
- png_set_keep_unknown_chunks(png_ptr, info_ptr, keep,
+ png_set_keep_unknown_chunks(png_ptr, keep,
chunk_list, num_chunks);
- keep - 0: do not keep
- 1: keep only if safe-to-copy
- 2: keep even if unsafe-to-copy
+ keep - 0: do not handle as unknown
+ 1: do not keep
+ 2: keep only if safe-to-copy
+ 3: keep even if unsafe-to-copy
+ You can use these definitions:
+ PNG_HANDLE_CHUNK_AS_DEFAULT 0
+ PNG_HANDLE_CHUNK_NEVER 1
+ PNG_HANDLE_CHUNK_IF_SAFE 2
+ PNG_HANDLE_CHUNK_ALWAYS 3
chunk_list - list of chunks affected (a byte string,
five bytes per chunk, NULL or '\0' if
num_chunks is 0)
num_chunks - number of chunks affected; if 0, all
- unknown chunks are affected
+ unknown chunks are affected. If nonzero,
+ only the chunks in the list are affected
Unknown chunks declared in this way will be saved as raw data onto a
list of png_unknown_chunk structures. If a chunk that is normally
known to libpng is named in the list, it will be handled as unknown,
according to the "keep" directive. If a chunk is named in successive
instances of png_set_keep_unknown_chunks(), the final instance will
-take precedence.
+take precedence. The IHDR and IEND chunks should not be named in
+chunk_list; if they are, libpng will process them normally anyway.
The high-level read interface
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
+ if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
+ png_error (png_ptr,
+ "Image is too tall to process in memory");
+ if (width > PNG_UINT_32_MAX/pixel_size)
+ png_error (png_ptr,
+ "Image is too wide to process in memory");
row_pointers = png_malloc(png_ptr,
- height*sizeof(png_bytep));
+ height*png_sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr,
width*pixel_size);
to use a different method of allocating and freeing data, you can use
png_create_read_struct_2() or png_create_write_struct_2() to register
your own functions as described above.
-
These functions also provide a void pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr);
png_size_t size);
void free_fn(png_structp png_ptr, png_voidp ptr);
-Your malloc_fn() should return NULL in case of failure. The png_malloc()
-function will call png_error() if it receives a NULL from the system
-memory allocator or from your replacement malloc_fn().
+Your malloc_fn() must return NULL in case of failure. The png_malloc()
+function will normally call png_error() if it receives a NULL from the
+system memory allocator or from your replacement malloc_fn().
Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in
of optimized features, see contrib/gregbook/readpng2.c in the libpng
source-code distribution.
-
-VII. MNG support
+VI. MNG support
The MNG specification (available at http://www.libpng.org/pub/mng) allows
certain extensions to PNG for PNG images that are embedded in MNG datastreams.
PNG_FLAG_MNG_EMPTY_PLTE
PNG_FLAG_MNG_FILTER_64
PNG_ALL_MNG_FEATURES
- feature_set is a png_32_uint that is the logical AND of
+ feature_set is a png_uint_32 that is the logical AND of
your mask with the set of MNG features that is
supported by the version of libpng that you are using.
them. You may wish to consider using libmng (available at
http://www.libmng.com) instead.
-VIII. Changes to Libpng from version 0.88
+VII. Changes to Libpng from version 0.88
It should be noted that versions of libpng later than 0.96 are not
distributed by the original libpng author, Guy Schalnat, nor by
png_uint_32 application_vn = PNG_LIBPNG_VER;
-IX. Y2K Compliance in libpng
+VII. Y2K Compliance in libpng
-September 18, 2002
+August 15, 2004
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.5rc3 are Y2K compliant. It is my belief that earlier
+upward through 1.2.6 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
-.TH LIBPNGPF 3 "September 18, 2002"
+.TH LIBPNGPF 3 "August 15, 2004"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.5rc3
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.6
(private functions)
.SH SYNOPSIS
-\fB#include <png.h>\fP
+\fB\fB#include <png.h>\fP\fP
\fI\fB
-\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP
+\fB\fBvoid png_build_gamma_table (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
+\fB\fBvoid png_build_grayscale_palette (int \fP\fI\fP\fIbit_depth\fP\fB\fP\fB, png_colorp \fI\fIpalette\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
+\fB\fBvoid png_calculate_crc (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIptr\fP\fB\fP\fB, png_size_t \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_check_chunk_name (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fI\fIchunk_name\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP
+\fB\fBpng_size_t png_check_keyword (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIkey\fP\fB\fP\fB, png_charpp \fI\fInew_key\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
+\fB\fBvoid png_combine_row (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, int \fI\fImask\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBpng_charp png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
+\fB\fBvoid png_correct_palette (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_colorp \fP\fI\fP\fIpalette\fP\fB\fP\fB, int \fI\fInum_palette\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
+\fB\fBint png_crc_error (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBint png_crc_finish (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIskip\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
+\fB\fBvoid png_crc_read (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIbuf\fP\fB\fP\fB, png_size_t \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP
+\fB\fBpng_voidp png_create_struct (int \fI\fItype\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBpng_voidp png_create_struct_2 (int \fP\fI\fP\fItype\fP\fB\fP\fB, png_malloc_ptr \fP\fI\fP\fImalloc_fn\fP\fB\fP\fB, png_voidp \fI\fImem_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBpng_charp png_decompress_chunk (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, int \fP\fI\fP\fIcomp_type\fP\fB\fP\fB, png_charp \fP\fI\fP\fIchunkdata\fP\fB\fP\fB, png_size_t \fP\fI\fP\fIchunklength\fP\fB\fP\fB, png_size_t \fP\fI\fP\fIprefix_length\fP\fB\fP\fB, png_size_t \fI\fI*data_length\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP
+\fB\fBvoid png_destroy_struct (png_voidp \fI\fIstruct_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBvoid png_destroy_struct_2 (png_voidp \fP\fI\fP\fIstruct_ptr\fP\fB\fP\fB, png_free_ptr \fP\fI\fP\fIfree_fn\fP\fB\fP\fB, png_voidp \fI\fImem_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBvoid png_do_background (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_color_16p \fP\fI\fP\fItrans_values\fP\fB\fP\fB, png_color_16p \fP\fI\fP\fIbackground\fP\fB\fP\fB, png_color_16p \fP\fI\fP\fIbackground_1\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIgamma_table\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIgamma_from_1\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIgamma_to_1\fP\fB\fP\fB, png_uint_16pp \fP\fI\fP\fIgamma_16\fP\fB\fP\fB, png_uint_16pp \fP\fI\fP\fIgamma_16_from_1\fP\fB\fP\fB, png_uint_16pp \fP\fI\fP\fIgamma_16_to_1\fP\fB\fP\fB, int \fI\fIgamma_shift\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
+\fB\fBvoid png_do_bgr (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBvoid png_do_chop (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP
+\fB\fBvoid png_do_dither (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIpalette_lookup\fP\fB\fP\fB, png_bytep \fI\fIdither_lookup\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBvoid png_do_expand (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_color_16p \fI\fItrans_value\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP
+\fB\fBvoid png_do_expand_palette (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_colorp \fP\fI\fP\fIpalette\fP\fB\fP\fB, png_bytep \fP\fI\fP\fItrans\fP\fB\fP\fB, int \fI\fInum_trans\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBpng_int_32 png_get_int_32 (png_bytep \fIbuf\fP\fB);\fP
+\fB\fBvoid png_do_gamma (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIgamma_table\fP\fB\fP\fB, png_uint_16pp \fP\fI\fP\fIgamma_16_table\fP\fB\fP\fB, int \fI\fIgamma_shift\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBpng_uint_16 png_get_uint_16 (png_bytep \fIbuf\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBpng_uint_32 png_get_uint_32 (png_bytep \fIbuf\fP\fB);\fP
+\fB\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_invert (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_pack (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_uint_32 \fI\fIbit_depth\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_packswap (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_read_filler (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIfiller\fP\fB\fP\fB, png_uint_32 \fI\fIflags\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_read_interlace (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, int \fP\fI\fP\fIpass\fP\fB\fP\fB, png_uint_32 \fI\fItransformations\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_read_transformations (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBint png_do_rgb_to_gray (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_shift (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_color_8p \fI\fIbit_depth\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fB\fBvoid png_do_strip_filler (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_uint_32 \fI\fIflags\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_do_swap (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fB\fBvoid png_do_unpack (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_do_unshift (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_color_8p \fI\fIsig_bits\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_write_interlace (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, int \fI\fIpass\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fB\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fB\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
+\fB\fBvoid png_do_write_transformations (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fB\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fI\fP\fIptr\fP\fB\fP\fB, int \fI\fIcheck\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_flush (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fB\fBpng_int_32 png_get_int_32 (png_bytep \fI\fIbuf\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
+\fB\fBpng_uint_16 png_get_uint_16 (png_bytep \fI\fIbuf\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
+\fB\fBpng_uint_32 png_get_uint_31 (png_bytep \fI\fIbuf\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBpng_uint_32 png_get_uint_32 (png_bytep \fI\fIbuf\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_handle_bKGD (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_handle_cHRM (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_save_int_32 (png_bytep \fP\fIbuf\fP\fB, png_int_32 \fIi\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_save_uint_16 (png_bytep \fP\fIbuf\fP\fB, unsigned int \fIi\fP\fB);\fP
+\fB\fBvoid png_handle_gAMA (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_save_uint_32 (png_bytep \fP\fIbuf\fP\fB, png_uint_32 \fIi\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text)\fP\fB);\fP
+\fB\fBvoid png_handle_hIST (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP
+\fB\fBvoid png_handle_IEND (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
+\fB\fBvoid png_handle_IHDR (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_handle_iCCP (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP
+\fB\fBvoid png_handle_iTXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP
+\fB\fBvoid png_handle_oFFs (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_handle_pCAL (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext)\fP\fB);\fP
+\fB\fBvoid png_handle_pHYs (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP
+\fB\fBvoid png_handle_PLTE (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP
+\fB\fBvoid png_handle_sBIT (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP
+\fB\fBvoid png_handle_sCAL (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
+\fB\fBvoid png_handle_sPLT (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP
+\fB\fBvoid png_handle_sRGB (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP
+\fB\fBvoid png_handle_tEXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP
+\fB\fBvoid png_handle_tIME (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP
+\fI\fB\fI\fB
\fI\fB
-\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
+\fB\fBvoid png_handle_tRNS (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
\fI\fB
-\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_handle_unknown (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_handle_zTXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_info_destroy (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_init_mmx_flags (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_init_read_transformations (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_process_IDAT_data (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIbuffer\fP\fB\fP\fB, png_size_t \fI\fIbuffer_length\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_process_some_data (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_check_crc (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_crc_finish (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_crc_skip (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_fill_buffer (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIbuffer\fP\fB\fP\fB, png_size_t \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_handle_tEXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_handle_unknown (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_handle_zTXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_have_end (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_have_info (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_have_row (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fI\fIrow\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_process_row (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_read_chunk (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_read_end (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_read_IDAT (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_read_sig (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_read_tEXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_read_zTXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_restore_buffer (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIbuffer\fP\fB\fP\fB, png_size_t \fI\fIbuffer_length\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_push_save_buffer (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_read_data (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIdata\fP\fB\fP\fB, png_size_t \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_read_filter_row (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_row_infop \fP\fI\fP\fIrow_info\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIrow\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIprev_row\fP\fB\fP\fB, int \fI\fIfilter\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_read_finish_row (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_read_push_finish_row (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_read_start_row (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_read_transform_info (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fI\fIinfo_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_reset_crc (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_save_int_32 (png_bytep \fP\fI\fP\fIbuf\fP\fB\fP\fB, png_int_32 \fI\fIi\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_save_uint_16 (png_bytep \fP\fI\fP\fIbuf\fP\fB\fP\fB, unsigned int \fI\fIi\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_save_uint_32 (png_bytep \fP\fI\fP\fIbuf\fP\fB\fP\fB, png_uint_32 \fI\fIi\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBint png_set_text_2 (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_infop \fP\fI\fP\fIinfo_ptr\fP\fB\fP\fB, png_textp \fP\fI\fP\fItext_ptr\fP\fB\fP\fB, int \fI\fInum_text)\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_cHRM (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, double \fP\fI\fP\fIwhite_x\fP\fB\fP\fB, double \fP\fI\fP\fIwhite_y\fP\fB\fP\fB, double \fP\fI\fP\fIred_x\fP\fB\fP\fB, double \fP\fI\fP\fIred_y\fP\fB\fP\fB, double \fP\fI\fP\fIgreen_x\fP\fB\fP\fB, double \fP\fI\fP\fIgreen_y\fP\fB\fP\fB, double \fP\fI\fP\fIblue_x\fP\fB\fP\fB, double \fI\fIblue_y\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_cHRM_fixed (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIwhite_x\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIwhite_y\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIred_x\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIred_y\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIgreen_x\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIgreen_y\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIblue_x\fP\fB\fP\fB, png_uint_32 \fI\fIblue_y\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_data (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIdata\fP\fB\fP\fB, png_size_t \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_filtered_row (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fI\fIfiltered_row\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_find_filter (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_row_infop \fI\fIrow_info\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_finish_row (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_gAMA (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, double \fI\fIfile_gamma\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_gAMA_fixed (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fI\fIint_file_gamma\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_hIST (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_16p \fP\fI\fP\fIhist\fP\fB\fP\fB, int \fI\fInum_hist\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_iCCP (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIname\fP\fB\fP\fB, int \fP\fI\fP\fIcompression_type\fP\fB\fP\fB, png_charp \fP\fI\fP\fIprofile\fP\fB\fP\fB, int \fI\fIproflen\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_IDAT (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fIdata\fP\fB\fP\fB, png_size_t \fI\fIlength\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_IEND (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_IHDR (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIwidth\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIheight\fP\fB\fP\fB, int \fP\fI\fP\fIbit_depth\fP\fB\fP\fB, int \fP\fI\fP\fIcolor_type\fP\fB\fP\fB, int \fP\fI\fP\fIcompression_type\fP\fB\fP\fB, int \fP\fI\fP\fIfilter_type\fP\fB\fP\fB, int \fI\fIinterlace_type\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_iTXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, int \fP\fI\fP\fIcompression\fP\fB\fP\fB, png_charp \fP\fI\fP\fIkey\fP\fB\fP\fB, png_charp \fP\fI\fP\fIlang\fP\fB\fP\fB, png_charp \fP\fI\fP\fItranslated_key\fP\fB\fP\fB, png_charp \fI\fItext)\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_oFFs (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIx_offset\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIy_offset\fP\fB\fP\fB, int \fI\fIunit_type\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_pCAL (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIpurpose\fP\fB\fP\fB, png_int_32 \fP\fI\fP\fIX0\fP\fB\fP\fB, png_int_32 \fP\fI\fP\fIX1\fP\fB\fP\fB, int \fP\fI\fP\fItype\fP\fB\fP\fB, int \fP\fI\fP\fInparams\fP\fB\fP\fB, png_charp \fP\fI\fP\fIunits\fP\fB\fP\fB, png_charpp \fI\fIparams\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_pHYs (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIx_pixels_per_unit\fP\fB\fP\fB, png_uint_32 \fP\fI\fP\fIy_pixels_per_unit\fP\fB\fP\fB, int \fI\fIunit_type\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_PLTE (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_colorp \fP\fI\fP\fIpalette\fP\fB\fP\fB, png_uint_32 \fI\fInum_pal\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_sBIT (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_color_8p \fP\fI\fP\fIsbit\fP\fB\fP\fB, int \fI\fIcolor_type\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_sCAL (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIunit\fP\fB\fP\fB, double \fP\fI\fP\fIwidth\fP\fB\fP\fB, double \fI\fIheight\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_sCAL_s (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIunit\fP\fB\fP\fB, png_charp \fP\fI\fP\fIwidth\fP\fB\fP\fB, png_charp \fI\fIheight\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_sig (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_sRGB (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, int \fI\fIintent\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_sPLT (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_spalette_p \fI\fIpalette\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_start_row (png_structp \fI\fIpng_ptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_tEXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIkey\fP\fB\fP\fB, png_charp \fP\fI\fP\fItext\fP\fB\fP\fB, png_size_t \fI\fItext_len\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_tIME (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_timep \fI\fImod_time\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_tRNS (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_bytep \fP\fI\fP\fItrans\fP\fB\fP\fB, png_color_16p \fP\fI\fP\fIvalues\fP\fB\fP\fB, int \fP\fI\fP\fInumber\fP\fB\fP\fB, int \fI\fIcolor_type\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_write_zTXt (png_structp \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, png_charp \fP\fI\fP\fIkey\fP\fB\fP\fB, png_charp \fP\fI\fP\fItext\fP\fB\fP\fB, png_size_t \fP\fI\fP\fItext_len\fP\fB\fP\fB, int \fI\fIcompression\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoidpf png_zalloc (voidpf \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, uInt \fP\fI\fP\fIitems\fP\fB\fP\fB, uInt \fI\fIsize\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
+
+\fI\fB
+
+\fB\fBvoid png_zfree (voidpf \fP\fI\fP\fIpng_ptr\fP\fB\fP\fB, voidpf \fI\fIptr\fP\fB\fP\fB);\fP\fP
+
+\fI\fB
+
+\fI\fB\fI\fB
\fI\fB
-.TH PNG 5 "September 18, 2002"
+.TH PNG 5 "August 15, 2004"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
/* png.c - location for general purpose libpng functions
*
- * libpng version 1.2.5rc3 - September 18, 2002
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * libpng version 1.2.6 - August 15, 2004
+ * For conditions of distribution and use, see copyright notice in png.h
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
- *
*/
#define PNG_INTERNAL
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_5rc3 Your_png_h_is_not_version_1_2_5rc3;
+typedef version_1_2_6 Your_png_h_is_not_version_1_2_6;
/* Version information for C files. This had better match the version
* string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
-const char png_libpng_ver[18] = "1.2.5rc3";
+const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING;
/* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */
#endif
png_zalloc(voidpf png_ptr, uInt items, uInt size)
{
- png_uint_32 num_bytes = (png_uint_32)items * size;
png_voidp ptr;
png_structp p=(png_struct*)png_ptr;
png_uint_32 save_flags=p->flags;
+ png_uint_32 num_bytes;
+
+ if (items > PNG_UINT_32_MAX/size)
+ {
+ png_warning (png_ptr, "Potential overflow in png_zalloc()");
+ return (NULL);
+ }
+ num_bytes = (png_uint_32)items * size;
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
p->flags=save_flags;
-#ifndef PNG_NO_ZALLOC_ZERO
+#if defined(PNG_1_0_X) && !defined(PNG_NO_ZALLOC_ZERO)
if (ptr == NULL)
return ((voidpf)ptr);
/* Allocate the memory for an info_struct for the application. We don't
* really need the png_ptr, but it could potentially be useful in the
- * future. This should be used in favour of malloc(sizeof(png_info))
+ * future. This should be used in favour of malloc(png_sizeof(png_info))
* and png_info_init() so that applications that want to use a shared
* libpng don't have to be recompiled if png_info changes size.
*/
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
#endif
if (info_ptr != NULL)
- png_info_init_3(&info_ptr, sizeof(png_info));
+ png_info_init_3(&info_ptr, png_sizeof(png_info));
return (info_ptr);
}
png_debug(1, "in png_info_init_3\n");
- if(sizeof(png_info) > png_info_struct_size)
+ if(png_sizeof(png_info) > png_info_struct_size)
{
png_destroy_struct(info_ptr);
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
}
/* set everything to 0 */
- png_memset(info_ptr, 0, sizeof (png_info));
+ png_memset(info_ptr, 0, png_sizeof (png_info));
}
#ifdef PNG_FREE_ME_SUPPORTED
}
#endif
- png_info_init_3(&info_ptr, sizeof(png_info));
+ png_info_init_3(&info_ptr, png_sizeof(png_info));
}
/* This function returns a pointer to the io_ptr associated with the user
if (png_ptr->time_buffer == NULL)
{
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
- sizeof(char)));
+ png_sizeof(char)));
}
#if defined(_WIN32_WCE)
ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61);
png_memcpy(png_ptr->time_buffer, near_time_buf,
- 29*sizeof(char));
+ 29*png_sizeof(char));
}
#else
sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
- if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
- return ((png_charp) "\n libpng version 1.2.5rc3 - September 18, 2002\n\
- Copyright (c) 1998-2002 Glenn Randers-Pehrson\n\
+ if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
+ return ((png_charp) "\n libpng version 1.2.6 - August 15, 2004\n\
+ Copyright (c) 1998-2004 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\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
- * format 1.0.0 through 99.99.99zz. To get the version of *.h files used
- * with your application, print out PNG_LIBPNG_VER_STRING, which is defined
- * in png.h.
+ * format 1.0.0 through 99.99.99zz. To get the version of *.h files
+ * used with your application, print out PNG_LIBPNG_VER_STRING, which
+ * is defined in png.h.
+ * Note: now there is no difference between png_get_libpng_ver() and
+ * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard,
+ * it is guaranteed that png.c uses the correct version of png.h.
*/
-
png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
- if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
- return((png_charp) "1.2.5rc3");
- return((png_charp) "1.2.5rc3");
+ if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
+ return ((png_charp) PNG_LIBPNG_VER_STRING);
+ return ((png_charp) "");
}
png_charp PNGAPI
png_get_header_ver(png_structp png_ptr)
{
/* Version of *.h files used when building libpng */
- if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
- return((png_charp) PNG_LIBPNG_VER_STRING);
- return((png_charp) PNG_LIBPNG_VER_STRING);
+ if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
+ return ((png_charp) PNG_LIBPNG_VER_STRING);
+ return ((png_charp) "");
}
png_charp PNGAPI
png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
- if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
- return((png_charp) PNG_HEADER_VERSION_STRING);
- return((png_charp) PNG_HEADER_VERSION_STRING);
+ if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
+ return ((png_charp) PNG_HEADER_VERSION_STRING);
+ return ((png_charp) "");
}
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
png_access_version_number(void)
{
/* Version of *.c files used when building libpng */
- return((png_uint_32) 10205L);
+ return((png_uint_32) PNG_LIBPNG_VER);
}
}
#endif
#endif /* PNG_1_0_X */
+
+#ifdef PNG_SIZE_T
+/* Added at libpng version 1.2.6 */
+ PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
+png_size_t PNGAPI
+png_convert_size(size_t size)
+{
+ if (size > (png_size_t)-1)
+ PNG_ABORT(); /* We haven't got access to png_ptr, so no png_error() */
+ return ((png_size_t)size);
+}
+#endif /* PNG_SIZE_T */
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.5rc3 - September 18, 2002
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * libpng version 1.2.6 - August 15, 2004
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Authors and maintainers:
* 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.97, January 1998, through 1.2.5rc3 - September 18, 2002: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.6 - August 15, 2004: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
* 1.0.14 10 10014 10.so.0.1.0.14
* 1.2.4 13 10204 12.so.0.1.2.4
* 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
- * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
* 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
+ * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
+ * 1.0.15 10 10015 10.so.0.1.0.15
+ * 1.2.5 13 10205 12.so.0.1.2.5
+ * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
+ * 1.0.16 10 10016 10.so.0.1.0.16
+ * 1.2.6 13 10206 12.so.0.1.2.6
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
- * libpng versions 1.0.7, July 1, 2000, through 1.2.5rc3, September 18, 2002, are
+ * libpng version 1.2.6, August 15, 2004, is
+ * Copyright (c) 2004 Glenn Randers-Pehrson, and is
+ * distributed according to the same disclaimer and license as libpng-1.2.5
+ * with the following individual added to the list of Contributing Authors
+ *
+ * Cosmin Truta
+ *
+ * libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
* Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors
* Y2K compliance in libpng:
* =========================
*
- * September 18, 2002
+ * August 15, 2004
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.2.5rc3 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.6 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.5rc3"
+#define PNG_LIBPNG_VER_STRING "1.2.6"
+#define PNG_HEADER_VERSION_STRING \
+ " libpng version 1.2.6 - August 15, 2004 (header)\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2
-#define PNG_LIBPNG_VER_RELEASE 5
+#define PNG_LIBPNG_VER_RELEASE 6
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
* 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.1 it's xxyyzz, where x=major, y=minor, z=release */
-#define PNG_LIBPNG_VER 10205 /* 1.2.5 */
+#define PNG_LIBPNG_VER 10206 /* 1.2.6 */
#ifndef PNG_VERSION_INFO_ONLY
typedef png_info FAR * FAR * png_infopp;
/* Maximum positive integer used in PNG is (2^31)-1 */
-#define PNG_MAX_UINT ((png_uint_32)0x7fffffffL)
+#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
+#define PNG_UINT_32_MAX (~((png_uint_32)0))
+#define PNG_SIZE_MAX (~((png_size_t)0))
+/* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
+#define PNG_MAX_UINT PNG_UINT_31_MAX
/* These describe the color_type field in png_info. */
/* color type masks */
/* palette color */
#endif
+/* New members added in libpng-1.0.16 and 1.2.6 */
+ png_byte compression_type;
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ png_uint_32 user_width_max;
+ png_uint_32 user_height_max;
+#endif
+
};
-/* This prevents a compiler error in png.c if png.c and png.h are both at
- version 1.2.5rc3
+/* This triggers a compiler error in png.c, if png.c and png.h
+ * do not agree upon the version number.
*/
-typedef png_structp version_1_2_5rc3;
+typedef png_structp version_1_2_6;
typedef png_struct FAR * FAR * png_structpp;
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn));
+#ifdef PNG_WRITE_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
PNGARG((png_structp png_ptr));
+#endif
+#ifdef PNG_WRITE_SUPPORTED
extern PNG_EXPORT(void,png_set_compression_buffer_size)
PNGARG((png_structp png_ptr, png_uint_32 size));
+#endif
/* Reset the compression stream */
extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
/* Initialize the info structure (old interface - DEPRECATED) */
extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
#undef png_info_init
-#define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info));
+#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
+ png_sizeof(png_info));
extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
png_size_t png_info_struct_size));
extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* read the information before the actual image data. */
extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
+#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* read one or more rows of image data. */
extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
+#endif
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* read a row of data. */
extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
png_bytep row,
png_bytep display_row));
+#endif
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* read the whole image into memory at once. */
extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
png_bytepp image));
+#endif
/* write a row of image data */
extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
png_infop info_ptr));
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* read the end of the PNG file. */
extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
png_infop info_ptr));
+#endif
/* free any memory associated with the png_info_struct */
extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
png_ptr, png_uint_32 mng_features_permitted));
#endif
+/* For use in png_set_keep_unknown, added to version 1.2.6 */
+#define PNG_HANDLE_CHUNK_AS_DEFAULT 0
+#define PNG_HANDLE_CHUNK_NEVER 1
+#define PNG_HANDLE_CHUNK_IF_SAFE 2
+#define PNG_HANDLE_CHUNK_ALWAYS 3
+
/* Added to version 1.2.0 */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
#define PNG_SELECT_READ 1
#define PNG_SELECT_WRITE 2
-
#if !defined(PNG_1_0_X)
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
png_ptr, png_uint_32 strip_mode));
#endif
+
#endif /* PNG_1_0_X */
-/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
+/* Added at libpng-1.2.6 */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
+ png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));
+extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
+ png_ptr));
+extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
+ png_ptr));
+#endif
-#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.5rc3 - September 18, 2002 (header)\n"
+/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
-/* For use in png_set_keep_unknown, png_handle_as_unknown */
-#define HANDLE_CHUNK_AS_DEFAULT 0
-#define HANDLE_CHUNK_NEVER 1
-#define HANDLE_CHUNK_IF_SAFE 2
-#define HANDLE_CHUNK_ALWAYS 3
-
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
PNG_FLAG_CRC_CRITICAL_MASK)
/* save typing and make code easier to understand */
+
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue)))
+/* Added to libpng-1.2.6 JB */
+#define PNG_ROWBYTES(pixel_bits, width) \
+ ((pixel_bits) >= 8 ? \
+ ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
+ (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
+
+/* PNG_OUT_OF_RANGE returns true if value is outside the range
+ ideal-delta..ideal+delta. Each argument is evaluated twice.
+ "ideal" and "delta" should be constants, normally simple
+ integers, "value" a variable. Added to libpng-1.2.6 JB */
+#define PNG_OUT_OF_RANGE(value, ideal, delta) \
+ ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
+
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
/* place to hold the signature string for a PNG file. */
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
+PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr,
+ png_bytep buf));
/* Initialize png_ptr struct for reading, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_read_struct instead).
extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
#undef png_read_init
#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
- PNG_LIBPNG_VER_STRING, sizeof(png_struct));
+ PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size));
extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
#undef png_write_init
#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
- PNG_LIBPNG_VER_STRING, sizeof(png_struct));
+ PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size));
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
/* Function to free memory for zlib */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
+#ifdef PNG_SIZE_T
+/* Function to convert a sizeof an item to png_sizeof item */
+ PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
+#endif
+
/* Next four functions are used internally as callbacks. PNGAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
/* pngasmrd.h - assembler version of utilities to read a PNG file
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 2002 Glenn Randers-Pehrson
+ * Copyright (c) 2002-2004 Glenn Randers-Pehrson
*
*/
+
/* pngconf.h - machine configurable file for libpng
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
#ifndef PNGCONF_H
#define PNGCONF_H
+#ifdef PNG_USER_CONFIG
+#include "pngusr.h"
+#endif
+
/* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this
# undef _BSD_SOURCE
# endif
# ifdef _SETJMP_H
- __png.h__ already includes setjmp.h;
- __dont__ include it again.;
+ /* If you encounter a compiler error here, see the explanation
+ * near the end of INSTALL.
+ */
+ __png.h__ already includes setjmp.h;
+ __dont__ include it again.;
# endif
# endif /* __linux__ */
# define PNG_ALWAYS_EXTERN
#endif
-/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
- * stdlib.h like it should (I think). Or perhaps this is a C++
- * "feature"?
- */
-#ifdef __TURBOC__
+/* This provides the non-ANSI (far) memory allocation routines. */
+#if defined(__TURBOC__) && defined(__MSDOS__)
# include <mem.h>
-# include "alloc.h"
+# include <alloc.h>
#endif
+/* I have no idea why is this necessary... */
#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
# include <malloc.h>
#endif
#endif /* PNG_1_0_X */
+/* Added at libpng-1.2.6 */
+#if !defined(PNG_1_0_X)
+#ifndef PNG_SET_USER_LIMITS_SUPPORTED
+#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
+# define PNG_SET_USER_LIMITS_SUPPORTED
+#endif
+#endif
+#endif /* PNG_1_0_X */
+
+/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
+ * how large, set these limits to 0x7fffffffL
+ */
+#ifndef PNG_USER_WIDTH_MAX
+# define PNG_USER_WIDTH_MAX 1000000L
+#endif
+#ifndef PNG_USER_HEIGHT_MAX
+# define PNG_USER_HEIGHT_MAX 1000000L
+#endif
+
/* These are currently experimental features, define them if you want */
/* very little testing */
/* This is only for PowerPC big-endian and 680x0 systems */
/* some testing */
/*
-#ifdef PNG_READ_SUPPORTED
-# ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
-# define PNG_READ_BIG_ENDIAN_SUPPORTED
-# endif
+#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
+# define PNG_READ_BIG_ENDIAN_SUPPORTED
#endif
*/
/* This is usually size_t. It is typedef'ed just in case you need it to
change (I'm not sure if you will or not, so I thought I'd be safe) */
-typedef size_t png_size_t;
+#ifdef PNG_SIZE_T
+ typedef PNG_SIZE_T png_size_t;
+# define png_sizeof(x) png_convert_size(sizeof (x))
+#else
+ typedef size_t png_size_t;
+# define png_sizeof(x) sizeof (x)
+#endif
/* The following is needed for medium model support. It cannot be in the
* PNG_INTERNAL section. Needs modification for other compilers besides
* zlib and your applications the same way you build libpng.
*/
-#ifndef PNGAPI
-
#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
# ifndef PNG_NO_MODULEDEF
# define PNG_NO_MODULEDEF
(( defined(_Windows) || defined(_WINDOWS) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
-# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
-# define PNGAPI __cdecl
-# else
-# define PNGAPI _cdecl
+# ifndef PNGAPI
+# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
+# define PNGAPI __cdecl
+# else
+# define PNGAPI _cdecl
+# endif
# endif
# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
# endif
# endif /* PNG_IMPEXP */
#else /* !(DLL || non-cygwin WINDOWS) */
-# if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__)
-# define PNGAPI _System
-# define PNG_IMPEXP
-# else
+# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
+# ifndef PNGAPI
+# define PNGAPI _System
+# endif
+# else
# if 0 /* ... other platforms, with other meanings */
-# else
-# define PNGAPI
-# define PNG_IMPEXP
# endif
# endif
#endif
# define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
-# define png_strcpy _fstrcpy
-# define png_strlen _fstrlen
-# define png_memcmp _fmemcmp /* SJT: added */
-# define png_memcpy _fmemcpy
-# define png_memset _fmemset
+# define png_strcpy _fstrcpy
+# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
+# define png_strlen _fstrlen
+# define png_memcmp _fmemcmp /* SJT: added */
+# define png_memcpy _fmemcpy
+# define png_memset _fmemset
#else /* use the usual functions */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
-# define png_strcpy strcpy
-# define png_strlen strlen
-# define png_memcmp memcmp /* SJT: added */
-# define png_memcpy memcpy
-# define png_memset memset
+# define png_strcpy strcpy
+# define png_strncpy strncpy /* Added to v 1.2.6 */
+# define png_strlen strlen
+# define png_memcmp memcmp /* SJT: added */
+# define png_memcpy memcpy
+# define png_memset memset
#endif
/* End of memory model independent support */
/* Just a little check that someone hasn't tried to define something
* contradictory.
*/
-#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
+#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
# undef PNG_ZBUF_SIZE
-# define PNG_ZBUF_SIZE 65536
+# define PNG_ZBUF_SIZE 65536L
#endif
#ifdef PNG_READ_SUPPORTED
/* pngerror.c - stub functions for i/o and memory allocation
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
char msg[16];
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{
- int offset = 0;
if (*error_message == '#')
{
+ int offset;
for (offset=1; offset<15; offset++)
if (*(error_message+offset) == ' ')
break;
}
}
#endif
- if (png_ptr->error_fn != NULL)
+ if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, error_message);
- /* if the following returns or doesn't exist, use the default function,
- which will not return */
+ /* If the custom handler doesn't exist, or if it returns,
+ use the default handler, which will not return. */
png_default_error(png_ptr, error_message);
}
void PNGAPI
png_warning(png_structp png_ptr, png_const_charp warning_message)
{
- int offset = 0;
+ int offset = 0;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (png_ptr->flags&(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif
break;
}
}
- if (png_ptr->warning_fn != NULL)
- (*(png_ptr->warning_fn))(png_ptr,
- (png_const_charp)(warning_message+offset));
+ if (png_ptr != NULL && png_ptr->warning_fn != NULL)
+ (*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
else
- png_default_warning(png_ptr, (png_const_charp)(warning_message+offset));
+ png_default_warning(png_ptr, warning_message+offset);
}
/* These utilities are used internally to build an error message that relates
* to 63 bytes, the name characters are output as hex digits wrapped in []
* if the character is invalid.
*/
-#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
+#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
static PNG_CONST char png_digit[16] = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
- 'F' };
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'A', 'B', 'C', 'D', 'E', 'F'
+};
static size_t wxstrnlen( const char *s, size_t maxlen )
{
buffer[iout++] = ':';
buffer[iout++] = ' ';
- png_memcpy(buffer+iout, error_message, len);
- buffer[iout+len-1] = 0;
+ png_strncpy(buffer+iout, error_message, 63);
+ buffer[iout+63] = 0;
}
}
else
#endif
fprintf(stderr, "libpng error: %s\n", error_message);
-#else
- if (error_message)
- /* make compiler happy */ ;
#endif
#ifdef PNG_SETJMP_SUPPORTED
# ifdef USE_FAR_KEYWORD
{
jmp_buf jmpbuf;
- png_memcpy(jmpbuf,png_ptr->jmpbuf,sizeof(jmp_buf));
+ png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf));
longjmp(jmpbuf, 1);
}
# else
longjmp(png_ptr->jmpbuf, 1);
# endif
#else
+ /* make compiler happy */ ;
if (png_ptr)
- /* make compiler happy */ ;
PNG_ABORT();
#endif
+#ifdef PNG_NO_CONSOLE_IO
+ /* make compiler happy */ ;
+ if (&error_message != NULL)
+ return;
+#endif
}
/* This function is called when there is a warning, but the library thinks
# endif
fprintf(stderr, "libpng warning: %s\n", warning_message);
#else
+ /* make compiler happy */ ;
if (warning_message)
- /* appease compiler */ ;
+ return;
#endif
+ /* make compiler happy */ ;
if (png_ptr)
return;
}
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code.
*
- * libpng version 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
*
* Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998.
* 20020304:
* - eliminated incorrect use of width_mmx in pixel_bytes == 8 case
*
+ * 20040724:
+ * - more tinkering with clobber list at lines 4529 and 5033, to get
+ * it to compile on gcc-3.4.
+ *
* STILL TO DO:
* - test png_do_read_interlace() 64-bit case (pixel_bytes == 8)
* - write MMX code for 48-bit case (pixel_bytes == 6)
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
if (_mmx_supported == 2) {
+#if !defined(PNG_1_0_X)
/* this should have happened in png_init_mmx_flags() already */
png_warning(png_ptr, "asm_flags may not have been initialized");
+#endif
png_mmx_support();
}
#endif
{
png_debug(2,"mask == 0xff: doing single png_memcpy()\n");
png_memcpy(row, png_ptr->row_buf + 1,
- (png_size_t)((png_ptr->width * png_ptr->row_info.pixel_depth + 7) >> 3));
+ (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,png_ptr->width));
}
else /* (png_combine_row() is never called with mask == 0) */
{
"=S" (dummy_value_S),
"=D" (dummy_value_D)
- : "1" (sptr), /* esi // input regs */
- "2" (dp), /* edi */
- "0" (width) /* ecx */
-/* doesn't work "i" (0x0000000000FFFFFFLL) // %1 (a.k.a. _const4) */
+ : "1" (sptr), // esi // input regs
+ "2" (dp), // edi
+ "0" (width), // ecx
+ "rim" (_const4) // %1(?) (0x0000000000FFFFFFLL)
#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */
: "%mm0", "%mm1", "%mm2" /* clobber list */
"=S" (dummy_value_S),
"=D" (dummy_value_D)
- : "1" (sptr), /* esi // input regs */
- "2" (dp), /* edi */
- "0" (width) /* ecx */
+ : "1" (sptr), // esi // input regs
+ "2" (dp), // edi
+ "0" (width), // ecx
+ "rim" (_const4) // (0x0000000000FFFFFFLL)
#if 0 /* %mm0, ..., %mm2 not supported by gcc 2.7.2.3 or egcs 1.1 */
: "%mm0", "%mm1", "%mm2" /* clobber list */
"=S" (dummy_value_S),
"=D" (dummy_value_D)
- : "1" (sptr), /* esi // input regs */
- "2" (dp), /* edi */
- "0" (width_mmx) /* ecx */
+ : "1" (sptr), // esi // input regs
+ "2" (dp), // edi
+ "0" (width_mmx), // ecx
+ "rim" (_const4), // 0x0000000000FFFFFFLL
+ "rim" (_const6) // 0x00000000000000FFLL
#if 0 /* %mm0, ..., %mm3 not supported by gcc 2.7.2.3 or egcs 1.1 */
: "%mm0", "%mm1" /* clobber list */
} /* end switch (row_info->pixel_depth) */
row_info->width = final_width;
- row_info->rowbytes = ((final_width *
- (png_uint_32)row_info->pixel_depth + 7) >> 3);
+
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
}
} /* end png_do_read_interlace() */
: "0" (bpp), /* eax // input regs */
"1" (row) /* edi */
- : "%ebx", "%ecx", "%edx" /* clobber list */
- , "%esi"
+ : "%esi", "%ecx", "%edx" // clobber list
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3"
"1" (prev_row), /* esi */
"2" (row) /* edi */
- : "%eax", "%ebx", "%ecx" /* clobber list (no input regs!) */
+ : "%eax", "%ecx" // clobber list (no input regs!)
+#ifndef __PIC__
+ , "%ebx"
+#endif
#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */
, "%mm0", "%mm1", "%mm2", "%mm3"
{
#if defined(PNG_MMX_CODE_SUPPORTED)
__asm__ __volatile__ (
- "pushl %%ebx \n\t" /* ebx gets clobbered by CPUID instruction */
- "pushl %%ecx \n\t" /* so does ecx... */
- "pushl %%edx \n\t" /* ...and edx (but ecx & edx safe on Linux) */
-/* ".byte 0x66 \n\t" // convert 16-bit pushf to 32-bit pushfd */
-/* "pushf \n\t" // 16-bit pushf */
- "pushfl \n\t" /* save Eflag to stack */
- "popl %%eax \n\t" /* get Eflag from stack into eax */
- "movl %%eax, %%ecx \n\t" /* make another copy of Eflag in ecx */
- "xorl $0x200000, %%eax \n\t" /* toggle ID bit in Eflag (i.e., bit 21) */
- "pushl %%eax \n\t" /* save modified Eflag back to stack */
-/* ".byte 0x66 \n\t" // convert 16-bit popf to 32-bit popfd */
-/* "popf \n\t" // 16-bit popf */
- "popfl \n\t" /* restore modified value to Eflag reg */
- "pushfl \n\t" /* save Eflag to stack */
- "popl %%eax \n\t" /* get Eflag from stack */
- "pushl %%ecx \n\t" /* save original Eflag to stack */
- "popfl \n\t" /* restore original Eflag */
- "xorl %%ecx, %%eax \n\t" /* compare new Eflag with original Eflag */
- "jz 0f \n\t" /* if same, CPUID instr. is not supported */
-
- "xorl %%eax, %%eax \n\t" /* set eax to zero */
-/* ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode) */
- "cpuid \n\t" /* get the CPU identification info */
- "cmpl $1, %%eax \n\t" /* make sure eax return non-zero value */
- "jl 0f \n\t" /* if eax is zero, MMX is not supported */
-
- "xorl %%eax, %%eax \n\t" /* set eax to zero and... */
- "incl %%eax \n\t" /* ...increment eax to 1. This pair is */
- /* faster than the instruction "mov eax, 1" */
- "cpuid \n\t" /* get the CPU identification info again */
- "andl $0x800000, %%edx \n\t" /* mask out all bits but MMX bit (23) */
- "cmpl $0, %%edx \n\t" /* 0 = MMX not supported */
- "jz 0f \n\t" /* non-zero = yes, MMX IS supported */
-
- "movl $1, %%eax \n\t" /* set return value to 1 */
- "jmp 1f \n\t" /* DONE: have MMX support */
-
- "0: \n\t" /* .NOT_SUPPORTED: target label for jump instructions */
- "movl $0, %%eax \n\t" /* set return value to 0 */
- "1: \n\t" /* .RETURN: target label for jump instructions */
- "movl %%eax, _mmx_supported \n\t" /* save in global static variable, too */
- "popl %%edx \n\t" /* restore edx */
- "popl %%ecx \n\t" /* restore ecx */
- "popl %%ebx \n\t" /* restore ebx */
-
-/* "ret \n\t" // DONE: no MMX support */
- /* (fall through to standard C "ret") */
-
- : /* output list (none) */
-
- : /* any variables used on input (none) */
-
- : "%eax" /* clobber list */
-/* , "%ebx", "%ecx", "%edx" // GRR: we handle these manually */
-/* , "memory" // if write to a variable gcc thought was in a reg */
-/* , "cc" // "condition codes" (flag bits) */
+ "pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
+ "pushl %%ecx \n\t" // so does ecx...
+ "pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux)
+// ".byte 0x66 \n\t" // convert 16-bit pushf to 32-bit pushfd
+// "pushf \n\t" // 16-bit pushf
+ "pushfl \n\t" // save Eflag to stack
+ "popl %%eax \n\t" // get Eflag from stack into eax
+ "movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx
+ "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
+ "pushl %%eax \n\t" // save modified Eflag back to stack
+// ".byte 0x66 \n\t" // convert 16-bit popf to 32-bit popfd
+// "popf \n\t" // 16-bit popf
+ "popfl \n\t" // restore modified value to Eflag reg
+ "pushfl \n\t" // save Eflag to stack
+ "popl %%eax \n\t" // get Eflag from stack
+ "pushl %%ecx \n\t" // save original Eflag to stack
+ "popfl \n\t" // restore original Eflag
+ "xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag
+ "jz 0f \n\t" // if same, CPUID instr. is not supported
+
+ "xorl %%eax, %%eax \n\t" // set eax to zero
+// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode)
+ "cpuid \n\t" // get the CPU identification info
+ "cmpl $1, %%eax \n\t" // make sure eax return non-zero value
+ "jl 0f \n\t" // if eax is zero, MMX is not supported
+
+ "xorl %%eax, %%eax \n\t" // set eax to zero and...
+ "incl %%eax \n\t" // ...increment eax to 1. This pair is
+ // faster than the instruction "mov eax, 1"
+ "cpuid \n\t" // get the CPU identification info again
+ "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
+ "cmpl $0, %%edx \n\t" // 0 = MMX not supported
+ "jz 0f \n\t" // non-zero = yes, MMX IS supported
+
+ "movl $1, %%eax \n\t" // set return value to 1
+ "jmp 1f \n\t" // DONE: have MMX support
+
+ "0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
+ "movl $0, %%eax \n\t" // set return value to 0
+ "1: \n\t" // .RETURN: target label for jump instructions
+ "movl %%eax, _mmx_supported \n\t" // save in global static variable, too
+ "popl %%edx \n\t" // restore edx
+ "popl %%ecx \n\t" // restore ecx
+ "popl %%ebx \n\t" // restore ebx
+
+// "ret \n\t" // DONE: no MMX support
+ // (fall through to standard C "ret")
+
+ : // output list (none)
+
+ : // any variables used on input (none)
+
+ : "%eax" // clobber list
+// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
+// , "memory" // if write to a variable gcc thought was in a reg
+// , "cc" // "condition codes" (flag bits)
);
#else
_mmx_supported = 0;
/* pngget.c - retrieval of values from info struct
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
bit_depth != NULL && color_type != NULL)
{
- int pixel_depth, channels;
- png_uint_32 rowbytes_per_pixel;
-
png_debug1(1, "in %s retrieval function\n", "IHDR");
*width = info_ptr->width;
*height = info_ptr->height;
*interlace_type = info_ptr->interlace_type;
/* check for potential overflow of rowbytes */
- if (*color_type == PNG_COLOR_TYPE_PALETTE)
- channels = 1;
- else if (*color_type & PNG_COLOR_MASK_COLOR)
- channels = 3;
- else
- channels = 1;
- if (*color_type & PNG_COLOR_MASK_ALPHA)
- channels++;
- pixel_depth = *bit_depth * channels;
- rowbytes_per_pixel = (pixel_depth + 7) >> 3;
- if (width == 0 || *width > PNG_MAX_UINT)
+ if (width == 0 || *width > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image width");
- if (height == 0 || *height > PNG_MAX_UINT)
+ if (height == 0 || *height > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image height");
- if (*width > PNG_MAX_UINT/rowbytes_per_pixel - 64)
+ if (info_ptr->width > (PNG_UINT_32_MAX
+ >> 3) /* 8-byte RGBA pixels */
+ - 64 /* bigrowbuf hack */
+ - 1 /* filter byte */
+ - 7*8 /* rounding of width to multiple of 8 pixels */
+ - 8) /* extra max_pixel_depth pad */
{
- png_error(png_ptr,
+ png_warning(png_ptr,
"Width too large for libpng to process image data.");
}
return (1);
}
#endif
-
+#ifdef PNG_WRITE_SUPPORTED
png_uint_32 PNGAPI
png_get_compression_buffer_size(png_structp png_ptr)
{
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
}
-
+#endif
#ifndef PNG_1_0_X
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
{
return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L);
}
-#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
-#endif /* PNG_1_0_X */
+#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+/* these functions were added to libpng 1.2.6 */
+png_uint_32 PNGAPI
+png_get_user_width_max (png_structp png_ptr)
+{
+ return (png_ptr? png_ptr->user_width_max : 0);
+}
+png_uint_32 PNGAPI
+png_get_user_height_max (png_structp png_ptr)
+{
+ return (png_ptr? png_ptr->user_height_max : 0);
+}
+#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
+
+#endif /* ?PNG_1_0_X */
/* pngmem.c - stub functions for memory allocation
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO)
- size = sizeof(png_info);
+ size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG)
- size = sizeof(png_struct);
+ size = png_sizeof(png_struct);
else
- return (png_get_copyright());
+ return (png_get_copyright(NULL));
#ifdef PNG_USER_MEM_SUPPORTED
if(malloc_fn != NULL)
}
else
#endif /* PNG_USER_MEM_SUPPORTED */
- struct_ptr = (png_voidp)farmalloc(size));
+ struct_ptr = (png_voidp)farmalloc(size);
if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
return (struct_ptr);
#ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL)
- {
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
- if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
- png_error(png_ptr, "Out of memory!");
- return (ret);
- }
else
- return png_malloc_default(png_ptr, size);
+ ret = (png_malloc_default(png_ptr, size));
+ if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+ png_error(png_ptr, "Out of memory!");
+ return (ret);
}
png_voidp PNGAPI
#ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
- png_error(png_ptr, "Cannot Allocate > 64K");
+ {
+ png_warning(png_ptr, "Cannot Allocate > 64K");
+ ret = NULL;
+ }
+ else
#endif
- if (size == (png_uint_32)65536L)
+ if (size != (size_t)size)
+ ret = NULL;
+ else if (size == (png_uint_32)65536L)
{
if (png_ptr->offset_table == NULL)
{
if (table == NULL)
{
- if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+#ifndef PNG_USER_MEM_SUPPORTED
+ if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */
else
png_warning(png_ptr, "Out Of Memory.");
+#endif
return (NULL);
}
if ((png_size_t)table & 0xfff0)
{
- if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+#ifndef PNG_USER_MEM_SUPPORTED
+ if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr,
"Farmalloc didn't return normalized pointer");
else
png_warning(png_ptr,
"Farmalloc didn't return normalized pointer");
+#endif
return (NULL);
}
png_ptr->offset_table = table;
png_ptr->offset_table_ptr = farmalloc(num_blocks *
- sizeof (png_bytep));
+ png_sizeof (png_bytep));
if (png_ptr->offset_table_ptr == NULL)
{
- if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+#ifndef PNG_USER_MEM_SUPPORTED
+ if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */
else
png_warning(png_ptr, "Out Of memory.");
+#endif
return (NULL);
}
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
{
- if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+#ifndef PNG_USER_MEM_SUPPORTED
+ if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */
else
png_warning(png_ptr, "Out of Memory.");
+#endif
return (NULL);
}
else
ret = farmalloc(size);
+#ifndef PNG_USER_MEM_SUPPORTED
if (ret == NULL)
{
- if (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+ if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
else
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */
}
+#endif
return (ret);
}
png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO)
- size = sizeof(png_info);
+ size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG)
- size = sizeof(png_struct);
+ size = png_sizeof(png_struct);
else
return (NULL);
#endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__)
- if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL)
+ struct_ptr = (png_voidp)farmalloc(size);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
- if ((struct_ptr = (png_voidp)halloc(size,1)) != NULL)
+ struct_ptr = (png_voidp)halloc(size,1);
# else
- if ((struct_ptr = (png_voidp)malloc(size)) != NULL)
+ struct_ptr = (png_voidp)malloc(size);
# endif
#endif
- {
+ if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
- }
return (struct_ptr);
}
{
png_voidp ret;
+#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr == NULL || size == 0)
return (NULL);
-#ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL)
- {
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
- if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
- png_error(png_ptr, "Out of Memory!");
- return (ret);
- }
else
- return (png_malloc_default(png_ptr, size));
+ ret = (png_malloc_default(png_ptr, size));
+ if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+ png_error(png_ptr, "Out of Memory!");
+ return (ret);
}
png_voidp PNGAPI
png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */
+ if (png_ptr == NULL || size == 0)
+ return (NULL);
+
#ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
{
+#ifndef PNG_USER_MEM_SUPPORTED
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Cannot Allocate > 64K");
else
+#endif
return NULL;
}
#endif
+ /* Check for overflow */
#if defined(__TURBOC__) && !defined(__FLAT__)
+ if (size != (unsigned long)size)
+ ret = NULL;
+ else
ret = farmalloc(size);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
+ if (size != (unsigned long)size)
+ ret = NULL;
+ else
ret = halloc(size, 1);
# else
+ if (size != (size_t)size)
+ ret = NULL;
+ else
ret = malloc((size_t)size);
# endif
#endif
+#ifndef PNG_USER_MEM_SUPPORTED
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory");
+#endif
return (ret);
}
# define png_malloc_warn png_malloc
#else
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
- * function will issue a png_warning and return NULL instead of issuing a
- * png_error, if it fails to allocate the requested memory.
+ * function will set up png_malloc() to issue a png_warning and return NULL
+ * instead of issuing a png_error, if it fails to allocate the requested
+ * memory.
*/
png_voidp PNGAPI
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
/* pngpread.c - read a png file in push mode
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
}
png_push_fill_buffer(png_ptr, chunk_length, 4);
- png_ptr->push_length = png_get_uint_32(chunk_length);
+ png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
}
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
}
+ else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
+ {
+ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+ {
+ png_push_save_buffer(png_ptr);
+ return;
+ }
+ png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
+
+ png_ptr->process_mode = PNG_READ_DONE_MODE;
+ png_push_have_end(png_ptr, info_ptr);
+ }
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+ else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name))
+ {
+ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+ {
+ png_push_save_buffer(png_ptr);
+ return;
+ }
+ if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+ png_ptr->mode |= PNG_HAVE_IDAT;
+ png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
+ if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
+ png_ptr->mode |= PNG_HAVE_PLTE;
+ else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+ {
+ if (!(png_ptr->mode & PNG_HAVE_IHDR))
+ png_error(png_ptr, "Missing IHDR before IDAT");
+ else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
+ !(png_ptr->mode & PNG_HAVE_PLTE))
+ png_error(png_ptr, "Missing PLTE before IDAT");
+ }
+ }
+#endif
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
png_ptr->zstream.next_out = png_ptr->row_buf;
return;
}
- else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
- {
- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
- png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
-
- png_ptr->process_mode = PNG_READ_DONE_MODE;
- png_push_have_end(png_ptr, info_ptr);
- }
#if defined(PNG_READ_gAMA_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4))
{
png_size_t new_max;
png_bytep old_buffer;
+ if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
+ (png_ptr->current_buffer_size + 256))
+ {
+ png_error(png_ptr, "Potential overflow of save_buffer");
+ }
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
old_buffer = png_ptr->save_buffer;
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
}
png_push_fill_buffer(png_ptr, chunk_length, 4);
- png_ptr->push_length = png_get_uint_32(chunk_length);
-
+ png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
- png_ptr->row_number == png_ptr->num_rows-1))
+ png_ptr->row_number == png_ptr->num_rows))
{
if (png_ptr->zstream.avail_in)
png_warning(png_ptr, "Too much data in IDAT chunks");
png_ptr->row_info.bit_depth = png_ptr->bit_depth;
png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
- png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
- (png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
+ png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+ png_ptr->row_info.width);
png_read_filter_row(png_ptr, &(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->prev_row + 1,
png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass];
- png_ptr->irowbytes = ((png_ptr->iwidth *
- png_ptr->pixel_depth + 7) >> 3) + 1;
+ png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
+ png_ptr->iwidth) + 1;
if (png_ptr->transformations & PNG_INTERLACE)
break;
if (text != key + png_ptr->current_text_size)
text++;
- text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
+ text_ptr = (png_textp)png_malloc(png_ptr,
+ (png_uint_32)png_sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
key = text;
text += key_size;
- text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
+ text_ptr = (png_textp)png_malloc(png_ptr,
+ (png_uint_32)png_sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
if (text != key + png_ptr->current_text_size)
text++;
- text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
+ text_ptr = (png_textp)png_malloc(png_ptr,
+ (png_uint_32)png_sizeof(png_text));
text_ptr->compression = comp_flag + 2;
text_ptr->key = key;
text_ptr->lang = lang;
{
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
- HANDLE_CHUNK_ALWAYS
+ PNG_HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
&& png_ptr->read_user_chunk_fn == NULL
#endif
{
if (!(png_ptr->chunk_name[0] & 0x20))
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
- HANDLE_CHUNK_ALWAYS)
+ PNG_HANDLE_CHUNK_ALWAYS)
png_chunk_error(png_ptr, "unknown critical chunk");
}
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
/* pngread.c - read a PNG file
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
#endif
#endif /* PNG_1_0_X */
+ /* added at libpng-1.2.6 */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+#endif
+
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
return (NULL);
}
#ifdef USE_FAR_KEYWORD
- png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
+ png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
#endif
#endif
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
- png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
+ png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
PNG_ABORT();
{
/* We only come here via pre-1.0.12-compiled applications */
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
- if(sizeof(png_struct) > png_struct_size || sizeof(png_info) > png_info_size)
+ if(png_sizeof(png_struct) > png_struct_size ||
+ png_sizeof(png_info) > png_info_size)
{
char msg[80];
png_ptr->warning_fn=NULL;
png_warning(png_ptr, msg);
}
#endif
- if(sizeof(png_struct) > png_struct_size)
+ if(png_sizeof(png_struct) > png_struct_size)
{
png_ptr->error_fn=NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_error(png_ptr,
"The png struct allocated by the application for reading is too small.");
}
- if(sizeof(png_info) > png_info_size)
+ if(png_sizeof(png_info) > png_info_size)
{
png_ptr->error_fn=NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
#ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */
- png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
+ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
#endif
- if(sizeof(png_struct) > png_struct_size)
+ if(png_sizeof(png_struct) > png_struct_size)
{
png_destroy_struct(png_ptr);
*ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
}
/* reset all variables to 0 */
- png_memset(png_ptr, 0, sizeof (png_struct));
+ png_memset(png_ptr, 0, png_sizeof (png_struct));
#ifdef PNG_SETJMP_SUPPORTED
/* restore jump buffer */
- png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
+ png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
+#endif
+
+ /* added at libpng-1.2.6 */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
#endif
/* initialize zbuf - compression buffer */
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
}
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* Read the information before the actual image data. This has been
* changed in v0.90 to allow reading a file that already has the magic
* bytes read from the stream. You can tell libpng how many bytes have
png_uint_32 length;
png_read_data(png_ptr, chunk_length, 4);
- length = png_get_uint_32(chunk_length);
+ length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name,
length);
- if (length > PNG_MAX_UINT)
- png_error(png_ptr, "Invalid chunk length.");
-
/* This should be a binary subdivision search or a hash for
* matching the chunk name rather than a linear search.
*/
png_handle_unknown(png_ptr, info_ptr, length);
}
}
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* optional call to update the users info_ptr structure */
void PNGAPI
png_read_transform_info(png_ptr, info_ptr);
}
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* Initialize palette, background, etc, after transformations
* are set, but before any reading takes place. This allows
* the user to obtain a gamma-corrected palette, for example.
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
}
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{
png_crc_finish(png_ptr, 0);
png_read_data(png_ptr, chunk_length, 4);
- png_ptr->idat_size = png_get_uint_32(chunk_length);
-
- if (png_ptr->idat_size > PNG_MAX_UINT)
- png_error(png_ptr, "Invalid chunk length.");
+ png_ptr->idat_size = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_ptr->row_info.channels = png_ptr->channels;
png_ptr->row_info.bit_depth = png_ptr->bit_depth;
png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
- png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
- (png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
+ png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+ png_ptr->row_info.width);
if(png_ptr->row_buf[0])
png_read_filter_row(png_ptr, &(png_ptr->row_info),
if (png_ptr->read_row_fn != NULL)
(*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
}
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* Read one or more rows of image data. If the image is interlaced,
* and png_set_interlace_handling() has been called, the rows need to
* contain the contents of the rows from the previous pass. If the
* not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it.
*
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.5rc3
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.6
*/
void PNGAPI
dp++;
}
}
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* Read the entire image. If the image has an alpha channel or a tRNS
* chunk, and you have called png_handle_alpha()[*], you will need to
* initialize the image to the current image that PNG will be overlaying.
* only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead.
*
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.5rc3
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.6
*/
void PNGAPI
png_read_image(png_structp png_ptr, png_bytepp image)
}
}
}
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
/* Read the end of the PNG file. Will not read past the end of the
* file, will verify the end is accurate, and will read any comments
* or time information at the end of the file, if info is not NULL.
#endif /* PNG_GLOBAL_ARRAYS */
png_read_data(png_ptr, chunk_length, 4);
- length = png_get_uint_32(chunk_length);
+ length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name);
- if (length > PNG_MAX_UINT)
- png_error(png_ptr, "Invalid chunk length.");
-
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
png_handle_IHDR(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
png_handle_unknown(png_ptr, info_ptr, length);
} while (!(png_ptr->mode & PNG_HAVE_IEND));
}
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* free all memory used by the read */
void PNGAPI
png_structp png_ptr = NULL;
png_infop info_ptr = NULL, end_info_ptr = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
- png_free_ptr free_fn = NULL;
- png_voidp mem_ptr = NULL;
+ png_free_ptr free_fn;
+ png_voidp mem_ptr;
#endif
png_debug(1, "in png_destroy_read_struct\n");
* being used again.
*/
#ifdef PNG_SETJMP_SUPPORTED
- png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
+ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
#endif
error_fn = png_ptr->error_fn;
free_fn = png_ptr->free_fn;
#endif
- png_memset(png_ptr, 0, sizeof (png_struct));
+ png_memset(png_ptr, 0, png_sizeof (png_struct));
png_ptr->error_fn = error_fn;
png_ptr->warning_fn = warning_fn;
#endif
#ifdef PNG_SETJMP_SUPPORTED
- png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
+ png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
#endif
}
png_ptr->read_row_fn = read_row_fn;
}
+
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
#if defined(PNG_INFO_IMAGE_SUPPORTED)
void PNGAPI
png_read_png(png_structp png_ptr, png_infop info_ptr,
int row;
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
- /* invert the alpha channel from opacity to transparency */
+ /* invert the alpha channel from opacity to transparency
+ */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
png_set_invert_alpha(png_ptr);
#endif
- /* The call to png_read_info() gives us all of the information from the
+ /* png_read_info() gives us all of the information from the
* PNG file before the first IDAT (image data chunk).
*/
png_read_info(png_ptr, info_ptr);
+ if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
+ png_error(png_ptr,"Image is too high to process with png_read_png()");
/* -------------- image transformations start here ------------------- */
#if defined(PNG_READ_16_TO_8_SUPPORTED)
- /* tell libpng to strip 16 bit/color files down to 8 bits/color */
+ /* tell libpng to strip 16 bit/color files down to 8 bits per color
+ */
if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr);
#endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
- /* Strip alpha bytes from the input data without combining with the
- * background (not recommended).
+ /* Strip alpha bytes from the input data without combining with
+ * the background (not recommended).
*/
if (transforms & PNG_TRANSFORM_STRIP_ALPHA)
png_set_strip_alpha(png_ptr);
#endif
#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED)
- /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
+ /* Extract multiple pixels with bit depths of 1, 2, or 4 from a single
* byte into separate bytes (useful for paletted and grayscale images).
*/
if (transforms & PNG_TRANSFORM_PACKING)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
/* Change the order of packed pixels to least significant bit first
- * (not useful if you are using png_set_packing). */
+ * (not useful if you are using png_set_packing).
+ */
if (transforms & PNG_TRANSFORM_PACKSWAP)
png_set_packswap(png_ptr);
#endif
png_set_expand(png_ptr);
#endif
- /* We don't handle background color or gamma transformation or dithering. */
+ /* We don't handle background color or gamma transformation or dithering.
+ */
#if defined(PNG_READ_INVERT_SUPPORTED)
- /* invert monochrome files to have 0 as white and 1 as black */
+ /* invert monochrome files to have 0 as white and 1 as black
+ */
if (transforms & PNG_TRANSFORM_INVERT_MONO)
png_set_invert_mono(png_ptr);
#endif
#endif
#if defined(PNG_READ_BGR_SUPPORTED)
- /* flip the RGB pixels to BGR (or RGBA to BGRA) */
+ /* flip the RGB pixels to BGR (or RGBA to BGRA)
+ */
if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr);
#endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
- /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
+ /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR)
+ */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr);
#endif
#if defined(PNG_READ_SWAP_SUPPORTED)
- /* swap bytes of 16 bit files to least significant byte first */
+ /* swap bytes of 16 bit files to least significant byte first
+ */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr);
#endif
if(info_ptr->row_pointers == NULL)
{
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
- info_ptr->height * sizeof(png_bytep));
+ info_ptr->height * png_sizeof(png_bytep));
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_ROWS;
#endif
}
#endif
+#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* pngrio.c - functions for data input
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
}
png_ptr->transformations |= PNG_BACKGROUND;
- png_memcpy(&(png_ptr->background), background_color, sizeof(png_color_16));
+ png_memcpy(&(png_ptr->background), background_color,
+ png_sizeof(png_color_16));
png_ptr->background_gamma = (float)background_gamma;
png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0);
int i;
png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * sizeof (png_byte)));
+ (png_uint_32)(num_palette * png_sizeof (png_byte)));
for (i = 0; i < num_palette; i++)
png_ptr->dither_index[i] = (png_byte)i;
}
/* initialize an array to sort colors */
png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * sizeof (png_byte)));
+ (png_uint_32)(num_palette * png_sizeof (png_byte)));
/* initialize the dither_sort array */
for (i = 0; i < num_palette; i++)
/* initialize palette index arrays */
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * sizeof (png_byte)));
+ (png_uint_32)(num_palette * png_sizeof (png_byte)));
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * sizeof (png_byte)));
+ (png_uint_32)(num_palette * png_sizeof (png_byte)));
/* initialize the sort array */
for (i = 0; i < num_palette; i++)
}
hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
- sizeof (png_dsortp)));
+ png_sizeof (png_dsortp)));
for (i = 0; i < 769; i++)
hash[i] = NULL;
-/* png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
+/* png_memset(hash, 0, 769 * png_sizeof (png_dsortp)); */
num_new_palette = num_palette;
{
t = (png_dsortp)png_malloc_warn(png_ptr,
- (png_uint_32)(sizeof(png_dsort)));
+ (png_uint_32)(png_sizeof(png_dsort)));
if (t == NULL)
break;
t->next = hash[d];
png_size_t num_entries = ((png_size_t)1 << total_bits);
png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
- (png_uint_32)(num_entries * sizeof (png_byte)));
+ (png_uint_32)(num_entries * png_sizeof (png_byte)));
- png_memset(png_ptr->palette_lookup, 0, num_entries * sizeof (png_byte));
+ png_memset(png_ptr->palette_lookup, 0, num_entries *
+ png_sizeof (png_byte));
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
- sizeof(png_byte)));
+ png_sizeof(png_byte)));
- png_memset(distance, 0xff, num_entries * sizeof(png_byte));
+ png_memset(distance, 0xff, num_entries * png_sizeof(png_byte));
for (i = 0; i < num_palette; i++)
{
for (ir = 0; ir < num_red; ir++)
{
- int dr = abs(ir - r);
+ /* int dr = abs(ir - r); */
+ int dr = ((ir > r) ? ir - r : r - ir);
int index_r = (ir << (PNG_DITHER_BLUE_BITS + PNG_DITHER_GREEN_BITS));
for (ig = 0; ig < num_green; ig++)
{
- int dg = abs(ig - g);
+ /* int dg = abs(ig - g); */
+ int dg = ((ig > g) ? ig - g : g - ig);
int dt = dr + dg;
int dm = ((dr > dg) ? dr : dg);
int index_g = index_r | (ig << PNG_DITHER_BLUE_BITS);
for (ib = 0; ib < num_blue; ib++)
{
int d_index = index_g | ib;
- int db = abs(ib - b);
+ /* int db = abs(ib - b); */
+ int db = ((ib > b) ? ib - b : b - ib);
int dmax = ((dm > db) ? dm : db);
int d = dmax + dt + db;
info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
info_ptr->bit_depth);
- info_ptr->rowbytes = ((info_ptr->width * info_ptr->pixel_depth + 7) >> 3);
+
+ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,info_ptr->width);
#if !defined(PNG_READ_EXPAND_SUPPORTED)
if(png_ptr)
#endif
png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
png_ptr->row_info.channels);
- png_ptr->row_info.rowbytes = (png_ptr->row_info.width *
- png_ptr->row_info.pixel_depth+7)>>3;
+ png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+ png_ptr->row_info.width);
}
#endif
/* This changes the data from GG to GGXX */
if (flags & PNG_FLAG_FILLER_AFTER)
{
- png_bytep sp = row + (png_size_t)row_width;
- png_bytep dp = sp + (png_size_t)row_width;
+ png_bytep sp = row + (png_size_t)row_width * 2;
+ png_bytep dp = sp + (png_size_t)row_width * 2;
for (i = 1; i < row_width; i++)
{
*(--dp) = hi_filler;
/* This changes the data from GG to XXGG */
else
{
- png_bytep sp = row + (png_size_t)row_width;
- png_bytep dp = sp + (png_size_t)row_width;
+ png_bytep sp = row + (png_size_t)row_width * 2;
+ png_bytep dp = sp + (png_size_t)row_width * 2;
for (i = 0; i < row_width; i++)
{
*(--dp) = *(--sp);
row_info->rowbytes = row_width * 4;
}
}
+ row_info->color_type |= PNG_COLOR_MASK_ALPHA;
} /* COLOR_TYPE == GRAY */
else if (row_info->color_type == PNG_COLOR_TYPE_RGB)
{
/* This changes the data from RRGGBB to RRGGBBXX */
if (flags & PNG_FLAG_FILLER_AFTER)
{
- png_bytep sp = row + (png_size_t)row_width * 3;
- png_bytep dp = sp + (png_size_t)row_width;
+ png_bytep sp = row + (png_size_t)row_width * 6;
+ png_bytep dp = sp + (png_size_t)row_width * 2;
for (i = 1; i < row_width; i++)
{
*(--dp) = hi_filler;
/* This changes the data from RRGGBB to XXRRGGBB */
else
{
- png_bytep sp = row + (png_size_t)row_width * 3;
- png_bytep dp = sp + (png_size_t)row_width;
+ png_bytep sp = row + (png_size_t)row_width * 6;
+ png_bytep dp = sp + (png_size_t)row_width * 2;
for (i = 0; i < row_width; i++)
{
*(--dp) = *(--sp);
row_info->rowbytes = row_width * 8;
}
}
+ row_info->color_type |= PNG_COLOR_MASK_ALPHA;
} /* COLOR_TYPE == RGB */
}
#endif
row_info->color_type |= PNG_COLOR_MASK_COLOR;
row_info->pixel_depth = (png_byte)(row_info->channels *
row_info->bit_depth);
- row_info->rowbytes = ((row_width *
- row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
}
}
#endif
png_byte blue = *(sp++);
if(red != green || red != blue)
rgb_error |= 1;
- *(dp++) = (png_byte)((gc*red + gc*green + bc*blue)>>8);
+ *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
*(dp++) = *(sp++); /* alpha */
}
}
row_info->color_type &= ~PNG_COLOR_MASK_COLOR;
row_info->pixel_depth = (png_byte)(row_info->channels *
row_info->bit_depth);
- row_info->rowbytes = ((row_width *
- row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
}
return rgb_error;
}
row_info->channels--;
row_info->pixel_depth = (png_byte)(row_info->channels *
row_info->bit_depth);
- row_info->rowbytes = ((row_width *
- row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
}
}
}
row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
row_info->channels = 2;
row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
- row_info->rowbytes =
- ((row_width * row_info->pixel_depth) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
+ row_width);
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_value)
row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
row_info->channels = 4;
row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2);
- row_info->rowbytes =
- ((row_width * row_info->pixel_depth) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
}
}
}
row_info->color_type = PNG_COLOR_TYPE_PALETTE;
row_info->channels = 1;
row_info->pixel_depth = row_info->bit_depth;
- row_info->rowbytes =
- ((row_width * row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
palette_lookup != NULL && row_info->bit_depth == 8)
row_info->color_type = PNG_COLOR_TYPE_PALETTE;
row_info->channels = 1;
row_info->pixel_depth = row_info->bit_depth;
- row_info->rowbytes =
- ((row_width * row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width);
}
else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
dither_lookup && row_info->bit_depth == 8)
g = 1.0;
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
- (png_uint_32)(num * sizeof (png_uint_16p)));
+ (png_uint_32)(num * png_sizeof (png_uint_16p)));
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
{
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(256 * sizeof (png_uint_16)));
+ (png_uint_32)(256 * png_sizeof (png_uint_16)));
}
g = 1.0 / g;
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(256 * sizeof (png_uint_16)));
+ (png_uint_32)(256 * png_sizeof (png_uint_16)));
ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
for (j = 0; j < 256; j++)
g = 1.0 / (png_ptr->gamma);
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
- (png_uint_32)(num * sizeof (png_uint_16p )));
+ (png_uint_32)(num * png_sizeof (png_uint_16p )));
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(256 * sizeof (png_uint_16)));
+ (png_uint_32)(256 * png_sizeof (png_uint_16)));
ig = (((png_uint_32)i *
(png_uint_32)png_gamma_shift[shift]) >> 4);
g = png_ptr->gamma; /* probably doing rgb_to_gray */
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
- (png_uint_32)(num * sizeof (png_uint_16p)));
+ (png_uint_32)(num * png_sizeof (png_uint_16p)));
for (i = 0; i < num; i++)
{
png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(256 * sizeof (png_uint_16)));
+ (png_uint_32)(256 * png_sizeof (png_uint_16)));
ig = (((png_uint_32)i *
(png_uint_32)png_gamma_shift[shift]) >> 4);
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
- png_uint_32 s0=*(rp )<<8 | *(rp+1);
- png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
- png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
- png_uint_32 red=(65536+s0+s1)&0xffff;
- png_uint_32 blue=(65536+s2+s1)&0xffff;
- *(rp ) = (png_byte)((red>>8)&0xff);
- *(rp+1) = (png_byte)(red&0xff);
- *(rp+4) = (png_byte)((blue>>8)&0xff);
- *(rp+5) = (png_byte)(blue&0xff);
+ png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
+ png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
+ png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
+ png_uint_32 red = (png_uint_32)((s0+s1+65536L) & 0xffffL);
+ png_uint_32 blue = (png_uint_32)((s2+s1+65536L) & 0xffffL);
+ *(rp ) = (png_byte)((red >> 8) & 0xff);
+ *(rp+1) = (png_byte)(red & 0xff);
+ *(rp+4) = (png_byte)((blue >> 8) & 0xff);
+ *(rp+5) = (png_byte)(blue & 0xff);
}
}
}
-
/* pngrutil.c - utilities to read a PNG file
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
# endif
#endif
+png_uint_32 /* PRIVATE */
+png_get_uint_31(png_structp png_ptr, png_bytep buf)
+{
+ png_uint_32 i = png_get_uint_32(buf);
+ if (i > PNG_UINT_31_MAX)
+ png_error(png_ptr, "PNG unsigned integer out of range.\n");
+ return (i);
+}
#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
png_uint_32 /* PRIVATE */
png_size_t prefix_size, png_size_t *newlength)
{
static char msg[] = "Error decoding compressed text";
- png_charp text = NULL;
+ png_charp text;
png_size_t text_size;
if (comp_type == PNG_COMPRESSION_TYPE_BASE)
if (text == NULL)
{
- text_size = prefix_size + sizeof(msg) + 1;
+ text_size = prefix_size + png_sizeof(msg) + 1;
text = (png_charp)png_malloc_warn(png_ptr, text_size);
if (text == NULL)
{
/* Copy what we can of the error message into the text chunk */
text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
- text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
+ text_size = png_sizeof(msg) > text_size ? text_size :
+ png_sizeof(msg);
png_memcpy(text + prefix_size, msg, text_size + 1);
break;
}
png_crc_read(png_ptr, buf, 13);
png_crc_finish(png_ptr, 0);
- width = png_get_uint_32(buf);
- height = png_get_uint_32(buf + 4);
+ width = png_get_uint_31(png_ptr, buf);
+ height = png_get_uint_31(png_ptr, buf + 4);
bit_depth = buf[8];
color_type = buf[9];
compression_type = buf[10];
filter_type = buf[11];
interlace_type = buf[12];
-
/* set internal variables */
png_ptr->width = width;
png_ptr->height = height;
#if defined(PNG_MNG_FEATURES_SUPPORTED)
png_ptr->filter_type = (png_byte)filter_type;
#endif
+ png_ptr->compression_type = (png_byte)compression_type;
/* find number of channels */
switch (png_ptr->color_type)
/* set up other useful info */
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
png_ptr->channels);
- png_ptr->rowbytes = ((png_ptr->width *
- (png_uint_32)png_ptr->pixel_depth + 7) >> 3);
+ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width);
png_debug1(3,"bit_depth = %d\n", png_ptr->bit_depth);
png_debug1(3,"channels = %d\n", png_ptr->channels);
png_debug1(3,"rowbytes = %lu\n", png_ptr->rowbytes);
if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT))
{
png_error(png_ptr, "No image in file");
-
- info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
}
png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
png_warning(png_ptr, "Incorrect IEND chunk length");
}
png_crc_finish(png_ptr, length);
+
+ if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */
+ return;
}
#if defined(PNG_READ_gAMA_SUPPORTED)
/* Should be an error, but we can cope with it */
png_warning(png_ptr, "Out of place gAMA chunk");
- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
+ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
#if defined(PNG_READ_sRGB_SUPPORTED)
&& !(info_ptr->valid & PNG_INFO_sRGB)
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
if (info_ptr->valid & PNG_INFO_sRGB)
- if(igamma < 45000L || igamma > 46000L)
+ if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
/* Should be an error, but we can cope with it */
png_warning(png_ptr, "Out of place sBIT chunk");
}
- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT))
+ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT))
{
png_warning(png_ptr, "Duplicate sBIT chunk");
png_crc_finish(png_ptr, length);
else
truelen = (png_size_t)png_ptr->channels;
- if (length != truelen)
+ if (length != truelen || length > 4)
{
png_warning(png_ptr, "Incorrect sBIT chunk length");
png_crc_finish(png_ptr, length);
/* Should be an error, but we can cope with it */
png_warning(png_ptr, "Missing PLTE before cHRM");
- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)
+ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)
#if defined(PNG_READ_sRGB_SUPPORTED)
&& !(info_ptr->valid & PNG_INFO_sRGB)
#endif
#if defined(PNG_READ_sRGB_SUPPORTED)
if (info_ptr->valid & PNG_INFO_sRGB)
{
- if (abs(int_x_white - 31270L) > 1000 ||
- abs(int_y_white - 32900L) > 1000 ||
- abs(int_x_red - 64000L) > 1000 ||
- abs(int_y_red - 33000L) > 1000 ||
- abs(int_x_green - 30000L) > 1000 ||
- abs(int_y_green - 60000L) > 1000 ||
- abs(int_x_blue - 15000L) > 1000 ||
- abs(int_y_blue - 6000L) > 1000)
+ if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) ||
+ PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) ||
+ PNG_OUT_OF_RANGE(int_x_red, 64000L, 1000) ||
+ PNG_OUT_OF_RANGE(int_y_red, 33000, 1000) ||
+ PNG_OUT_OF_RANGE(int_x_green, 30000, 1000) ||
+ PNG_OUT_OF_RANGE(int_y_green, 60000L, 1000) ||
+ PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) ||
+ PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000))
{
png_warning(png_ptr,
/* Should be an error, but we can cope with it */
png_warning(png_ptr, "Out of place sRGB chunk");
- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
+ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
{
png_warning(png_ptr, "Duplicate sRGB chunk");
png_crc_finish(png_ptr, length);
#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
if ((info_ptr->valid & PNG_INFO_gAMA))
{
- int igamma;
+ png_fixed_point igamma;
#ifdef PNG_FIXED_POINT_SUPPORTED
- igamma=(int)info_ptr->int_gamma;
+ igamma=info_ptr->int_gamma;
#else
# ifdef PNG_FLOATING_POINT_SUPPORTED
- igamma=(int)(info_ptr->gamma * 100000.);
+ igamma=(png_fixed_point)(info_ptr->gamma * 100000.);
# endif
#endif
- if(igamma < 45000L || igamma > 46000L)
+ if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
#ifdef PNG_READ_cHRM_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
if (info_ptr->valid & PNG_INFO_cHRM)
- if (abs(info_ptr->int_x_white - 31270L) > 1000 ||
- abs(info_ptr->int_y_white - 32900L) > 1000 ||
- abs(info_ptr->int_x_red - 64000L) > 1000 ||
- abs(info_ptr->int_y_red - 33000L) > 1000 ||
- abs(info_ptr->int_x_green - 30000L) > 1000 ||
- abs(info_ptr->int_y_green - 60000L) > 1000 ||
- abs(info_ptr->int_x_blue - 15000L) > 1000 ||
- abs(info_ptr->int_y_blue - 6000L) > 1000)
+ if (PNG_OUT_OF_RANGE(info_ptr->int_x_white, 31270, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_y_white, 32900, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_x_red, 64000L, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_y_red, 33000, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_x_green, 30000, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_y_green, 60000L, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_x_blue, 15000, 1000) ||
+ PNG_OUT_OF_RANGE(info_ptr->int_y_blue, 6000, 1000))
{
png_warning(png_ptr,
"Ignoring incorrect cHRM value when sRGB is also present");
png_bytep pC;
png_charp profile;
png_uint_32 skip = 0;
- png_uint_32 profile_size = 0;
- png_uint_32 profile_length = 0;
+ png_uint_32 profile_size, profile_length;
png_size_t slength, prefix_length, data_length;
png_debug(1, "in png_handle_iCCP\n");
/* Should be an error, but we can cope with it */
png_warning(png_ptr, "Out of place iCCP chunk");
- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP))
+ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP))
{
png_warning(png_ptr, "Duplicate iCCP chunk");
png_crc_finish(png_ptr, length);
return;
}
- new_palette.nentries = data_length / entry_size;
- new_palette.entries = (png_sPLT_entryp)png_malloc(
- png_ptr, new_palette.nentries * sizeof(png_sPLT_entry));
+ new_palette.nentries = (png_uint_32) (data_length / entry_size);
+ if ((png_uint_32) new_palette.nentries > (png_uint_32) (PNG_SIZE_MAX /
+ png_sizeof(png_sPLT_entry)))
+ {
+ png_warning(png_ptr, "sPLT chunk too long");
+ return;
+ }
+ new_palette.entries = (png_sPLT_entryp)png_malloc_warn(
+ png_ptr, new_palette.nentries * png_sizeof(png_sPLT_entry));
+ if (new_palette.entries == NULL)
+ {
+ png_warning(png_ptr, "sPLT chunk requires too much memory");
+ return;
+ }
#ifndef PNG_NO_POINTER_INDEXING
for (i = 0; i < new_palette.nentries; i++)
return;
}
- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
{
- if (!(png_ptr->mode & PNG_HAVE_PLTE))
- {
- /* Should be an error, but we can cope with it */
- png_warning(png_ptr, "Missing PLTE before tRNS");
- }
- else if (length > (png_uint_32)png_ptr->num_palette)
+ png_byte buf[2];
+
+ if (length != 2)
{
png_warning(png_ptr, "Incorrect tRNS chunk length");
png_crc_finish(png_ptr, length);
return;
}
- if (length == 0)
- {
- png_warning(png_ptr, "Zero length tRNS chunk");
- png_crc_finish(png_ptr, length);
- return;
- }
- png_crc_read(png_ptr, readbuf, (png_size_t)length);
- png_ptr->num_trans = (png_uint_16)length;
+ png_crc_read(png_ptr, buf, 2);
+ png_ptr->num_trans = 1;
+ png_ptr->trans_values.gray = png_get_uint_16(buf);
}
else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
{
png_crc_finish(png_ptr, length);
return;
}
-
png_crc_read(png_ptr, buf, (png_size_t)length);
png_ptr->num_trans = 1;
png_ptr->trans_values.red = png_get_uint_16(buf);
png_ptr->trans_values.green = png_get_uint_16(buf + 2);
png_ptr->trans_values.blue = png_get_uint_16(buf + 4);
}
- else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
+ else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
- png_byte buf[6];
-
- if (length != 2)
+ if (!(png_ptr->mode & PNG_HAVE_PLTE))
+ {
+ /* Should be an error, but we can cope with it. */
+ png_warning(png_ptr, "Missing PLTE before tRNS");
+ }
+ if (length > (png_uint_32)png_ptr->num_palette ||
+ length > PNG_MAX_PALETTE_LENGTH)
{
png_warning(png_ptr, "Incorrect tRNS chunk length");
png_crc_finish(png_ptr, length);
return;
}
-
- png_crc_read(png_ptr, buf, 2);
- png_ptr->num_trans = 1;
- png_ptr->trans_values.gray = png_get_uint_16(buf);
+ if (length == 0)
+ {
+ png_warning(png_ptr, "Zero length tRNS chunk");
+ png_crc_finish(png_ptr, length);
+ return;
+ }
+ png_crc_read(png_ptr, readbuf, (png_size_t)length);
+ png_ptr->num_trans = (png_uint_16)length;
}
else
{
void /* PRIVATE */
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
- int num, i;
+ unsigned int num, i;
png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
png_debug(1, "in png_handle_hIST\n");
return;
}
- num = (int)length / 2 ;
- if (num != png_ptr->num_palette)
+ num = length / 2 ;
+ if (num != (unsigned int) png_ptr->num_palette || num >
+ (unsigned int) PNG_MAX_PALETTE_LENGTH)
{
png_warning(png_ptr, "Incorrect hIST chunk length");
png_crc_finish(png_ptr, length);
png_debug(3, "Allocating pCAL parameters array\n");
params = (png_charpp)png_malloc_warn(png_ptr, (png_uint_32)(nparams
- *sizeof(png_charp))) ;
+ *png_sizeof(png_charp))) ;
if (params == NULL)
{
png_free(png_ptr, purpose);
if (text != key + slength)
text++;
- text_ptr = (png_textp)png_malloc_warn(png_ptr, (png_uint_32)sizeof(png_text));
+ text_ptr = (png_textp)png_malloc_warn(png_ptr,
+ (png_uint_32)png_sizeof(png_text));
if (text_ptr == NULL)
{
png_warning(png_ptr, "Not enough memory to process text chunk.");
chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata,
(png_size_t)length, prefix_len, &data_len);
- text_ptr = (png_textp)png_malloc_warn(png_ptr, (png_uint_32)sizeof(png_text));
+ text_ptr = (png_textp)png_malloc_warn(png_ptr,
+ (png_uint_32)png_sizeof(png_text));
if (text_ptr == NULL)
{
png_warning(png_ptr,"Not enough memory to process zTXt chunk.");
(size_t)length, prefix_len, &data_len);
else
data_len=png_strlen(chunkdata + prefix_len);
- text_ptr = (png_textp)png_malloc_warn(png_ptr, (png_uint_32)sizeof(png_text));
+ text_ptr = (png_textp)png_malloc_warn(png_ptr,
+ (png_uint_32)png_sizeof(png_text));
if (text_ptr == NULL)
{
png_warning(png_ptr,"Not enough memory to process iTXt chunk.");
{
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
- HANDLE_CHUNK_ALWAYS
+ PNG_HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
&& png_ptr->read_user_chunk_fn == NULL
#endif
{
if (!(png_ptr->chunk_name[0] & 0x20))
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
- HANDLE_CHUNK_ALWAYS)
+ PNG_HANDLE_CHUNK_ALWAYS)
{
png_free(png_ptr, chunk.data);
png_chunk_error(png_ptr, "unknown critical chunk");
png_crc_finish(png_ptr, skip);
#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
- info_ptr = info_ptr; /* quiet compiler warnings about unused info_ptr */
+ if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */
+ return;
#endif
}
functions to handle unknown critical chunks after we check that
the chunk name itself is valid. */
-#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
+#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
void /* PRIVATE */
png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
if (mask == 0xff)
{
png_memcpy(row, png_ptr->row_buf + 1,
- (png_size_t)((png_ptr->width *
- png_ptr->row_info.pixel_depth + 7) >> 3));
+ PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->width));
}
else
{
}
}
row_info->width = final_width;
- row_info->rowbytes = ((final_width *
- (png_uint_32)row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
}
#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
- transformations = transformations; /* silence compiler warning */
+ if (&transformations == NULL) /* silence compiler warning */
+ return;
#endif
}
#endif /* !PNG_HAVE_ASSEMBLER_READ_INTERLACE */
png_pass_inc[png_ptr->pass] - 1 -
png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass];
- png_ptr->irowbytes = ((png_ptr->iwidth *
- (png_uint_32)png_ptr->pixel_depth + 7) >> 3) +1;
+
+ png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
+ png_ptr->iwidth) + 1;
if (!(png_ptr->transformations & PNG_INTERLACE))
{
png_crc_finish(png_ptr, 0);
png_read_data(png_ptr, chunk_length, 4);
- png_ptr->idat_size = png_get_uint_32(chunk_length);
-
+ png_ptr->idat_size = png_get_uint_31(png_ptr, chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass];
- row_bytes = ((png_ptr->iwidth *
- (png_uint_32)png_ptr->pixel_depth + 7) >> 3) +1;
+ row_bytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->iwidth) + 1;
+
png_ptr->irowbytes = (png_size_t)row_bytes;
if((png_uint_32)png_ptr->irowbytes != row_bytes)
png_error(png_ptr, "Rowbytes overflow in png_read_start_row");
row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7));
/* calculate the maximum bytes needed, adding a byte and a pixel
for safety's sake */
- row_bytes = ((row_bytes * (png_uint_32)max_pixel_depth + 7) >> 3) +
+ row_bytes = PNG_ROWBYTES(max_pixel_depth,row_bytes) +
1 + ((max_pixel_depth + 7) >> 3);
#ifdef PNG_MAX_MALLOC_64K
if (row_bytes > (png_uint_32)65536L)
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
png_error(png_ptr, "This image requires a row greater than 64KB");
#endif
+ if ((png_uint_32)png_ptr->rowbytes + 1 > PNG_SIZE_MAX)
+ png_error(png_ptr, "Row has too many bytes to allocate in memory.");
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
png_ptr->rowbytes + 1));
/* pngset.c - storage of image information into info struct
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
if (png_ptr == NULL || info_ptr == NULL)
return;
- png_memcpy(&(info_ptr->background), background, sizeof(png_color_16));
+ png_memcpy(&(info_ptr->background), background, png_sizeof(png_color_16));
info_ptr->valid |= PNG_INFO_bKGD;
}
#endif
"Ignoring attempt to set negative chromaticity value");
return;
}
- if (white_x > (double) PNG_MAX_UINT || white_y > (double) PNG_MAX_UINT ||
- red_x > (double) PNG_MAX_UINT || red_y > (double) PNG_MAX_UINT ||
- green_x > (double) PNG_MAX_UINT || green_y > (double) PNG_MAX_UINT ||
- blue_x > (double) PNG_MAX_UINT || blue_y > (double) PNG_MAX_UINT)
+ if (white_x > (double) PNG_UINT_31_MAX ||
+ white_y > (double) PNG_UINT_31_MAX ||
+ red_x > (double) PNG_UINT_31_MAX ||
+ red_y > (double) PNG_UINT_31_MAX ||
+ green_x > (double) PNG_UINT_31_MAX ||
+ green_y > (double) PNG_UINT_31_MAX ||
+ blue_x > (double) PNG_UINT_31_MAX ||
+ blue_y > (double) PNG_UINT_31_MAX)
{
png_warning(png_ptr,
"Ignoring attempt to set chromaticity value exceeding 21474.83");
if (png_ptr == NULL || info_ptr == NULL)
return;
- if (int_gamma > (png_fixed_point) PNG_MAX_UINT)
+ if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Limiting gamma to 21474.83");
- gamma=PNG_MAX_UINT;
+ gamma=PNG_UINT_31_MAX;
}
else
{
#endif
/* Changed from info->num_palette to 256 in version 1.2.1 */
png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
- (png_uint_32)(256 * sizeof (png_uint_16)));
+ (png_uint_32)(256 * png_sizeof (png_uint_16)));
if (png_ptr->hist == NULL)
{
png_warning(png_ptr, "Insufficient memory for hIST chunk data.");
int color_type, int interlace_type, int compression_type,
int filter_type)
{
- int rowbytes_per_pixel;
png_debug1(1, "in %s storage function\n", "IHDR");
if (png_ptr == NULL || info_ptr == NULL)
return;
/* check for width and height valid values */
if (width == 0 || height == 0)
png_error(png_ptr, "Image width or height is zero in IHDR");
- if (width > PNG_MAX_UINT || height > PNG_MAX_UINT)
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ if (width > png_ptr->user_width_max || height > png_ptr->user_height_max)
+ png_error(png_ptr, "image size exceeds user limits in IHDR");
+#else
+ if (width > PNG_USER_WIDTH_MAX || height > PNG_USER_HEIGHT_MAX)
+ png_error(png_ptr, "image size exceeds user limits in IHDR");
+#endif
+ if (width > PNG_UINT_31_MAX || height > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image size in IHDR");
+ if ( width > (PNG_UINT_32_MAX
+ >> 3) /* 8-byte RGBA pixels */
+ - 64 /* bigrowbuf hack */
+ - 1 /* filter byte */
+ - 7*8 /* rounding of width to multiple of 8 pixels */
+ - 8) /* extra max_pixel_depth pad */
+ png_warning(png_ptr, "Width is too large for libpng to process pixels");
/* check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
info_ptr->channels++;
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
- /* check for overflow */
- rowbytes_per_pixel = (info_ptr->pixel_depth + 7) >> 3;
- if ( width > PNG_MAX_UINT/rowbytes_per_pixel - 64)
- {
- png_warning(png_ptr,
- "Width too large to process image data; rowbytes will overflow.");
+ /* check for potential overflow */
+ if ( width > (PNG_UINT_32_MAX
+ >> 3) /* 8-byte RGBA pixels */
+ - 64 /* bigrowbuf hack */
+ - 1 /* filter byte */
+ - 7*8 /* rounding of width to multiple of 8 pixels */
+ - 8) /* extra max_pixel_depth pad */
info_ptr->rowbytes = (png_size_t)0;
- }
else
- info_ptr->rowbytes = (info_ptr->width * info_ptr->pixel_depth + 7) >> 3;
+ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,width);
}
#if defined(PNG_oFFs_SUPPORTED)
png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr,
- (png_uint_32)((nparams + 1) * sizeof(png_charp)));
+ (png_uint_32)((nparams + 1) * png_sizeof(png_charp)));
if (info_ptr->pcal_params == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL params.");
length = png_strlen(swidth) + 1;
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
- info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
+ info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
+ if (info_ptr->scal_s_width == NULL)
+ {
+ png_warning(png_ptr, "Memory allocation failed while processing sCAL.");
+ }
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
length = png_strlen(sheight) + 1;
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
- info_ptr->scal_s_height = (png_charp)png_malloc(png_ptr, length);
+ info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length);
+ if (info_ptr->scal_s_height == NULL)
+ {
+ png_free (png_ptr, info_ptr->scal_s_width);
+ png_warning(png_ptr, "Memory allocation failed while processing sCAL.");
+ }
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
info_ptr->valid |= PNG_INFO_sCAL;
#ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
#endif
+
/* Changed in libpng-1.2.1 to allocate 256 instead of num_palette entries,
in case of an invalid PNG file that has too-large sample values. */
- png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)256,
- sizeof (png_color));
- if (png_ptr->palette == NULL)
- png_error(png_ptr, "Unable to malloc palette");
- png_memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
+ png_ptr->palette = (png_colorp)png_malloc(png_ptr,
+ 256 * png_sizeof(png_color));
+ png_memset(png_ptr->palette, 0, 256 * png_sizeof(png_color));
+ png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof (png_color));
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
if (png_ptr == NULL || info_ptr == NULL)
return;
- png_memcpy(&(info_ptr->sig_bit), sig_bit, sizeof (png_color_8));
+ png_memcpy(&(info_ptr->sig_bit), sig_bit, png_sizeof (png_color_8));
info_ptr->valid |= PNG_INFO_sBIT;
}
#endif
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return;
- new_iccp_name = (png_charp)png_malloc(png_ptr, png_strlen(name)+1);
+ new_iccp_name = (png_charp)png_malloc_warn(png_ptr, png_strlen(name)+1);
+ if (new_iccp_name == NULL)
+ {
+ png_warning(png_ptr, "Insufficient memory to process iCCP chunk.");
+ return;
+ }
png_strcpy(new_iccp_name, name);
- new_iccp_profile = (png_charp)png_malloc(png_ptr, proflen);
+ new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen);
+ if (new_iccp_profile == NULL)
+ {
+ png_free (png_ptr, new_iccp_name);
+ png_warning(png_ptr, "Insufficient memory to process iCCP profile.");
+ return;
+ }
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
info_ptr->max_text = info_ptr->num_text + num_text + 8;
old_text = info_ptr->text;
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
- (png_uint_32)(info_ptr->max_text * sizeof (png_text)));
+ (png_uint_32)(info_ptr->max_text * png_sizeof (png_text)));
if (info_ptr->text == NULL)
{
png_free(png_ptr, old_text);
return(1);
}
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
- sizeof(png_text)));
+ png_sizeof(png_text)));
png_free(png_ptr, old_text);
}
else
info_ptr->max_text = num_text + 8;
info_ptr->num_text = 0;
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
- (png_uint_32)(info_ptr->max_text * sizeof (png_text)));
+ (png_uint_32)(info_ptr->max_text * png_sizeof (png_text)));
if (info_ptr->text == NULL)
return(1);
#ifdef PNG_FREE_ME_SUPPORTED
(png_ptr->mode & PNG_WROTE_tIME))
return;
- png_memcpy(&(info_ptr->mod_time), mod_time, sizeof (png_time));
+ png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof (png_time));
info_ptr->valid |= PNG_INFO_tIME;
}
#endif
if (trans_values != NULL)
{
png_memcpy(&(info_ptr->trans_values), trans_values,
- sizeof(png_color_16));
+ png_sizeof(png_color_16));
if (num_trans == 0)
num_trans = 1;
}
int i;
np = (png_sPLT_tp)png_malloc_warn(png_ptr,
- (info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t));
+ (info_ptr->splt_palettes_num + nentries) * png_sizeof(png_sPLT_t));
if (np == NULL)
{
png_warning(png_ptr, "No memory for sPLT palettes.");
}
png_memcpy(np, info_ptr->splt_palettes,
- info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
+ info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t));
png_free(png_ptr, info_ptr->splt_palettes);
info_ptr->splt_palettes=NULL;
to->name = (png_charp)png_malloc(png_ptr,
png_strlen(from->name) + 1);
+ /* TODO: use png_malloc_warn */
png_strcpy(to->name, from->name);
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
- from->nentries * sizeof(png_sPLT_t));
+ from->nentries * png_sizeof(png_sPLT_t));
+ /* TODO: use png_malloc_warn */
png_memcpy(to->entries, from->entries,
- from->nentries * sizeof(png_sPLT_t));
+ from->nentries * png_sizeof(png_sPLT_t));
to->nentries = from->nentries;
to->depth = from->depth;
}
np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
(info_ptr->unknown_chunks_num + num_unknowns) *
- sizeof(png_unknown_chunk));
+ png_sizeof(png_unknown_chunk));
if (np == NULL)
{
png_warning(png_ptr, "Out of memory while processing unknown chunk.");
}
png_memcpy(np, info_ptr->unknown_chunks,
- info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
+ info_ptr->unknown_chunks_num * png_sizeof(png_unknown_chunk));
png_free(png_ptr, info_ptr->unknown_chunks);
info_ptr->unknown_chunks=NULL;
png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
png_unknown_chunkp from = unknowns + i;
- png_strcpy((png_charp)to->name, (png_charp)from->name);
- to->data = (png_bytep)png_malloc(png_ptr, from->size);
+ png_strncpy((png_charp)to->name, (png_charp)from->name, 5);
+ to->data = (png_bytep)png_malloc_warn(png_ptr, from->size);
if (to->data == NULL)
- png_warning(png_ptr, "Out of memory while processing unknown chunk.");
+ {
+ png_warning(png_ptr, "Out of memory processing unknown chunk.");
+ }
else
{
- png_memcpy(to->data, from->data, from->size);
- to->size = from->size;
+ png_memcpy(to->data, from->data, from->size);
+ to->size = from->size;
- /* note our location in the read or write sequence */
- to->location = (png_byte)(png_ptr->mode & 0xff);
+ /* note our location in the read or write sequence */
+ to->location = (png_byte)(png_ptr->mode & 0xff);
}
}
int i, old_num_chunks;
if (num_chunks == 0)
{
- if(keep == HANDLE_CHUNK_ALWAYS || keep == HANDLE_CHUNK_IF_SAFE)
+ if(keep == PNG_HANDLE_CHUNK_ALWAYS || keep == PNG_HANDLE_CHUNK_IF_SAFE)
png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
else
png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
- if(keep == HANDLE_CHUNK_ALWAYS)
+ if(keep == PNG_HANDLE_CHUNK_ALWAYS)
png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS;
else
png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS;
}
#endif
+#ifdef PNG_WRITE_SUPPORTED
void PNGAPI
png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
{
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
}
+#endif
void PNGAPI
png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold;
}
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+/* this function was added to libpng 1.2.6 */
+void PNGAPI
+png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
+ png_uint_32 user_height_max)
+{
+ /* Images with dimensions larger than these limits will be
+ * rejected by png_set_IHDR(). To accept any PNG datastream
+ * regardless of dimensions, set both limits to 0x7ffffffL.
+ */
+ png_ptr->user_width_max = user_width_max;
+ png_ptr->user_height_max = user_height_max;
+}
+#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
+
#endif /* ?PNG_1_0_X */
/* pngtest.c - a simple test program to test libpng
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* of files at once by typing "pngtest -m file1.png file2.png ..."
*/
+#include "png.h"
+
#if defined(_WIN32_WCE)
# if _WIN32_WCE < 211
__error__ (f|w)printf functions are not supported on old WindowsCE.;
#include <time.h>
#endif
-#include "png.h"
-
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
PNGAPI
#endif
read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
+void
#ifdef PNG_1_0_X
PNGAPI
#endif
-void
read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
{
- if(png_ptr == NULL || row_number > PNG_MAX_UINT) return;
+ if(png_ptr == NULL || row_number > PNG_UINT_31_MAX) return;
if(status_pass != pass)
{
fprintf(stdout,"\n Pass %d: ",pass);
fprintf(stdout, "r");
}
+void
#ifdef PNG_1_0_X
PNGAPI
#endif
-void
write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
+void
#ifdef PNG_1_0_X
PNGAPI
#endif
-void
write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
{
- if(png_ptr == NULL || row_number > PNG_MAX_UINT || pass > 7) return;
+ if(png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) return;
fprintf(stdout, "w");
}
/* END of code to validate stdio-free compilation */
/* START of code to validate memory allocation and deallocation */
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
/* Allocate memory. For reasonable files, size should never exceed
64K. However, zlib may allocate more then 64K if you don't tell
/* This calls the library allocator twice, once to get the requested
buffer and once to get a new free list entry. */
{
- memory_infop pinfo = (memory_infop)png_malloc_default(png_ptr,
- (png_uint_32)sizeof *pinfo);
+ /* Disable malloc_fn and free_fn */
+ memory_infop pinfo;
+ png_set_mem_fn(png_ptr, NULL, NULL, NULL);
+ pinfo = (memory_infop)png_malloc(png_ptr,
+ (png_uint_32)png_sizeof (*pinfo));
pinfo->size = size;
current_allocation += size;
total_allocation += size;
num_allocations ++;
if (current_allocation > maximum_allocation)
maximum_allocation = current_allocation;
- pinfo->pointer = (png_voidp)png_malloc_default(png_ptr, size);
+ pinfo->pointer = (png_voidp)png_malloc(png_ptr, size);
+ /* Restore malloc_fn and free_fn */
+ png_set_mem_fn(png_ptr, png_voidp_NULL, (png_malloc_ptr)png_debug_malloc,
+ (png_free_ptr)png_debug_free);
+ if (size != 0 && pinfo->pointer == NULL)
+ {
+ current_allocation -= size;
+ total_allocation -= size;
+ png_error(png_ptr,
+ "out of memory in pngtest->png_debug_malloc.");
+ }
pinfo->next = pinformation;
pinformation = pinfo;
/* Make sure the caller isn't assuming zeroed memory. */
png_memset(pinfo->pointer, 0xdd, pinfo->size);
-#if PNG_DEBUG
if(verbose)
printf("png_malloc %lu bytes at %x\n",size,pinfo->pointer);
-#endif
assert(pinfo->size != 12345678);
return (png_voidp)(pinfo->pointer);
}
}
/* Finally free the data. */
-#if PNG_DEBUG
if(verbose)
printf("Freeing %x\n",ptr);
-#endif
png_free_default(png_ptr, ptr);
ptr=NULL;
}
-#endif /* PNG_USER_MEM_SUPPORTED */
+#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
/* END of code to test memory allocation/deallocation */
/* Test one file */
}
png_debug(0, "Allocating read and write structures\n");
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
pngtest_warning);
#endif
#ifdef PNG_WRITE_SUPPORTED
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
return (1);
}
#ifdef USE_FAR_KEYWORD
- png_memcpy(png_jmpbuf(read_ptr),jmpbuf,sizeof(jmp_buf));
+ png_memcpy(png_jmpbuf(read_ptr),jmpbuf,png_sizeof(jmp_buf));
#endif
#ifdef PNG_WRITE_SUPPORTED
return (1);
}
#ifdef USE_FAR_KEYWORD
- png_memcpy(png_jmpbuf(write_ptr),jmpbuf,sizeof(jmp_buf));
+ png_memcpy(png_jmpbuf(write_ptr),jmpbuf,png_sizeof(jmp_buf));
#endif
#endif
#endif
png_set_write_user_transform_fn(write_ptr, count_zero_samples);
#endif
-#define HANDLE_CHUNK_IF_SAFE 2
-#define HANDLE_CHUNK_ALWAYS 3
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
- png_set_keep_unknown_chunks(read_ptr, HANDLE_CHUNK_ALWAYS,
+# ifndef PNG_HANDLE_CHUNK_ALWAYS
+# define PNG_HANDLE_CHUNK_ALWAYS 3
+# endif
+ png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS,
png_bytep_NULL, 0);
#endif
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
- png_set_keep_unknown_chunks(write_ptr, HANDLE_CHUNK_IF_SAFE,
+# ifndef PNG_HANDLE_CHUNK_IF_SAFE
+# define PNG_HANDLE_CHUNK_IF_SAFE 2
+# endif
+ png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_IF_SAFE,
png_bytep_NULL, 0);
#endif
/* Show the version of libpng used in building the application */
fprintf(STDERR," pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
PNG_HEADER_VERSION_STRING);
- fprintf(STDERR," sizeof(png_struct)=%ld, sizeof(png_info)=%ld\n",
- (long)sizeof(png_struct), (long)sizeof(png_info));
+ fprintf(STDERR," png_sizeof(png_struct)=%ld, png_sizeof(png_info)=%ld\n",
+ (long)png_sizeof(png_struct), (long)png_sizeof(png_info));
/* Do some consistency checking on the memory allocation settings, I'm
not sure this matters, but it is nice to know, the first of these
if (multiple)
{
int i;
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
int allocation_now = current_allocation;
#endif
for (i=2; i<argc; ++i)
fprintf(STDERR, " FAIL\n");
ierror += kerror;
}
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
if (allocation_now != current_allocation)
fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n",
current_allocation-allocation_now);
}
#endif
}
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
fprintf(STDERR, " Current memory allocation: %10d bytes\n",
current_allocation);
fprintf(STDERR, " Maximum memory allocation: %10d bytes\n",
for (i=0; i<3; ++i)
{
int kerror;
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
int allocation_now = current_allocation;
#endif
if (i == 1) status_dots_requested = 1;
fprintf(STDERR, " FAIL\n");
ierror += kerror;
}
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
if (allocation_now != current_allocation)
fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n",
current_allocation-allocation_now);
}
#endif
}
-#ifdef PNG_USER_MEM_SUPPORTED
+#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
fprintf(STDERR, " Current memory allocation: %10d bytes\n",
current_allocation);
fprintf(STDERR, " Maximum memory allocation: %10d bytes\n",
}
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_5rc3 your_png_h_is_not_version_1_2_5rc3;
+typedef version_1_2_6 your_png_h_is_not_version_1_2_6;
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
*
* For Intel x86 CPU and Microsoft Visual C++ compiler
*
- * libpng version 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* Copyright (c) 1998, Intel Corporation
*
* Contributed by Nirav Chhatrapati, Intel Corporation, 1998
png_debug(1,"in png_combine_row_asm\n");
if (mmx_supported == 2) {
+#if !defined(PNG_1_0_X)
/* this should have happened in png_init_mmx_flags() already */
png_warning(png_ptr, "asm_flags may not have been initialized");
+#endif
png_mmx_support();
}
if (mask == 0xff)
{
png_memcpy(row, png_ptr->row_buf + 1,
- (png_size_t)((png_ptr->width * png_ptr->row_info.pixel_depth + 7) >> 3));
+ (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+ png_ptr->width));
}
/* GRR: add "else if (mask == 0)" case?
* or does png_combine_row() not even get called in that case? */
__int64 mask0=0x0102040810204080;
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && mmx_supported */ )
+#else
+ if (mmx_supported)
+#endif
{
srcptr = png_ptr->row_buf + 1;
dstptr = row;
__int64 mask1=0x0101020204040808,
mask0=0x1010202040408080;
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && mmx_supported */ )
+#else
+ if (mmx_supported)
+#endif
{
srcptr = png_ptr->row_buf + 1;
dstptr = row;
len = (png_ptr->width)&~7;
diff = (png_ptr->width)&7;
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && mmx_supported */ )
+#else
+ if (mmx_supported)
+#endif
{
_asm
{
len = (png_ptr->width)&~7;
diff = (png_ptr->width)&7;
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && mmx_supported */ )
+#else
+ if (mmx_supported)
+#endif
{
_asm
{
mask1=0x2020202040404040,
mask0=0x4040808080808080;
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)
/* && mmx_supported */ )
+#else
+ if (mmx_supported)
+#endif
{
srcptr = png_ptr->row_buf + 1;
dstptr = row;
png_debug(1,"in png_do_read_interlace\n");
if (mmx_supported == 2) {
+#if !defined(PNG_1_0_X)
/* this should have happened in png_init_mmx_flags() already */
png_warning(png_ptr, "asm_flags may not have been initialized");
+#endif
png_mmx_support();
}
/* sign fix by GRR */
/* NOTE: there is NO MMX code for 48-bit and 64-bit images */
- /* use MMX routine if machine supports it */
+ // use MMX routine if machine supports it
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)
/* && mmx_supported */ )
+#else
+ if (mmx_supported)
+#endif
{
if (pixel_bytes == 3)
{
} /* end switch (row_info->pixel_depth) */
row_info->width = final_width;
- row_info->rowbytes = ((final_width *
- (png_uint_32)row_info->pixel_depth + 7) >> 3);
+
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width);
}
}
#endif
if (mmx_supported == 2) {
+#if !defined(PNG_1_0_X)
/* this should have happened in png_init_mmx_flags() already */
png_warning(png_ptr, "asm_flags may not have been initialized");
+#endif
png_mmx_support();
}
{
case 0: sprintf(filnm, "none");
break;
+#if !defined(PNG_1_0_X)
case 1: sprintf(filnm, "sub-%s",
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : "x86");
break;
case 4: sprintf(filnm, "Paeth-%s",
(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":"x86");
break;
+#else
+ case 1: sprintf(filnm, "sub");
+ break;
+ case 2: sprintf(filnm, "up");
+ break;
+ case 3: sprintf(filnm, "avg");
+ break;
+ case 4: sprintf(filnm, "Paeth");
+ break;
+#endif
default: sprintf(filnm, "unknw");
break;
}
case PNG_FILTER_VALUE_SUB:
{
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
+#else
+ if (mmx_supported)
+#endif
{
png_read_filter_row_mmx_sub(row_info, row);
}
case PNG_FILTER_VALUE_UP:
{
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
+#else
+ if (mmx_supported)
+#endif
{
png_read_filter_row_mmx_up(row_info, row, prev_row);
}
case PNG_FILTER_VALUE_AVG:
{
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
+#else
+ if (mmx_supported)
+#endif
{
png_read_filter_row_mmx_avg(row_info, row, prev_row);
}
case PNG_FILTER_VALUE_PAETH:
{
+#if !defined(PNG_1_0_X)
if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) &&
(row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) &&
(row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold))
+#else
+ if (mmx_supported)
+#endif
{
png_read_filter_row_mmx_paeth(row_info, row, prev_row);
}
/* pngwio.c - functions for data output
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
/* pngwrite.c - general routines to write a PNG file
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
up++)
{
int keep=png_handle_as_unknown(png_ptr, up->name);
- if (keep != HANDLE_CHUNK_NEVER &&
- up->location && (!(up->location & PNG_HAVE_PLTE)) &&
- ((up->name[3] & 0x20) || keep == HANDLE_CHUNK_ALWAYS ||
+ if (keep != PNG_HANDLE_CHUNK_NEVER &&
+ up->location && !(up->location & PNG_HAVE_PLTE) &&
+ !(up->location & PNG_HAVE_IDAT) &&
+ ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
up++)
{
int keep=png_handle_as_unknown(png_ptr, up->name);
- if (keep != HANDLE_CHUNK_NEVER &&
+ if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
- ((up->name[3] & 0x20) || keep == HANDLE_CHUNK_ALWAYS ||
+ ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
up++)
{
int keep=png_handle_as_unknown(png_ptr, up->name);
- if (keep != HANDLE_CHUNK_NEVER &&
+ if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_AFTER_IDAT) &&
- ((up->name[3] & 0x20) || keep == HANDLE_CHUNK_ALWAYS ||
+ ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
#endif
#endif /* PNG_1_0_X */
+ /* added at libpng-1.2.6 */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+#endif
+
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
return (NULL);
}
#ifdef USE_FAR_KEYWORD
- png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
+ png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
#endif
#endif
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
- png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
+ png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
PNG_ABORT();
{
/* We only come here via pre-1.0.12-compiled applications */
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
- if(sizeof(png_struct) > png_struct_size || sizeof(png_info) > png_info_size)
+ if(png_sizeof(png_struct) > png_struct_size ||
+ png_sizeof(png_info) > png_info_size)
{
char msg[80];
png_ptr->warning_fn=NULL;
png_warning(png_ptr, msg);
}
#endif
- if(sizeof(png_struct) > png_struct_size)
+ if(png_sizeof(png_struct) > png_struct_size)
{
png_ptr->error_fn=NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_error(png_ptr,
"The png struct allocated by the application for writing is too small.");
}
- if(sizeof(png_info) > png_info_size)
+ if(png_sizeof(png_info) > png_info_size)
{
png_ptr->error_fn=NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
#ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */
- png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
+ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
#endif
- if (sizeof(png_struct) > png_struct_size)
+ if (png_sizeof(png_struct) > png_struct_size)
{
png_destroy_struct(png_ptr);
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
}
/* reset all variables to 0 */
- png_memset(png_ptr, 0, sizeof (png_struct));
+ png_memset(png_ptr, 0, png_sizeof (png_struct));
+
+ /* added at libpng-1.2.6 */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+#endif
#if !defined(PNG_1_0_X)
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
#ifdef PNG_SETJMP_SUPPORTED
/* restore jump buffer */
- png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
+ png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
#endif
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
png_ptr->row_info.channels);
- png_ptr->row_info.rowbytes = ((png_ptr->row_info.width *
- (png_uint_32)png_ptr->row_info.pixel_depth + 7) >> 3);
+ png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+ png_ptr->row_info.width);
png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type);
png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width);
#ifdef PNG_SETJMP_SUPPORTED
/* reset structure */
- png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
+ png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf));
#endif
error_fn = png_ptr->error_fn;
free_fn = png_ptr->free_fn;
#endif
- png_memset(png_ptr, 0, sizeof (png_struct));
+ png_memset(png_ptr, 0, png_sizeof (png_struct));
png_ptr->error_fn = error_fn;
png_ptr->warning_fn = warning_fn;
#endif
#ifdef PNG_SETJMP_SUPPORTED
- png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf));
+ png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf));
#endif
}
if (png_ptr->prev_filters == NULL)
{
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(sizeof(png_byte) * num_weights));
+ (png_uint_32)(png_sizeof(png_byte) * num_weights));
/* To make sure that the weighting starts out fairly */
for (i = 0; i < num_weights; i++)
if (png_ptr->filter_weights == NULL)
{
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(sizeof(png_uint_16) * num_weights));
+ (png_uint_32)(png_sizeof(png_uint_16) * num_weights));
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(sizeof(png_uint_16) * num_weights));
+ (png_uint_32)(png_sizeof(png_uint_16) * num_weights));
for (i = 0; i < num_weights; i++)
{
png_ptr->inv_filter_weights[i] =
if (png_ptr->filter_costs == NULL)
{
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
+ (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
- (png_uint_32)(sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
+ (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
{
/* pngwtran.c - transforms the data in a row for PNG writers
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
}
row_info->bit_depth = (png_byte)bit_depth;
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
- row_info->rowbytes =
- ((row_info->width * row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
+ row_info->width);
}
}
#endif
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
- png_uint_32 s0=*(rp )<<8 | *(rp+1);
- png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
- png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
- png_uint_32 red=(s0-s1)&0xffff;
- png_uint_32 blue=(s2-s1)&0xffff;
- *(rp ) = (png_byte)((red>>8)&0xff);
- *(rp+1) = (png_byte)(red&0xff);
- *(rp+4) = (png_byte)((blue>>8)&0xff);
- *(rp+5) = (png_byte)(blue&0xff);
+ png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
+ png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
+ png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
+ png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL);
+ png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL);
+ *(rp ) = (png_byte)((red >> 8) & 0xff);
+ *(rp+1) = (png_byte)(red & 0xff);
+ *(rp+4) = (png_byte)((blue >> 8) & 0xff);
+ *(rp+5) = (png_byte)(blue & 0xff);
}
}
}
/* pngwutil.c - utilities to write a PNG file
*
- * libpng 1.2.5rc3 - September 18, 2002
+ * libpng version 1.2.6 - August 15, 2004
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2002 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
old_ptr = comp->output_ptr;
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
- (png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
+ (png_uint_32)(comp->max_output_ptr *
+ png_sizeof (png_charpp)));
png_memcpy(comp->output_ptr, old_ptr, old_max
- * sizeof (png_charp));
+ * png_sizeof (png_charp));
png_free(png_ptr, old_ptr);
}
else
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
- (png_uint_32)(comp->max_output_ptr * sizeof (png_charp)));
+ (png_uint_32)(comp->max_output_ptr *
+ png_sizeof (png_charp)));
}
/* save the data */
old_ptr = comp->output_ptr;
/* This could be optimized to realloc() */
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
- (png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
+ (png_uint_32)(comp->max_output_ptr *
+ png_sizeof (png_charpp)));
png_memcpy(comp->output_ptr, old_ptr,
- old_max * sizeof (png_charp));
+ old_max * png_sizeof (png_charp));
png_free(png_ptr, old_ptr);
}
else
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
- (png_uint_32)(comp->max_output_ptr * sizeof (png_charp)));
+ (png_uint_32)(comp->max_output_ptr *
+ png_sizeof (png_charp)));
}
/* save off the data */
#if defined(PNG_MNG_FEATURES_SUPPORTED)
png_ptr->filter_type = (png_byte)filter_type;
#endif
+ png_ptr->compression_type = (png_byte)compression_type;
png_ptr->width = width;
png_ptr->height = height;
png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels);
- png_ptr->rowbytes = ((width * (png_size_t)png_ptr->pixel_depth + 7) >> 3);
+ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
/* set the usr info, so any transformations can modify it */
png_ptr->usr_width = png_ptr->width;
png_ptr->usr_bit_depth = png_ptr->bit_depth;
PNG_IDAT;
#endif
png_debug(1, "in png_write_IDAT\n");
+
+ /* Optimize the CMF field in the zlib stream. */
+ /* This hack of the zlib stream is compliant to the stream specification. */
+ if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
+ png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
+ {
+ unsigned int z_cmf = data[0]; /* zlib compression method and flags */
+ if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70)
+ {
+ /* Avoid memory underflows and multiplication overflows. */
+ /* The conditions below are practically always satisfied;
+ however, they still must be checked. */
+ if (length >= 2 &&
+ png_ptr->height < 16384 && png_ptr->width < 16384)
+ {
+ png_uint_32 uncompressed_idat_size = png_ptr->height *
+ (PNG_ROWBYTES(png_ptr->channels*png_ptr->bit_depth,
+ png_ptr->channels * png_ptr->bit_depth + 15) >> 3);
+ unsigned int z_cinfo = z_cmf >> 4;
+ unsigned int half_z_window_size = 1 << (z_cinfo + 7);
+ while (uncompressed_idat_size <= half_z_window_size &&
+ half_z_window_size >= 256)
+ {
+ z_cinfo--;
+ half_z_window_size >>= 1;
+ }
+ z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
+ if (data[0] != (png_byte)z_cmf)
+ {
+ data[0] = (png_byte)z_cmf;
+ data[1] &= 0xe0;
+ data[1] += (png_byte)(0x1f - ((z_cmf << 8) + data[1]) % 0x1f);
+ }
+ }
+ }
+ else
+ png_error(png_ptr,
+ "Invalid zlib compression method or flags in IDAT");
+ }
+
png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length);
png_ptr->mode |= PNG_HAVE_IDAT;
}
png_debug1(2, "Keyword to be checked is '%s'\n", key);
- *new_key = (png_charp)png_malloc(png_ptr, (png_uint_32)(key_len + 2));
+ *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
+ if (*new_key == NULL)
+ {
+ png_warning(png_ptr, "Out of memory while procesing keyword");
+ return ((png_size_t)0);
+ }
/* Replace non-printing characters with a blank and print a warning */
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
{
png_warning(png_ptr, "Empty language field in iTXt chunk");
new_lang = NULL;
- lang_len = 0;
+ lang_len = 0;
}
if (lang_key == NULL)
total_len = purpose_len + units_len + 10;
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
- *sizeof(png_uint_32)));
+ *png_sizeof(png_uint_32)));
/* Find the length of each parameter, making sure we don't count the
null terminator for the last parameter. */
png_size_t buf_size;
png_debug(1, "in png_write_start_row\n");
- buf_size = (png_size_t)(((png_ptr->width * png_ptr->usr_channels *
- png_ptr->usr_bit_depth + 7) >> 3) + 1);
+ buf_size = (png_size_t)(PNG_ROWBYTES(
+ png_ptr->usr_channels*png_ptr->usr_bit_depth,png_ptr->width)+1);
/* set up row buffer */
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
{
if (png_ptr->prev_row != NULL)
png_memset(png_ptr->prev_row, 0,
- (png_size_t) (((png_uint_32)png_ptr->usr_channels *
- (png_uint_32)png_ptr->usr_bit_depth *
- png_ptr->width + 7) >> 3) + 1);
+ (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*
+ png_ptr->usr_bit_depth,png_ptr->width))+1);
return;
}
}
png_pass_inc[pass] - 1 -
png_pass_start[pass]) /
png_pass_inc[pass];
- row_info->rowbytes = ((row_info->width *
- row_info->pixel_depth + 7) >> 3);
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
+ row_info->width);
}
}
#endif
png_debug(1, "in png_write_find_filter\n");
/* find out how many bytes offset each pixel is */
- bpp = (row_info->pixel_depth + 7) / 8;
+ bpp = (row_info->pixel_depth + 7) >> 3;
prev_row = png_ptr->prev_row;
best_row = row_buf = png_ptr->row_buf;
sum += (v < 128) ? v : 256 - v;
}
- for (lp = row_buf + 1; i < row_info->rowbytes;
+ for (lp = row_buf + 1; i < row_bytes;
i++, rp++, lp++, dp++)
{
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
+++ /dev/null
-make -fmakefile.bor -B -DMODEL=m %1 %2 %3 libpng >buildm.out
-make -fmakefile.bor -B -DMODEL=l %1 %2 %3 libpng >buildl.out
+++ /dev/null
-# Project: libpng
-
-
-# Toolflags:
-CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback -DRISCOS -fnah
-C++flags = -c -depend !Depend -IC: -throwback
-Linkflags = -aif -c++ -o $@
-ObjAsmflags = -throwback -NoCache -depend !Depend
-CMHGflags =
-LibFileflags = -c -l -o $@
-Squeezeflags = -o $@
-
-
-# Final targets:
-@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
- @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \
- @.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
- LibFile $(LibFileflags) @.o.png @.o.pngerror @.o.pngrio @.o.pngrtran \
- @.o.pngmem @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngwio \
- @.o.pngrutil @.o.pngtrans @.o.pngwrite @.o.pngwtran @.o.pngwutil
-@.mm-libpng-lib: @.mm.png @.mm.pngerror @.mm.pngrio @.mm.pngwio @.mm.pngmem \
- @.mm.pngpread @.mm.pngset @.mm.pngget @.mm.pngread @.mm.pngrtran \
- @.mm.pngrutil @.mm.pngtrans @.mm.pngwrite @.mm.pngwtran @.mm.pngwutil
- LibFile $(LibFileflags) @.mm.png @.mm.pngerror @.mm.pngrio \
- @.mm.pngwio @.mm.pngmem @.mm.pngpread @.mm.pngset @.mm.pngget \
- @.mm.pngread @.mm.pngrtran @.mm.pngrutil @.mm.pngtrans @.mm.pngwrite \
- @.mm.pngwtran @.mm.pngwutil
-
-
-# User-editable dependencies:
-# (C) Copyright 1997 Tom Tanner
-Test: @.pngtest
- <Prefix$Dir>.pngtest
- @remove <Prefix$Dir>.pngtest
-
-#It would be nice if you could stop "make" listing from here on!
-@.pngtest: @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
- Link $(Linkflags) @.o.pngtest @.libpng-lib C:o.Stubs Zlib:zlib_lib
-
-.SUFFIXES: .o .mm .c
-
-.c.mm:
- MemCheck.CC cc $(ccflags) -o $@ LibPng:$<
-.c.o:
- cc $(ccflags) -o $@ $<
-
-
-# Static dependencies:
-
-
-# Dynamic dependencies:
-o.pngtest: c.pngtest
-o.pngtest: h.png
-o.pngtest: Zlib:h.zlib
-o.pngtest: Zlib:h.zconf
-o.pngtest: h.pngconf
-mm.png: LibPng:c.png
-mm.png: LibPng:h.png
-mm.png: Zlib:h.zlib
-mm.png: Zlib:h.zconf
-mm.png: LibPng:h.pngconf
-mm.png: MemCheck:ANSI.h.stdio
-mm.pngerror: LibPng:c.pngerror
-mm.pngerror: LibPng:h.png
-mm.pngerror: Zlib:h.zlib
-mm.pngerror: Zlib:h.zconf
-mm.pngerror: LibPng:h.pngconf
-mm.pngerror: MemCheck:ANSI.h.stdio
-mm.pngrio: LibPng:c.pngrio
-mm.pngrio: LibPng:h.png
-mm.pngrio: Zlib:h.zlib
-mm.pngrio: Zlib:h.zconf
-mm.pngrio: LibPng:h.pngconf
-mm.pngrio: MemCheck:ANSI.h.stdio
-mm.pngwio: LibPng:c.pngwio
-mm.pngwio: LibPng:h.png
-mm.pngwio: Zlib:h.zlib
-mm.pngwio: Zlib:h.zconf
-mm.pngwio: LibPng:h.pngconf
-mm.pngwio: MemCheck:ANSI.h.stdio
-mm.pngmem: LibPng:c.pngmem
-mm.pngmem: LibPng:h.png
-mm.pngmem: Zlib:h.zlib
-mm.pngmem: Zlib:h.zconf
-mm.pngmem: LibPng:h.pngconf
-mm.pngmem: MemCheck:ANSI.h.stdio
-mm.pngpread: LibPng:c.pngpread
-mm.pngpread: LibPng:h.png
-mm.pngpread: Zlib:h.zlib
-mm.pngpread: Zlib:h.zconf
-mm.pngpread: LibPng:h.pngconf
-mm.pngpread: MemCheck:ANSI.h.stdio
-mm.pngset: LibPng:c.pngset
-mm.pngset: LibPng:h.png
-mm.pngset: Zlib:h.zlib
-mm.pngset: Zlib:h.zconf
-mm.pngset: LibPng:h.pngconf
-mm.pngset: MemCheck:ANSI.h.stdio
-mm.pngget: LibPng:c.pngget
-mm.pngget: LibPng:h.png
-mm.pngget: Zlib:h.zlib
-mm.pngget: Zlib:h.zconf
-mm.pngget: LibPng:h.pngconf
-mm.pngget: MemCheck:ANSI.h.stdio
-mm.pngread: LibPng:c.pngread
-mm.pngread: LibPng:h.png
-mm.pngread: Zlib:h.zlib
-mm.pngread: Zlib:h.zconf
-mm.pngread: LibPng:h.pngconf
-mm.pngread: MemCheck:ANSI.h.stdio
-mm.pngrtran: LibPng:c.pngrtran
-mm.pngrtran: LibPng:h.png
-mm.pngrtran: Zlib:h.zlib
-mm.pngrtran: Zlib:h.zconf
-mm.pngrtran: LibPng:h.pngconf
-mm.pngrtran: MemCheck:ANSI.h.stdio
-mm.pngrutil: LibPng:c.pngrutil
-mm.pngrutil: LibPng:h.png
-mm.pngrutil: Zlib:h.zlib
-mm.pngrutil: Zlib:h.zconf
-mm.pngrutil: LibPng:h.pngconf
-mm.pngrutil: MemCheck:ANSI.h.stdio
-mm.pngtrans: LibPng:c.pngtrans
-mm.pngtrans: LibPng:h.png
-mm.pngtrans: Zlib:h.zlib
-mm.pngtrans: Zlib:h.zconf
-mm.pngtrans: LibPng:h.pngconf
-mm.pngtrans: MemCheck:ANSI.h.stdio
-mm.pngwrite: LibPng:c.pngwrite
-mm.pngwrite: LibPng:h.png
-mm.pngwrite: Zlib:h.zlib
-mm.pngwrite: Zlib:h.zconf
-mm.pngwrite: LibPng:h.pngconf
-mm.pngwrite: MemCheck:ANSI.h.stdio
-mm.pngwtran: LibPng:c.pngwtran
-mm.pngwtran: LibPng:h.png
-mm.pngwtran: Zlib:h.zlib
-mm.pngwtran: Zlib:h.zconf
-mm.pngwtran: LibPng:h.pngconf
-mm.pngwtran: MemCheck:ANSI.h.stdio
-mm.pngwutil: LibPng:c.pngwutil
-mm.pngwutil: LibPng:h.png
-mm.pngwutil: Zlib:h.zlib
-mm.pngwutil: Zlib:h.zconf
-mm.pngwutil: LibPng:h.pngconf
-mm.pngwutil: MemCheck:ANSI.h.stdio
-o.png: c.png
-o.png: h.png
-o.png: Zlib:h.zlib
-o.png: Zlib:h.zconf
-o.png: h.pngconf
-o.pngerror: c.pngerror
-o.pngerror: h.png
-o.pngerror: Zlib:h.zlib
-o.pngerror: Zlib:h.zconf
-o.pngerror: h.pngconf
-o.pngrio: c.pngrio
-o.pngrio: h.png
-o.pngrio: Zlib:h.zlib
-o.pngrio: Zlib:h.zconf
-o.pngrio: h.pngconf
-o.pngwio: c.pngwio
-o.pngwio: h.png
-o.pngwio: Zlib:h.zlib
-o.pngwio: Zlib:h.zconf
-o.pngwio: h.pngconf
-o.pngmem: c.pngmem
-o.pngmem: h.png
-o.pngmem: Zlib:h.zlib
-o.pngmem: Zlib:h.zconf
-o.pngmem: h.pngconf
-o.pngpread: c.pngpread
-o.pngpread: h.png
-o.pngpread: Zlib:h.zlib
-o.pngpread: Zlib:h.zconf
-o.pngpread: h.pngconf
-o.pngset: c.pngset
-o.pngset: h.png
-o.pngset: Zlib:h.zlib
-o.pngset: Zlib:h.zconf
-o.pngset: h.pngconf
-o.pngget: c.pngget
-o.pngget: h.png
-o.pngget: Zlib:h.zlib
-o.pngget: Zlib:h.zconf
-o.pngget: h.pngconf
-o.pngread: c.pngread
-o.pngread: h.png
-o.pngread: Zlib:h.zlib
-o.pngread: Zlib:h.zconf
-o.pngread: h.pngconf
-o.pngrtran: c.pngrtran
-o.pngrtran: h.png
-o.pngrtran: Zlib:h.zlib
-o.pngrtran: Zlib:h.zconf
-o.pngrtran: h.pngconf
-o.pngrutil: c.pngrutil
-o.pngrutil: h.png
-o.pngrutil: Zlib:h.zlib
-o.pngrutil: Zlib:h.zconf
-o.pngrutil: h.pngconf
-o.pngtrans: c.pngtrans
-o.pngtrans: h.png
-o.pngtrans: Zlib:h.zlib
-o.pngtrans: Zlib:h.zconf
-o.pngtrans: h.pngconf
-o.pngwrite: c.pngwrite
-o.pngwrite: h.png
-o.pngwrite: Zlib:h.zlib
-o.pngwrite: Zlib:h.zconf
-o.pngwrite: h.pngconf
-o.pngwtran: c.pngwtran
-o.pngwtran: h.png
-o.pngwtran: Zlib:h.zlib
-o.pngwtran: Zlib:h.zconf
-o.pngwtran: h.pngconf
-o.pngwutil: c.pngwutil
-o.pngwutil: h.png
-o.pngwutil: Zlib:h.zlib
-o.pngwutil: Zlib:h.zconf
-o.pngwutil: h.pngconf
+++ /dev/null
-# Commodore Amiga Makefile
-# makefile for libpng and SAS C V6.55 compiler
-# Copyright (C) 1995 Wolf Faust
-
-#compiler
-CC=sc
-#compiler flags
-# WARNING: a bug in V6.51 causes bad code with OPTGO
-# So use V6.55 or set NOOPTGO!!!!!!!!!
-CFLAGS= NOSTKCHK PARMS=REG OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL\
- OPTLOOP OPTRDEP=4 OPTDEP=4 OPTCOMP=4 DEFINE=PNG_INTERNAL
-#linker flags
-LDFLAGS= SD ND BATCH
-#link libs
-LDLIBS= libpng.lib libgz.lib LIB:scm.lib LIB:sc.lib Lib:amiga.lib
-# linker
-LN= slink
-# file deletion command
-RM= delete quiet
-# library (.lib) file creation command
-AR= oml
-# make directory command
-MKDIR= makedir
-
-OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o pngpread.o \
-pngread.o pngerror.o pngwrite.o pngrtran.o pngwtran.o pngrio.o pngwio.o pngmem.o
-
-all: libpng.lib pngtest
-
-libpng.lib: $(OBJS)
--$(RM) libpng.lib
-$(AR) libpng.lib r $(OBJS)
-
-pngtest: pngtest.o libpng.lib
-$(LN) <WITH <
-$(LDFLAGS)
-TO pngtest
-FROM LIB:c.o pngtest.o
-LIB $(LDLIBS)
-<
-
-
+++ /dev/null
-# makefile for libpng
-# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-# For conditions of distribution and use, see copyright notice in png.h
-# modified for LC56/ATARI assumes libz.lib is in same dir and uses default
-# rules for library management
-#
-CFLAGS=-I..\zlib -O
-LBR = png.lib
-LDFLAGS=-lpng -lz -lm
-
-# where make install puts libpng.a and png.h
-
-OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
- $(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
- $(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\
- $(LBR)(pngrtran.o) $(LBR)(pngwtran.o)\
- $(LBR)(pngmem.o) $(LBR)(pngrio.o) $(LBR)(pngwio.o) $(LBR)(pngpread.o)
-
-all: $(LBR) pngtest.ttp
-
-$(LBR): $(OBJS)
-
-pngtest.ttp: pngtest.o $(LBR)
- $(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
-
-install: libpng.a
- -@mkdir $(prefix)/include
- -@mkdir $(prefix)/lib
- cp png.h $(prefix)/include
- cp pngconf.h $(prefix)/include
- chmod 644 $(prefix)/include/p
+++ /dev/null
-# Makefile for png32bd.dll
-# -------------------- 32-bit Borland C++ --------------------
-
-# This makefile expects to find zlib.h and zlib32bd.lib in the
-# $(ZLIBDIR) directory.
-
-# The object files here are compiled with the "stdcall" calling convention.
-# This DLL requires zlib32bd.lib to be compiled in the same way.
-
-# Note that png32bd.dll exports the zlib functions adler32, crc32 and
-# the deflate... and inflate... functions. It does not export the
-# compress and uncompress functions, nor any of the gz... functions,
-# since libpng does not call them.
-
-.AUTODEPEND
-
-ZLIBDIR=..\zlib
-ZLIB=zlib32bd.lib
-PNGDLL=png32bd.dll
-PNGLIB=png32bd.lib
-
-CC=bcc32
-CFLAGS= -ps -O2 -N- -k- -d -r- -w-par -w-aus -I$(ZLIBDIR) \
- -DPNG_NO_GLOBAL_ARRAYS #-DPNG_DEBUG=5
-#LINK=tlink32
-#LINK=ilink32
-LINK=bcc32
-#LINKFLAGS= -Tpd -aa -c
-LINKFLAGS= -WDE
-IMPLIB=implib
-
-# Use this if you don't want Borland's fancy exception handling
-NOEHLIB=noeh32.lib
-
-.c.obj:
- $(CC) -c $(CFLAGS) $<
-
-.c.exe:
- $(CC) $(CFLAGS) $< $(PNGLIB) $(NOEHLIB)
-
-
-OBJ1=png.obj pngerror.obj pngget.obj pngmem.obj pngpread.obj
-OBJ2=pngread.obj pngrio.obj pngrtran.obj pngrutil.obj pngset.obj
-OBJ3=pngtrans.obj pngwio.obj pngwrite.obj pngwtran.obj pngwutil.obj
-
-all: $(PNGDLL)
-
-test: pngtest.exe
- pngtest
-
-
-$(PNGDLL): $(OBJ1) $(OBJ2) $(OBJ3) $(ZLIBDIR)\$(ZLIB)
- $(LINK) @&&|
-$(LINKFLAGS)
--e$(PNGDLL)
-$(OBJ1)
-$(OBJ2)
-$(OBJ3)
-$(ZLIBDIR)\$(ZLIB)
-$(NOEHLIB)
-|
- $(IMPLIB) -c $(@R).lib $@
-
-
-# Clean up anything else you want
-clean:
- -del *.obj
- -del *.dll
- -del *.exe
- -del *.lib
- -del *.lst
- -del *.map
- -del *.tds
-
-
-# End of makefile for png32bd.dll
+++ /dev/null
-# makefile for libpng on Linux ELF with gcc
-# Copyright (C) 1996, 1997 Andreas Dilger
-# Copyright (C) 1998 Greg Roelofs
-# For conditions of distribution and use, see copyright notice in png.h
-
-CC=gcc
-
-# Where the zlib library and include files are located
-#ZLIBLIB=/usr/local/lib
-#ZLIBINC=/usr/local/include
-ZLIBLIB=../zlib
-ZLIBINC=../zlib
-
-WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
- -Wmissing-declarations -Wtraditional -Wcast-align \
- -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
-CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -malign-loops=2 \
- -malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5
-LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
-
-RANLIB=ranlib
-#RANLIB=echo
-
-# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
-# have to change it.
-PNGMAJ = 2
-PNGMIN = 1.0
-PNGVER = $(PNGMAJ).$(PNGMIN)
-
-# where make install puts libpng.a, libpng.so*, and png.h
-prefix=/usr/local
-INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
-
-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
-
-OBJSDLL = $(OBJS:.o=.pic.o)
-
-.SUFFIXES: .c .o .pic.o
-
-.c.pic.o:
- $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
-
-all: libpng.a libpng.so pngtest
-
-libpng.a: $(OBJS)
- ar rc $@ $(OBJS)
- $(RANLIB) $@
-
-libpng.so: libpng.so.$(PNGMAJ)
- ln -sf libpng.so.$(PNGMAJ) libpng.so
-
-libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
- ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
-
-libpng.so.$(PNGVER): $(OBJSDLL)
- $(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
- $(OBJSDLL)
-
-pngtest: pngtest.o libpng.so
- $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-test: pngtest
- ./pngtest
-
-install: libpng.a libpng.so.$(PNGVER)
- -@mkdir $(INCPATH) $(LIBPATH)
- cp png.h pngconf.h $(INCPATH)
- chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
- cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
- chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
- -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
- (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
- ln -sf libpng.so.$(PNGMAJ) libpng.so)
-
-clean:
- /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
-
-# 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
-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
+++ /dev/null
-# makefile for libpng
-# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-# For conditions of distribution and use, see copyright notice in png.h
-
-CC=cc
-CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
-#CFLAGS=-O
-LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
-
-#RANLIB=ranlib
-RANLIB=echo
-
-# where make install puts libpng.a and png.h
-prefix=/usr/local
-
-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
-
-all: libpng.a pngtest
-
-libpng.a: $(OBJS)
- ar rc $@ $(OBJS)
- $(RANLIB) $@
-
-pngtest: pngtest.o libpng.a
- $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-test: pngtest
- ./pngtest
-
-install: libpng.a
- -@mkdir $(prefix)/include
- -@mkdir $(prefix)/lib
- cp png.h $(prefix)/include
- cp pngconf.h $(prefix)/include
- chmod 644 $(prefix)/include/png.h
- chmod 644 $(prefix)/include/pngconf.h
- cp libpng.a $(prefix)/lib
- chmod 644 $(prefix)/lib/libpng.a
-
-clean:
- rm -f *.o libpng.a pngtest pngout.png
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-png.o: png.h pngconf.h
-pngerror.o: png.h pngconf.h
-pngrio.o: png.h pngconf.h
-pngwio.o: png.h pngconf.h
-pngmem.o: png.h pngconf.h
-pngset.o: png.h pngconf.h
-pngget.o: png.h pngconf.h
-pngread.o: png.h pngconf.h
-pngpread.o: png.h pngconf.h
-pngrtran.o: png.h pngconf.h
-pngrutil.o: png.h pngconf.h
-pngtest.o: png.h pngconf.h
-pngtrans.o: png.h pngconf.h
-pngwrite.o: png.h pngconf.h
-pngwtran.o: png.h pngconf.h
-pngwutil.o: png.h pngconf.h
+++ /dev/null
-# makefile for libpng on Solaris 2.x with gcc
-# Contributed by William L. Sebok, based on makefile.lnx
-# Copyright (C) 1996, 1997 Andreas Dilger
-# Copyright (C) 1998 Greg Roelofs
-# For conditions of distribution and use, see copyright notice in png.h
-
-CC=gcc
-
-# 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 -O3 \
- #$(WARNMORE) -g -DPNG_DEBUG=5
-LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
-
-#RANLIB=ranlib
-RANLIB=echo
-
-# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
-# have to change it.
-PNGMAJ = 2
-PNGMIN = 1.0
-PNGVER = $(PNGMAJ).$(PNGMIN)
-
-# where make install puts libpng.a, libpng.so*, and png.h
-prefix=/usr/local
-INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
-
-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
-
-OBJSDLL = $(OBJS:.o=.pic.o)
-
-.SUFFIXES: .c .o .pic.o
-
-.c.pic.o:
- $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
-
-all: libpng.a libpng.so pngtest
-
-libpng.a: $(OBJS)
- ar rc $@ $(OBJS)
- $(RANLIB) $@
-
-libpng.so: libpng.so.$(PNGMAJ)
- ln -sf libpng.so.$(PNGMAJ) libpng.so
-
-libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
- ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
-
-libpng.so.$(PNGVER): $(OBJSDLL)
- $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
- -o libpng.so.$(PNGVER) $(OBJSDLL) -lz
-
-pngtest: pngtest.o libpng.so
- $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-test: pngtest
- ./pngtest
-
-install: libpng.a libpng.so.$(PNGVER)
- -@mkdir $(INCPATH) $(LIBPATH)
- cp png.h pngconf.h $(INCPATH)
- chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
- cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
- chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
- -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
- (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
- ln -sf libpng.so.$(PNGMAJ) libpng.so)
-
-clean:
- /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
-
-# 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
-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
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.4
+PNGMIN = 1.2.6
PNGVER = $(PNGMAJ).$(PNGMIN)
# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
WARNMORE=-fullwarn
# 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) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
+CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD \
+ -DPNG_NO_ASSEMBLER_CODE
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
-LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
+LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
+ -set_version sgi$(PNGMAJ).0
+LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
+ -set_version sgi$3.0
# See "man dso" for info about shared objects
RANLIB=echo
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
- echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
- -DPNG_NO_ASSEMBLER_CODE\"; \
- echo cflags=\"$(ABI)\"; \
- echo ldflags=\"-L$(LIBPATH) -rpath $(LIBPATH) \"; \
+ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
+ echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE\"; \
+ echo ccopts=\"$(ABI)\"; \
+ echo ldopts=\"$(ABI)\"; \
+ echo L_opts=\"-L$(LIBPATH)\"; \
+ echo libdir=\"$(LIBPATH)\"; \
echo libs=\"-lpng12 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LDSHARED) -o $@ $(OBJS)
rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
+libpng.so.3.$(PNGMIN): $(OBJS)
+ $(LDLEGACY) -o $@ $(OBJS)
+
pngtest: pngtest.o libpng.a
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-@/bin/rm -f $(DL)/libpng.a
(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
-install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
+install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
+ libpng.so.3.$(PNGMIN)
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
- -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
+ -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+ -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-@/bin/rm -f $(DL)/libpng.so
-@/bin/rm -f $(DL)/libpng.so.3
- -@/bin/rm -f $(DL)/libpng.so.3.*
+ -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
cp $(LIBNAME).so.$(PNGVER) $(DL)
+ cp libpng.so.3.$(PNGMIN) $(DL)
chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
+ chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
(cd $(DL); \
- ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
- ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
- ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
+ ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
+ ln -sf libpng.so.3 libpng.so; \
ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
echo
echo Testing installed dynamic shared library.
$(CC) -I$(ZLIBINC) \
- `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
- -L$(ZLIBLIB) -rpath $(ZLIBLIB) \
- -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
+ `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+ -L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
+ -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
./pngtesti pngtest.png
clean:
rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
- $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations
+ $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
+ libpng.so.3.$(PNGMIN) \
+ so_locations
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
+++ /dev/null
-# makefile for libpng
-# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-# For conditions of distribution and use, see copyright notice in png.h
-
-# Where the zlib library and include files are located
-#ZLIBLIB=/usr/local/lib
-#ZLIBINC=/usr/local/include
-ZLIBLIB=../zlib
-ZLIBINC=../zlib
-
-
-WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \
- -Wmissing-declarations -Wtraditional -Wcast-align \
- -Wstrict-prototypes -Wmissing-prototypes
-CC=gcc
-CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_DEBUG=4
-LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
-
-RANLIB=ranlib
-#RANLIB=echo
-
-# where make install puts libpng.a and png.h
-prefix=/usr/local
-
-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
-
-all: libpng.a pngtest
-
-libpng.a: $(OBJS)
- ar rc $@ $(OBJS)
- $(RANLIB) $@
-
-pngtest: pngtest.o libpng.a
- $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-test: pngtest
- ./pngtest
-
-install: libpng.a
- -@mkdir $(prefix)/include
- -@mkdir $(prefix)/lib
- cp png.h $(prefix)/include
- cp pngconf.h $(prefix)/include
- chmod 644 $(prefix)/include/png.h
- chmod 644 $(prefix)/include/pngconf.h
- cp libpng.a $(prefix)/lib
- chmod 644 $(prefix)/lib/libpng.a
-
-clean:
- rm -f *.o libpng.a pngtest pngout.png
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-png.o: png.h pngconf.h
-pngerror.o: png.h pngconf.h
-pngrio.o: png.h pngconf.h
-pngwio.o: png.h pngconf.h
-pngmem.o: png.h pngconf.h
-pngset.o: png.h pngconf.h
-pngget.o: png.h pngconf.h
-pngread.o: png.h pngconf.h
-pngrtran.o: png.h pngconf.h
-pngrutil.o: png.h pngconf.h
-pngtest.o: png.h pngconf.h
-pngtrans.o: png.h pngconf.h
-pngwrite.o: png.h pngconf.h
-pngwtran.o: png.h pngconf.h
-pngwutil.o: png.h pngconf.h
-pngpread.o: png.h pngconf.h
-
+++ /dev/null
-# Makefile for libpng
-# Watcom 10a and later 32-bit protected mode flat memory model
-
-# Adapted by Pawel Mrochen, based on makefile.msc
-# For conditions of distribution and use, see copyright notice in png.h
-# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
-
-# To use, do "wmake -f makefile.wat"
-
-# ------------- Watcom 10a and later -------------
-MODEL=-mf
-CFLAGS= $(MODEL) -fpi87 -fp5 -5r -oaeilmnrt -s -zp4 -i=..\zlib
-CC=wcc386
-LD=wcl386
-LIB=wlib -b -c
-LDFLAGS=
-O=.obj
-
-#uncomment next to put error messages in a file
-#ERRFILE= >> pngerrs
-
-# variables
-OBJS1 = png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
-OBJS2 = pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)
-OBJS3 = pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
-
-all: test
-
-png$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngset$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngget$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngread$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngpread$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngrtran$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngrutil$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngerror$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngmem$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngrio$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngwio$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngtest$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngtrans$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngwrite$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngwtran$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-pngwutil$(O): png.h pngconf.h
- $(CC) $(CFLAGS) $*.c $(ERRFILE)
-
-libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
- $(LIB) -n libpng.lib +$(OBJS1)
- $(LIB) libpng.lib +$(OBJS2)
- $(LIB) libpng.lib +$(OBJS3)
-
-pngtest.exe: pngtest.obj libpng.lib
- $(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib
-
-test: pngtest.exe
- pngtest
-
-# End of makefile for libpng
+++ /dev/null
-unit pngdef;
-
-// Caution: this file has fallen out of date since version 1.0.5. Write to
-// png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu about volunteering
-// to it up to date.
-
-interface
-
-const
- PNG_LIBPNG_VER_STRING = '1.2.4';
- PNG_LIBPNG_VER = 10204;
-
-type
- png_uint_32 = Cardinal;
- png_int_32 = Longint;
- png_uint_16 = Word;
- png_int_16 = Smallint;
- png_byte = Byte;
- png_size_t = png_uint_32;
- png_charpp = ^png_charp;
- png_charp = PChar;
- float = single;
- int = Integer;
- png_bytepp = ^png_bytep;
- png_bytep = ^png_byte;
- png_uint_16p = ^png_uint_16;
- png_uint_16pp = ^png_uint_16p;
- png_voidp = pointer;
- time_t = Longint;
- png_doublep = ^png_double;
- png_double = double;
-
- user_error_ptr = Pointer;
- png_error_ptrp = ^png_error_ptr;
- png_error_ptr = procedure(png_ptr: Pointer; msg: Pointer);
- stdcall;
- png_rw_ptrp = ^png_rw_ptr;
- png_rw_ptr = procedure(png_ptr: Pointer; data: Pointer;
- length: png_size_t);
- stdcall;
- png_flush_ptrp = ^png_flush_ptr;
- png_flush_ptr = procedure(png_ptr: Pointer);
- stdcall;
- png_progressive_info_ptrp = ^png_progressive_info_ptr;
- png_progressive_info_ptr = procedure(png_ptr: Pointer;
- info_ptr: Pointer);
- stdcall;
- png_progressive_end_ptrp = ^png_progressive_end_ptr;
- png_progressive_end_ptr = procedure(png_ptr: Pointer;
- info_ptr: Pointer);
- stdcall;
- png_progressive_row_ptrp = ^png_progressive_row_ptr;
- png_progressive_row_ptr = procedure(png_ptr: Pointer;
- data: Pointer; length: png_uint_32;
- count: int);
- stdcall;
- png_read_status_ptr = procedure(png_ptr: Pointer;
- row_number: png_uint_32; pass: int);
- stdcall;
- png_write_status_ptr = procedure(png_ptr: Pointer;
- row_number: png_uint_32; pass: int);
- stdcall;
- png_user_chunk_ptr = procedure(png_ptr: Pointer;
- data: png_unknown_chunkp);
- stdcall;
- png_user_transform_ptr = procedure(png_ptr: Pointer;
- row_info: Pointer; data: png_bytep);
- stdcall;
-
- png_colorpp = ^png_colorp;
- png_colorp = ^png_color;
- png_color = packed record
- red, green, blue: png_byte;
- end;
-
- png_color_16pp = ^png_color_16p;
- png_color_16p = ^png_color_16;
- png_color_16 = packed record
- index: png_byte; //used for palette files
- red, green, blue: png_uint_16; //for use in red green blue files
- gray: png_uint_16; //for use in grayscale files
- end;
-
- png_color_8pp = ^png_color_8p;
- png_color_8p = ^png_color_8;
- png_color_8 = packed record
- red, green, blue: png_byte; //for use in red green blue files
- gray: png_byte; //for use in grayscale files
- alpha: png_byte; //for alpha channel files
- end;
-
- png_textpp = ^png_textp;
- png_textp = ^png_text;
- png_text = packed record
- compression: int; //compression value
- key: png_charp; //keyword, 1-79 character description of "text"
- text: png_charp; //comment, may be empty ("")
- text_length: png_size_t; //length of text field
- end;
-
- png_timepp = ^png_timep;
- png_timep = ^png_time;
- png_time = packed record
- year: png_uint_16; //yyyy
- month: png_byte; //1..12
- day: png_byte; //1..31
- hour: png_byte; //0..23
- minute: png_byte; //0..59
- second: png_byte; //0..60 (leap seconds)
- end;
-
- png_infopp = ^png_infop;
- png_infop = Pointer;
-
- png_row_infopp = ^png_row_infop;
- png_row_infop = ^png_row_info;
- png_row_info = packed record
- width: png_uint_32; //width of row
- rowbytes: png_size_t; //number of bytes in row
- color_type: png_byte; //color type of row
- bit_depth: png_byte; //bit depth of row
- channels: png_byte; //number of channels (1, 2, 3, or 4)
- pixel_depth: png_byte; //bits per pixel (depth * channels)
- end;
-
- png_structpp = ^png_structp;
- png_structp = Pointer;
-
-const
-
-// Supported compression types for text in PNG files (tEXt, and zTXt).
-// The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
-
- PNG_TEXT_COMPRESSION_NONE_WR = -3;
- PNG_TEXT_COMPRESSION_zTXt_WR = -2;
- PNG_TEXT_COMPRESSION_NONE = -1;
- PNG_TEXT_COMPRESSION_zTXt = 0;
-
-// These describe the color_type field in png_info.
-// color type masks
-
- PNG_COLOR_MASK_PALETTE = 1;
- PNG_COLOR_MASK_COLOR = 2;
- PNG_COLOR_MASK_ALPHA = 4;
-
-// color types. Note that not all combinations are legal
-
- PNG_COLOR_TYPE_GRAY = 0;
- PNG_COLOR_TYPE_PALETTE = PNG_COLOR_MASK_COLOR or
- PNG_COLOR_MASK_PALETTE;
- PNG_COLOR_TYPE_RGB = PNG_COLOR_MASK_COLOR;
- PNG_COLOR_TYPE_RGB_ALPHA = PNG_COLOR_MASK_COLOR or
- PNG_COLOR_MASK_ALPHA;
- PNG_COLOR_TYPE_GRAY_ALPHA = PNG_COLOR_MASK_ALPHA;
-
-// This is for compression type. PNG 1.0 only defines the single type.
-
- PNG_COMPRESSION_TYPE_BASE = 0; // Deflate method 8, 32K window
- PNG_COMPRESSION_TYPE_DEFAULT = PNG_COMPRESSION_TYPE_BASE;
-
-// This is for filter type. PNG 1.0 only defines the single type.
-
- PNG_FILTER_TYPE_BASE = 0; // Single row per-byte filtering
- PNG_FILTER_TYPE_DEFAULT = PNG_FILTER_TYPE_BASE;
-
-// These are for the interlacing type. These values should NOT be changed.
-
- PNG_INTERLACE_NONE = 0; // Non-interlaced image
- PNG_INTERLACE_ADAM7 = 1; // Adam7 interlacing
-
-// These are for the oFFs chunk. These values should NOT be changed.
-
- PNG_OFFSET_PIXEL = 0; // Offset in pixels
- PNG_OFFSET_MICROMETER = 1; // Offset in micrometers (1/10^6 meter)
-
-// These are for the pCAL chunk. These values should NOT be changed.
-
- PNG_EQUATION_LINEAR = 0; // Linear transformation
- PNG_EQUATION_BASE_E = 1; // Exponential base e transform
- PNG_EQUATION_ARBITRARY = 2; // Arbitrary base exponential transform
- PNG_EQUATION_HYPERBOLIC = 3; // Hyperbolic sine transformation
-
-// These are for the pHYs chunk. These values should NOT be changed.
-
- PNG_RESOLUTION_UNKNOWN = 0; // pixels/unknown unit (aspect ratio)
- PNG_RESOLUTION_METER = 1; // pixels/meter
-
-// These are for the sRGB chunk. These values should NOT be changed.
- PNG_sRGB_INTENT_PERCEPTUAL = 0;
- PNG_sRGB_INTENT_RELATIVE = 1;
- PNG_sRGB_INTENT_SATURATION = 2;
- PNG_sRGB_INTENT_ABSOLUTE = 3;
-
-// Handle alpha and tRNS by replacing with a background color.
- PNG_BACKGROUND_GAMMA_UNKNOWN = 0;
- PNG_BACKGROUND_GAMMA_SCREEN = 1;
- PNG_BACKGROUND_GAMMA_FILE = 2;
- PNG_BACKGROUND_GAMMA_UNIQUE = 3;
-
-// Values for png_set_crc_action() to say how to handle CRC errors in
-// ancillary and critical chunks, and whether to use the data contained
-// therein. Note that it is impossible to "discard" data in a critical
-// chunk. For versions prior to 0.90, the action was always error/quit,
-// whereas in version 0.90 and later, the action for CRC errors in ancillary
-// chunks is warn/discard. These values should NOT be changed.
-
-// value action:critical action:ancillary
-
- PNG_CRC_DEFAULT = 0; // error/quit warn/discard data
- PNG_CRC_ERROR_QUIT = 1; // error/quit error/quit
- PNG_CRC_WARN_DISCARD = 2; // (INVALID) warn/discard data
- PNG_CRC_WARN_USE = 3; // warn/use data warn/use data
- PNG_CRC_QUIET_USE = 4; // quiet/use data quiet/use data
- PNG_CRC_NO_CHANGE = 5; // use current value use current value
-
-// Flags for png_set_filter() to say which filters to use. The flags
-// are chosen so that they don't conflict with real filter types
-// below, in case they are supplied instead of the #defined constants.
-// These values should NOT be changed.
-
- PNG_NO_FILTERS = $00;
- PNG_FILTER_NONE = $08;
- PNG_FILTER_SUB = $10;
- PNG_FILTER_UP = $20;
- PNG_FILTER_AVG = $40;
- PNG_FILTER_PAETH = $80;
- PNG_ALL_FILTERS = PNG_FILTER_NONE or PNG_FILTER_SUB or
- PNG_FILTER_UP or PNG_FILTER_AVG or
- PNG_FILTER_PAETH;
-
-// Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
-// These defines should NOT be changed.
-
- PNG_FILTER_VALUE_NONE = 0;
- PNG_FILTER_VALUE_SUB = 1;
- PNG_FILTER_VALUE_UP = 2;
- PNG_FILTER_VALUE_AVG = 3;
- PNG_FILTER_VALUE_PAETH = 4;
-
-// Heuristic used for row filter selection. These defines should NOT be
-// changed.
-
- PNG_FILTER_HEURISTIC_DEFAULT = 0; // Currently "UNWEIGHTED"
- PNG_FILTER_HEURISTIC_UNWEIGHTED = 1; // Used by libpng < 0.95
- PNG_FILTER_HEURISTIC_WEIGHTED = 2; // Experimental feature
- PNG_FILTER_HEURISTIC_LAST = 3; // Not a valid value
-
-procedure png_build_grayscale_palette(bit_depth: int; palette: png_colorp);
- stdcall;
-function png_check_sig(sig: png_bytep; num: int): int;
- stdcall;
-procedure png_chunk_error(png_ptr: png_structp;
- const mess: png_charp);
- stdcall;
-procedure png_chunk_warning(png_ptr: png_structp;
- const mess: png_charp);
- stdcall;
-procedure png_convert_from_time_t(ptime: png_timep; ttime: time_t);
- stdcall;
-function png_convert_to_rfc1123(png_ptr: png_structp; ptime: png_timep):
- png_charp;
- stdcall;
-function png_create_info_struct(png_ptr: png_structp): png_infop;
- stdcall;
-function png_create_read_struct(user_png_ver: png_charp;
- error_ptr: user_error_ptr; error_fn: png_error_ptr;
- warn_fn: png_error_ptr): png_structp;
- stdcall;
-function png_get_copyright(png_ptr: png_structp): png_charp;
- stdcall;
-function png_get_header_ver(png_ptr: png_structp): png_charp;
- stdcall;
-function png_get_header_version(png_ptr: png_structp): png_charp;
- stdcall;
-function png_get_libpng_ver(png_ptr: png_structp): png_charp;
- stdcall;
-function png_create_write_struct(user_png_ver: png_charp;
- error_ptr: user_error_ptr; error_fn: png_error_ptr;
- warn_fn: png_error_ptr): png_structp;
- stdcall;
-procedure png_destroy_info_struct(png_ptr: png_structp;
- info_ptr_ptr: png_infopp);
- stdcall;
-procedure png_destroy_read_struct(png_ptr_ptr: png_structpp;
- info_ptr_ptr, end_info_ptr_ptr: png_infopp);
- stdcall;
-procedure png_destroy_write_struct(png_ptr_ptr: png_structpp;
- info_ptr_ptr: png_infopp);
- stdcall;
-function png_get_IHDR(png_ptr: png_structp; info_ptr: png_infop;
- var width, height: png_uint_32; var bit_depth,
- color_type, interlace_type, compression_type,
- filter_type: int): png_uint_32;
- stdcall;
-function png_get_PLTE(png_ptr: png_structp; info_ptr: png_infop;
- var palette: png_colorp; var num_palette: int):
- png_uint_32;
- stdcall;
-function png_get_bKGD(png_ptr: png_structp; info_ptr: png_infop;
- var background: png_color_16p): png_uint_32;
- stdcall;
-function png_get_bit_depth(png_ptr: png_structp; info_ptr: png_infop):
- png_byte;
- stdcall;
-function png_get_cHRM(png_ptr: png_structp; info_ptr: png_infop;
- var white_x, white_y, red_x, red_y, green_x, green_y,
- blue_x, blue_y: double): png_uint_32;
- stdcall;
-function png_get_channels(png_ptr: png_structp; info_ptr: png_infop):
- png_byte;
- stdcall;
-function png_get_color_type(png_ptr: png_structp; info_ptr: png_infop):
- png_byte;
- stdcall;
-function png_get_compression_type(png_ptr: png_structp;
- info_ptr: png_infop): png_byte;
- stdcall;
-function png_get_error_ptr(png_ptr: png_structp): png_voidp;
- stdcall;
-function png_get_filter_type(png_ptr: png_structp; info_ptr: png_infop):
- png_byte;
- stdcall;
-function png_get_gAMA(png_ptr: png_structp; info_ptr: png_infop;
- var file_gamma: double): png_uint_32;
- stdcall;
-function png_get_hIST(png_ptr: png_structp; info_ptr: png_infop;
- var hist: png_uint_16p): png_uint_32;
- stdcall;
-function png_get_image_height(png_ptr: png_structp; info_ptr: png_infop):
- png_uint_32;
- stdcall;
-function png_get_image_width(png_ptr: png_structp; info_ptr: png_infop):
- png_uint_32;
- stdcall;
-function png_get_interlace_type(png_ptr: png_structp;
- info_ptr: png_infop): png_byte;
- stdcall;
-function png_get_io_ptr(png_ptr: png_structp): png_voidp;
- stdcall;
-function png_get_oFFs(png_ptr: png_structp; info_ptr: png_infop;
- var offset_x, offset_y: png_uint_32;
- var unit_type: int): png_uint_32;
- stdcall;
-function png_get_sCAL(png_ptr: png_structp; info_ptr: png_infop;
- var unit:int; var width: png_uint_32; height: png_uint_32):
- png_uint_32;
- stdcall
-function png_get_pCAL(png_ptr: png_structp; info_ptr: png_infop;
- var purpose: png_charp; var X0, X1: png_int_32;
- var typ, nparams: int; var units: png_charp;
- var params: png_charpp): png_uint_32;
- stdcall;
-function png_get_pHYs(png_ptr: png_structp; info_ptr: png_infop;
- var res_x, res_y: png_uint_32; var unit_type: int):
- png_uint_32;
- stdcall;
-function png_get_pixel_aspect_ratio(png_ptr: png_structp;
- info_ptr: png_infop): float;
- stdcall;
-function png_get_pixels_per_meter(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-function png_get_progressive_ptr(png_ptr: png_structp): png_voidp;
- stdcall;
-function png_get_rgb_to_gray_status(png_ptr: png_structp);
- stdcall;
-function png_get_rowbytes(png_ptr: png_structp; info_ptr: png_infop):
- png_uint_32;
- stdcall;
-function png_get_rows(png_ptr: png_structp; info_ptr: png_infop):
- png_bytepp;
- stdcall;
-function png_get_sBIT(png_ptr: png_structp; info_ptr: png_infop;
- var sig_bits: png_color_8p): png_uint_32;
- stdcall;
-function png_get_sRGB(png_ptr: png_structp; info_ptr: png_infop;
- var file_srgb_intent: int): png_uint_32;
- stdcall;
-function png_get_signature(png_ptr: png_structp; info_ptr: png_infop):
- png_bytep;
- stdcall;
-function png_get_tIME(png_ptr: png_structp; info_ptr: png_infop;
- var mod_time: png_timep): png_uint_32;
- stdcall;
-function png_get_tRNS(png_ptr: png_structp; info_ptr: png_infop;
- var trans: png_bytep; var num_trans: int;
- var trans_values: png_color_16p): png_uint_32;
- stdcall;
-function png_get_text(png_ptr: png_structp; info_ptr: png_infop;
- var text_ptr: png_textp; var num_text: int):
- png_uint_32;
- stdcall;
-function png_get_user_chunk_ptr(png_ptr: png_structp):
- png_voidp;
- stdcall;
-function png_get_valid(png_ptr: png_structp; info_ptr: png_infop;
- flag: png_uint_32): png_uint_32;
- stdcall;
-function png_get_x_offset_microns(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-function png_get_x_offset_pixels(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-function png_get_x_pixels_per_meter(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-function png_get_y_offset_microns(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-function png_get_y_offset_pixels(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-function png_get_y_pixels_per_meter(png_ptr: png_structp;
- info_ptr: png_infop): png_uint_32;
- stdcall;
-procedure png_process_data(png_ptr: png_structp; info_ptr: png_infop;
- buffer: png_bytep; buffer_size: png_size_t);
- stdcall;
-procedure png_progressive_combine_row(png_ptr: png_structp;
- old_row, new_row: png_bytep);
- stdcall;
-procedure png_read_end(png_ptr: png_structp; info_ptr: png_infop);
- stdcall;
-procedure png_read_image(png_ptr: png_structp; image: png_bytepp);
- stdcall;
-procedure png_read_info(png_ptr: png_structp; info_ptr: png_infop);
- stdcall;
-procedure png_read_row(png_ptr: png_structp; row, dsp_row: png_bytep);
- stdcall;
-procedure png_read_rows(png_ptr: png_structp; row, display_row:
- png_bytepp; num_rows: png_uint_32);
- stdcall;
-procedure png_read_update_info(png_ptr: png_structp; info_ptr: png_infop);
- stdcall;
-procedure png_set_IHDR(png_ptr: png_structp; info_ptr: png_infop;
- width, height: png_uint_32; bit_depth, color_type,
- interlace_type, compression_type, filter_type: int);
- stdcall;
-procedure png_set_PLTE(png_ptr: png_structp; info_ptr: png_infop;
- palette: png_colorp; num_palette: int);
- stdcall;
-procedure png_set_bKGD(png_ptr: png_structp; info_ptr: png_infop;
- background: png_color_16p);
- stdcall;
-procedure png_set_background(png_ptr: png_structp;
- background_color: png_color_16p;
- background_gamma_code, need_expand: int;
- background_gamma: double);
- stdcall;
-procedure png_set_bgr(png_ptr: png_structp);
- stdcall;
-procedure png_set_cHRM(png_ptr: png_structp; info_ptr: png_infop;
- white_x, white_y, red_x, red_y, green_x, green_y,
- blue_x, blue_y: double);
- stdcall;
-procedure png_set_cHRM_fixed(png_ptr: png_structp; info_ptr: png_infop;
- white_x, white_y, red_x, red_y, green_x, green_y,
- blue_x, blue_y: png_fixed_point);
- stdcall;
-procedure png_set_compression_level(png_ptr: png_structp; level: int);
- stdcall;
-procedure png_set_compression_mem_level(png_ptr: png_structp;
- mem_level: int);
- stdcall;
-procedure png_set_compression_method(png_ptr: png_structp; method: int);
- stdcall;
-procedure png_set_compression_strategy(png_ptr: png_structp;
- strategy: int);
- stdcall;
-procedure png_set_compression_window_bits(png_ptr: png_structp;
- window_bits: int);
- stdcall;
-procedure png_set_crc_action(png_ptr: png_structp;
- crit_action, ancil_action: int);
- stdcall;
-procedure png_set_dither(png_ptr: png_structp; plaette: png_colorp;
- num_palette, maximum_colors: int;
- histogram: png_uint_16p; full_dither: int);
- stdcall;
-procedure png_set_error_fn(png_ptr: png_structp; error_ptr: png_voidp;
- error_fn, warning_fn: png_error_ptr);
- stdcall;
-procedure png_set_expand(png_ptr: png_structp);
- stdcall;
-procedure png_set_filler(png_ptr: png_structp; filler: png_uint_32;
- filler_loc: int);
- stdcall;
-procedure png_set_filter(png_ptr: png_structp; method, filters: int);
- stdcall;
-procedure png_set_filter_heuristics(png_ptr: png_structp;
- heuristic_method, num_weights: int;
- filter_weights, filter_costs: png_doublep);
- stdcall;
-procedure png_set_flush(png_ptr: png_structp; nrows: int);
- stdcall;
-procedure png_set_gAMA(png_ptr: png_structp; info_ptr: png_infop;
- file_gamma: double);
- stdcall;
-procedure png_set_gAMA_fixed(png_ptr: png_structp; info_ptr: png_infop;
- file_gamma: png_fixed_point);
- stdcall;
-procedure png_set_gamma(png_ptr: png_structp; screen_gamma,
- default_file_gamma: double);
- stdcall;
-procedure png_set_gray_1_2_4_to_8(png_ptr: png_structp);
- stdcall;
-procedure png_set_gray_to_rgb(png_ptr: png_structp);
- stdcall;
-procedure png_set_hIST(png_ptr: png_structp; info_ptr: png_infop;
- hist: png_uint_16p);
- stdcall;
-function png_set_interlace_handling(png_ptr: png_structp): int;
- stdcall;
-procedure png_set_invalid(png_ptr: png_structp; info_ptr:png_infop;
- mask: int);
- stdcall;
-procedure png_set_invert_alpha(png_ptr: png_structp);
- stdcall;
-procedure png_set_invert_mono(png_ptr: png_structp);
- stdcall;
-procedure png_set_oFFs(png_ptr: png_structp; info_ptr: png_infop;
- offset_x, offset_y: png_uint_32; unit_type: int);
- stdcall;
-procedure png_set_palette_to_rgb(png_ptr: png_structp);
- stdcall;
-procedure png_set_pCAL(png_ptr: png_structp; info_ptr: png_infop;
- purpose: png_charp; X0, X1: png_int_32;
- typ, nparams: int; units: png_charp;
- params: png_charpp);
- stdcall;
-procedure png_set_pHYs(png_ptr: png_structp; info_ptr: png_infop;
- res_x, res_y: png_uint_32; unit_type: int);
- stdcall;
-procedure png_set_packing(png_ptr: png_structp);
- stdcall;
-procedure png_set_packswap(png_ptr: png_structp);
- stdcall;
-procedure png_set_progressive_read_fn(png_ptr: png_structp;
- progressive_ptr: png_voidp;
- info_fn: png_progressive_info_ptr;
- row_fn: png_progressive_row_ptr;
- end_fn: png_progressive_end_ptr);
- stdcall;
-procedure png_set_read_fn(png_ptr: png_structp;
- io_ptr: png_voidp; read_data_fn: png_rw_ptr);
- stdcall;
-procedure png_set_read_status_fn(png_ptr: png_structp;
- read_row_fn: png_read_status_ptr);
- stdcall;
-procedure png_set_read_user_chunk_fn(png_ptr: png_structp;
- read_user_chunk_fn: png_user_chunk_ptr);
- stdcall;
-procedure png_set_read_user_transform_fn(png_ptr: png_structp;
- read_user_transform_fn: png_user_transform_ptr);
- stdcall;
-procedure png_set_rgb_to_gray(png_ptr: png_structp; int: error_action;
- red_weight, green_weight: double);
- stdcall;
-procedure png_set_rgb_to_gray_fixed(png_ptr: png_structp; int: error_action;
- red_weight, green_weight: png_fixed_point);
- stdcall;
-procedure png_set_rows(png_ptr: png_structp; info_ptr: png_infop;
- row_pointers: png_bytepp);
- stdcall;
-procedure png_set_sBIT(png_ptr: png_structp; info_ptr: png_infop;
- sig_bits: png_color_8p);
- stdcall;
-procedure png_set_sRGB(png_ptr: png_structp; info_ptr: png_infop;
- intent: int);
- stdcall;
-procedure png_set_sRGB_gAMA_and_cHRM(png_ptr: png_structp;
- info_ptr: png_infop; intent: int);
- stdcall;
-procedure png_set_shift(png_ptr: png_structp; true_bits: png_color_8p);
- stdcall;
-procedure png_set_sig_bytes(png_ptr: png_structp; num_bytes: int);
- stdcall;
-procedure png_set_strip_16(png_ptr: png_structp);
- stdcall;
-procedure png_set_strip_alpha(png_ptr: png_structp);
- stdcall;
-procedure png_set_swap(png_ptr: png_structp);
- stdcall;
-procedure png_set_swap_alpha(png_ptr: png_structp);
- stdcall;
-procedure png_set_tIME(png_ptr: png_structp; info_ptr: png_infop;
- mod_time: png_timep);
- stdcall;
-procedure png_set_tRNS(png_ptr: png_structp; info_ptr: png_infop;
- trans: png_bytep; num_trans: int;
- trans_values: png_color_16p);
- stdcall;
-procedure png_set_tRNS_to_alpha(png_ptr: png_structp);
- stdcall;
-procedure png_set_text(png_ptr: png_structp; info_ptr: png_infop;
- text_ptr: png_textp; num_text: int);
- stdcall;
-procedure png_set_write_fn(png_ptr: png_structp;
- io_ptr: png_voidp; write_data_fn: png_rw_ptr;
- output_flush_fn: png_flush_ptr);
- stdcall;
-procedure png_set_write_status_fn(png_ptr: png_structp;
- write_row_fn: png_write_status_ptr);
- stdcall;
-procedure png_set_write_user_transform_fn(png_ptr: png_structp;
- write_user_transform_fn: png_user_transform_ptr);
- stdcall;
-function png_sig_cmp(sig: png_bytep; start, num_to_check: png_size_t):
- int;
- stdcall;
-procedure png_start_read_image(png_ptr: png_structp);
- stdcall;
-procedure png_write_chunk(png_ptr: png_structp;
- chunk_name, data: png_bytep; length: png_size_t);
- stdcall;
-procedure png_write_chunk_data(png_ptr: png_structp;
- data: png_bytep; length: png_size_t);
- stdcall;
-procedure png_write_chunk_end(png_ptr: png_structp);
- stdcall;
-procedure png_write_chunk_start(png_ptr: png_structp;
- chunk_name: png_bytep; length: png_uint_32);
- stdcall;
-procedure png_write_end(png_ptr: png_structp; info_ptr: png_infop);
- stdcall;
-procedure png_write_flush(png_ptr: png_structp);
- stdcall;
-procedure png_write_image(png_ptr: png_structp; image: png_bytepp);
- stdcall;
-procedure png_write_info(png_ptr: png_structp; info_ptr: png_infop);
- stdcall;
-procedure png_write_info_before_PLTE(png_ptr: png_structp; info_ptr: png_infop);
- stdcall;
-procedure png_write_row(png_ptr: png_structp; row: png_bytep);
- stdcall;
-procedure png_write_rows(png_ptr: png_structp; row: png_bytepp;
- num_rows: png_uint_32);
- stdcall;
-procedure png_get_iCCP(png_ptr: png_structp; info_ptr: png_infop;
- name: png_charpp; compression_type: int *; profile: png_charpp;
- proflen: png_int_32): png_bytep;
- stdcall;
-procedure png_get_sPLT(png_ptr: png_structp;
- info_ptr: png_infop; entries: png_spalette_pp): png_uint_32;
- stdcall;
-procedure png_set_iCCP(png_ptr: png_structp; info_ptr: png_infop;
- name: png_charp; compression_type: int; profile: png_charp;
- proflen: int);
- stdcall;
-procedure png_free_data(png_ptr: png_structp; info_ptr: png_infop; num: int);
- stdcall;
-procedure png_set_sPLT(png_ptr: png_structp; info_ptr: png_infop;
- entries: png_spalette_p; nentries: int);
- stdcall;
-
-implementation
-
-const
- pngDLL = 'png32bd.dll';
-
-procedure png_build_grayscale_palette; external pngDLL;
-function png_check_sig; external pngDLL;
-procedure png_chunk_error; external pngDLL;
-procedure png_chunk_warning; external pngDLL;
-procedure png_convert_from_time_t; external pngDLL;
-function png_convert_to_rfc1123; external pngDLL;
-function png_create_info_struct; external pngDLL;
-function png_create_read_struct; external pngDLL;
-function png_create_write_struct; external pngDLL;
-procedure png_destroy_info_struct; external pngDLL;
-procedure png_destroy_read_struct; external pngDLL;
-procedure png_destroy_write_struct; external pngDLL;
-function png_get_IHDR; external pngDLL;
-function png_get_PLTE; external pngDLL;
-function png_get_bKGD; external pngDLL;
-function png_get_bit_depth; external pngDLL;
-function png_get_cHRM; external pngDLL;
-function png_get_channels; external pngDLL;
-function png_get_color_type; external pngDLL;
-function png_get_compression_type; external pngDLL;
-function png_get_error_ptr; external pngDLL;
-function png_get_filter_type; external pngDLL;
-function png_get_gAMA; external pngDLL;
-function png_get_hIST; external pngDLL;
-function png_get_image_height; external pngDLL;
-function png_get_image_width; external pngDLL;
-function png_get_interlace_type; external pngDLL;
-function png_get_io_ptr; external pngDLL;
-function png_get_oFFs; external pngDLL;
-function png_get_pCAL; external pngDLL;
-function png_get_pHYs; external pngDLL;
-function png_get_pixel_aspect_ratio; external pngDLL;
-function png_get_pixels_per_meter; external pngDLL;
-function png_get_progressive_ptr; external pngDLL;
-function png_get_rowbytes; external pngDLL;
-function png_get_rows; external pngDLL;
-function png_get_sBIT; external pngDLL;
-function png_get_sRGB; external pngDLL;
-function png_get_signature; external pngDLL;
-function png_get_tIME; external pngDLL;
-function png_get_tRNS; external pngDLL;
-function png_get_text; external pngDLL;
-function png_get_user_chunk_ptr; external pngDLL;
-function png_get_valid; external pngDLL;
-function png_get_x_offset_microns; external pngDLL;
-function png_get_x_offset_pixels; external pngDLL;
-function png_get_x_pixels_per_meter; external pngDLL;
-function png_get_y_offset_microns; external pngDLL;
-function png_get_y_offset_pixels; external pngDLL;
-function png_get_y_pixels_per_meter; external pngDLL;
-procedure png_process_data; external pngDLL;
-procedure png_progressive_combine_row; external pngDLL;
-procedure png_read_end; external pngDLL;
-procedure png_read_image; external pngDLL;
-procedure png_read_info; external pngDLL;
-procedure png_read_row; external pngDLL;
-procedure png_read_rows; external pngDLL;
-procedure png_read_update_info; external pngDLL;
-procedure png_set_IHDR; external pngDLL;
-procedure png_set_PLTE; external pngDLL;
-procedure png_set_bKGD; external pngDLL;
-procedure png_set_background; external pngDLL;
-procedure png_set_bgr; external pngDLL;
-procedure png_set_cHRM; external pngDLL;
-procedure png_set_cHRM_fixed; external pngDLL;
-procedure png_set_compression_level; external pngDLL;
-procedure png_set_compression_mem_level; external pngDLL;
-procedure png_set_compression_method; external pngDLL;
-procedure png_set_compression_strategy; external pngDLL;
-procedure png_set_compression_window_bits; external pngDLL;
-procedure png_set_crc_action; external pngDLL;
-procedure png_set_dither; external pngDLL;
-procedure png_set_error_fn; external pngDLL;
-procedure png_set_expand; external pngDLL;
-procedure png_set_filler; external pngDLL;
-procedure png_set_filter; external pngDLL;
-procedure png_set_filter_heuristics; external pngDLL;
-procedure png_set_flush; external pngDLL;
-procedure png_set_gAMA; external pngDLL;
-procedure png_set_gAMA_fixed; external pngDLL;
-procedure png_set_gamma; external pngDLL;
-procedure png_set_gray_to_rgb; external pngDLL;
-procedure png_set_hIST; external pngDLL;
-function png_set_interlace_handling; external pngDLL;
-procedure png_set_invert_alpha; external pngDLL;
-procedure png_set_invert_mono; external pngDLL;
-procedure png_set_oFFs; external pngDLL;
-procedure png_set_pCAL; external pngDLL;
-procedure png_set_pHYs; external pngDLL;
-procedure png_set_packing; external pngDLL;
-procedure png_set_packswap; external pngDLL;
-procedure png_set_progressive_read_fn; external pngDLL;
-procedure png_set_read_fn; external pngDLL;
-procedure png_set_read_status_fn; external pngDLL;
-procedure png_set_read_user_transform_fn; external pngDLL;
-procedure png_set_rgb_to_gray; external pngDLL;
-procedure png_set_rgb_to_gray_fixed; external pngDLL;
-procedure png_set_rows; external pngDLL;
-procedure png_set_sBIT; external pngDLL;
-procedure png_set_sRGB; external pngDLL;
-procedure png_set_sRGB_gAMA_and_cHRM; external pngDLL;
-procedure png_set_shift; external pngDLL;
-procedure png_set_sig_bytes; external pngDLL;
-procedure png_set_strip_16; external pngDLL;
-procedure png_set_strip_alpha; external pngDLL;
-procedure png_set_swap; external pngDLL;
-procedure png_set_swap_alpha; external pngDLL;
-procedure png_set_tIME; external pngDLL;
-procedure png_set_tRNS; external pngDLL;
-procedure png_set_text; external pngDLL;
-procedure png_set_user_chunk_fn; external pngDLL;
-procedure png_set_write_fn; external pngDLL;
-procedure png_set_write_status_fn; external pngDLL;
-procedure png_set_write_user_transform_fn; external pngDLL;
-function png_sig_cmp; external pngDLL;
-procedure png_start_read_image; external pngDLL;
-procedure png_write_chunk; external pngDLL;
-procedure png_write_chunk_data; external pngDLL;
-procedure png_write_chunk_end; external pngDLL;
-procedure png_write_chunk_start; external pngDLL;
-procedure png_write_end; external pngDLL;
-procedure png_write_flush; external pngDLL;
-procedure png_write_image; external pngDLL;
-procedure png_write_info; external pngDLL;
-procedure png_write_info_before_PLTE; external pngDLL;
-procedure png_write_row; external pngDLL;
-procedure png_write_rows; external pngDLL;
-procedure png_get_iCCP; external pngDLL;
-procedure png_get_sPLT; external pngDLL;
-procedure png_set_iCCP; external pngDLL;
-procedure png_set_sPLT; external pngDLL;
-procedure png_free_data; external pngDLL;
-
-end.