提交 e5ee05dc 编写于 作者: G Glenn Randers-Pehrson

Imported from libpng-1.2.37beta03.tar

上级 c0d53e17
Libpng 1.2.37rc01 - May 19, 2009
Libpng 1.2.37beta03 - May 20, 2009
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.
......@@ -9,37 +9,37 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
libpng-1.2.37rc01.tar.gz
libpng-1.2.37rc01.tar.lzma
libpng-1.2.37beta03.tar.gz
libpng-1.2.37beta03.tar.lzma
(Get the lzma codec from <http://tukaani.org/lzma>).
libpng-1.2.37rc01.tar.bz2
libpng-1.2.37beta03.tar.bz2
Source files with LF line endings (for Unix/Linux) without the
"configure" script
libpng-1.2.37rc01-no-config.tar.gz
libpng-1.2.37rc01-no-config.tar.lzma
libpng-1.2.37rc01-no-config.tar.bz2
libpng-1.2.37beta03-no-config.tar.gz
libpng-1.2.37beta03-no-config.tar.lzma
libpng-1.2.37beta03-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp1237r01.zip
lp1237r01.7z
lp1237r01.tar.bz2
lp1237b03.zip
lp1237b03.7z
lp1237b03.tar.bz2
Project files
libpng-1.2.37rc01-project-netware.zip
libpng-1.2.37rc01-project-wince.zip
libpng-1.2.37beta03-project-netware.zip
libpng-1.2.37beta03-project-wince.zip
Other information:
libpng-1.2.37rc01-README.txt
libpng-1.2.37rc01-KNOWNBUGS.txt
libpng-1.2.37rc01-LICENSE.txt
libpng-1.2.37rc01-Y2K-compliance.txt
libpng-1.2.37rc01-[previous version]-diff.txt
libpng-1.2.37beta03-README.txt
libpng-1.2.37beta03-KNOWNBUGS.txt
libpng-1.2.37beta03-LICENSE.txt
libpng-1.2.37beta03-Y2K-compliance.txt
libpng-1.2.37beta03-[previous version]-diff.txt
Changes since the last public release (1.2.36):
......@@ -59,7 +59,11 @@ version 1.2.37beta02 [May 19, 2009]
Added contrib/pngminim/preader to demonstrate building minimal progressive
decoder, based on contrib/gregbook with embedded libpng and zlib.
version 1.2.37rc01 [May 19, 2009]
version 1.2.37beta03 [May 20, 2009]
In contrib/pngminim/*, renamed "makefile.std" to "makefile", since there
is only one makefile in those directories, and revised the README files
accordingly.
Reformated sources in libpng style (3-space indentation, comment format)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
......
......@@ -2384,7 +2384,12 @@ version 1.2.37beta02 [May 19, 2009]
Added contrib/pngminim/preader to demonstrate building minimal progressive
decoder, based on contrib/gregbook with embedded libpng and zlib.
version 1.2.37rc01 [May 19, 2009]
version 1.2.37beta03 [May 20, 2009]
In contrib/pngminim/*, renamed "makefile.std" to "makefile", since there
is only one makefile in those directories, and revised the README files
accordingly.
Reformated sources in libpng style (3-space indentation, comment format)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
Installing libpng version 1.2.37rc01 - May 19, 2009
Installing libpng version 1.2.37beta03 - May 20, 2009
On Unix/Linux and similar systems, you can simply type
......@@ -44,7 +44,7 @@ to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-1.2.37rc01" or "lpng109" and "zlib-1.2.1"
might be called "libpng-1.2.37beta03" or "lpng109" and "zlib-1.2.1"
or "zlib121") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
......@@ -101,9 +101,9 @@ include
CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.37rc01)
gcc, creates libpng12.so.0.1.2.37beta03)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.37rc01)
(gcc, creates libpng12.so.0.1.2.37beta03)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
......@@ -125,14 +125,14 @@ include
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.37rc01)
creates libpng12.so.0.1.2.37beta03)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng12.so.0.1.2.37rc01)
creates libpng12.so.0.1.2.37beta03)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
creates libpng12.so.0.1.2.37rc01)
creates libpng12.so.0.1.2.37beta03)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng12.so.0.1.2.37rc01)
creates libpng12.so.0.1.2.37beta03)
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
......
Known bugs in libpng version 1.2.37rc01
Known bugs in libpng version 1.2.37beta03
1. February 23, 2006: The custom makefiles don't build libpng with -lz.
......
......@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.2.37rc01, May 19, 2009, are
libpng versions 1.2.6, August 15, 2004, through 1.2.37beta03, May 20, 2009, are
Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
......@@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
May 19, 2009
May 20, 2009
......@@ -86,7 +86,7 @@ EXTRA_DIST= \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
example.c libpng-1.2.37rc01.txt pngvcrd.c
example.c libpng-1.2.37beta03.txt pngvcrd.c
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \
libpng.sym
......
......@@ -333,7 +333,7 @@ EXTRA_DIST = \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
example.c libpng-1.2.37rc01.txt pngvcrd.c
example.c libpng-1.2.37beta03.txt pngvcrd.c
CLEANFILES = pngout.png libpng12.pc libpng12-config libpng.vers \
libpng.sym
......
README for libpng version 1.2.37rc01 - May 19, 2009 (shared library 12.0)
README for libpng version 1.2.37beta03 - May 20, 2009 (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.
......@@ -194,11 +194,11 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.37rc01)
gcc, creates libpng12.so.0.1.2.37beta03)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.37rc01)
(gcc, creates libpng12.so.0.1.2.37beta03)
makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.37rc01,
(gcc, creates libpng12.so.0.1.2.37beta03,
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
......@@ -220,12 +220,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.37rc01)
(gcc, creates libpng12.so.0.1.2.37beta03)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.37rc01)
(gcc, creates libpng12.so.0.1.2.37beta03)
makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.37rc01)
(gcc, creates libpng12.so.0.1.2.37beta03)
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
......
Y2K compliance in libpng:
=========================
May 19, 2009
May 20, 2009
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.37rc01 are Y2K compliant. It is my belief that earlier
upward through 1.2.37beta03 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
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for libpng 1.2.37rc01.
# Generated by GNU Autoconf 2.62 for libpng 1.2.37beta03.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
......@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.2.37rc01'
PACKAGE_STRING='libpng 1.2.37rc01'
PACKAGE_VERSION='1.2.37beta03'
PACKAGE_STRING='libpng 1.2.37beta03'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
ac_unique_file="pngget.c"
......@@ -1484,7 +1484,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.2.37rc01 to adapt to many kinds of systems.
\`configure' configures libpng 1.2.37beta03 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1554,7 +1554,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.2.37rc01:";;
short | recursive ) echo "Configuration of libpng 1.2.37beta03:";;
esac
cat <<\_ACEOF
......@@ -1661,7 +1661,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.2.37rc01
libpng configure 1.2.37beta03
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
......@@ -1675,7 +1675,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.2.37rc01, which was
It was created by libpng $as_me 1.2.37beta03, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
......@@ -2389,7 +2389,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.2.37rc01'
VERSION='1.2.37beta03'
cat >>confdefs.h <<_ACEOF
......@@ -2558,7 +2558,7 @@ fi
PNGLIB_VERSION=1.2.37rc01
PNGLIB_VERSION=1.2.37beta03
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=37
......@@ -13125,7 +13125,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.2.37rc01, which was
This file was extended by libpng $as_me 1.2.37beta03, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -13178,7 +13178,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
libpng config.status 1.2.37rc01
libpng config.status 1.2.37beta03
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
......
......@@ -18,12 +18,12 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.2.37rc01], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.2.37beta03], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.2.37rc01
PNGLIB_VERSION=1.2.37beta03
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=37
......
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only decoder, run
To build a minimal read-only decoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib
make
If you prefer to use the shared libraries, go to contrib/pngminus
and build the png2pnm application there.
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal write-only encoder, run
To build a minimal write-only decoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib
make
If you prefer to use the shared libraries, go to contrib/pngminus
and build the pnm2png application there.
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal read-only progressive decoder with X display, run
To build a minimal read-only progressive decoder embedded libpng and
zlib and with your system's X library, run
gather.sh # to collect needed files from gregbook, libpng, and zlib
......@@ -9,3 +10,5 @@ then
make
If you prefer to use the shared libraries, go to contrib/gregbook
and build the rpng2-x application there.
......@@ -2,7 +2,7 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.2.37 [May 19, 2009]
* Last changed in libpng 1.2.37 [May 20, 2009]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2009 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
......@@ -93,13 +93,13 @@ void read_png(char *file_name) /* We need to open the file */
return (ERROR);
#else no_open_file /* prototype 2 */
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
{
png_structp png_ptr;
png_infop info_ptr;
png_uint_32 width, height;
int bit_depth, color_type, interlace_type;
#endif no_open_file /* only use one prototype! */
#endif no_open_file /* Only use one prototype! */
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
......@@ -177,11 +177,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL);
/* Set up the data transformations you want. Note that these are all
* optional. Only call them if you want/need them. Many of the
* transformations only work on specific types of images, and many
* are mutually exclusive.
*/
/* Set up the data transformations you want. Note that these are all
* optional. Only call them if you want/need them. Many of the
* transformations only work on specific types of images, and many
* are mutually exclusive.
*/
/* Tell libpng to strip 16 bit/color files down to 8 bits/color */
png_set_strip_16(png_ptr);
......@@ -230,9 +230,9 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
/* Some suggestions as to how to get a screen gamma value */
/* Note that screen gamma is the display_exponent, which includes
/* Some suggestions as to how to get a screen gamma value
*
* Note that screen gamma is the display_exponent, which includes
* the CRT_exponent and any correction for viewing conditions
*/
if (/* We have a user-defined screen gamma value */)
......@@ -280,7 +280,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_colorp palette;
/* This reduces the image to the application supplied palette */
if (/* we have our own palette */)
if (/* We have our own palette */)
{
/* An array of colors to which the image should be dithered */
png_color std_color_cube[MAX_SCREEN_COLORS];
......@@ -377,13 +377,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
#else no_sparkle /* Read the image using the "rectangle" effect */
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
number_of_rows);
#endif no_sparkle /* use only one of these two methods */
#endif no_sparkle /* Use only one of these two methods */
}
/* if you want to display the image after every pass, do so here */
#endif no_single /* use only one of these two methods */
/* If you want to display the image after every pass, do so here */
#endif no_single /* Use only one of these two methods */
}
#endif no_entire /* use only one of these two methods */
#endif no_entire /* Use only one of these two methods */
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
......@@ -397,7 +397,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* Close the file */
fclose(fp);
/* that's it */
/* That's it */
return (OK);
}
......@@ -480,34 +480,35 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
info_callback(png_structp png_ptr, png_infop info)
{
/* Do any setup here, including setting any of the transformations
* mentioned in the Reading PNG files section. For now, you _must_
* call either png_start_read_image() or png_read_update_info()
* after all the transformations are set (even if you don't set
* any). You may start getting rows before png_process_data()
* returns, so this is your last chance to prepare for that.
*/
/* Do any setup here, including setting any of the transformations
* mentioned in the Reading PNG files section. For now, you _must_
* call either png_start_read_image() or png_read_update_info()
* after all the transformations are set (even if you don't set
* any). You may start getting rows before png_process_data()
* returns, so this is your last chance to prepare for that.
*/
}
row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass)
{
/*
* This function is called for every row in the image. If the
* image is interlaced, and you turned on the interlace handler,
* this function will be called for every row in every pass.
*
* In this function you will receive a pointer to new row data from
* libpng called new_row that is to replace a corresponding row (of
* the same data format) in a buffer allocated by your application.
*
* The new row data pointer "new_row" may be NULL, indicating there is
* no new data to be replaced (in cases of interlace loading).
*
* If new_row is not NULL then you need to call
* png_progressive_combine_row() to replace the corresponding row as
* shown below:
*/
/*
* This function is called for every row in the image. If the
* image is interlaced, and you turned on the interlace handler,
* this function will be called for every row in every pass.
*
* In this function you will receive a pointer to new row data from
* libpng called new_row that is to replace a corresponding row (of
* the same data format) in a buffer allocated by your application.
*
* The new row data pointer "new_row" may be NULL, indicating there is
* no new data to be replaced (in cases of interlace loading).
*
* If new_row is not NULL then you need to call
* png_progressive_combine_row() to replace the corresponding row as
* shown below:
*/
/* Check if row_num is in bounds. */
if ((row_num >= 0) && (row_num < height))
{
......@@ -522,41 +523,41 @@ row_callback(png_structp png_ptr, png_bytep new_row,
if ((old_row != NULL) && (new_row != NULL))
png_progressive_combine_row(png_ptr, old_row, new_row);
}
/*
* The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it
* may make your life easier.
*
* For the non-NULL rows of interlaced images, you must call
* png_progressive_combine_row() passing in the new row and the
* old row, as demonstrated above. You can call this function for
* NULL rows (it will just return) and for non-interlaced images
* (it just does the png_memcpy for you) if it will make the code
* easier. Thus, you can just do this for all cases:
*/
/*
* The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it
* may make your life easier.
*
* For the non-NULL rows of interlaced images, you must call
* png_progressive_combine_row() passing in the new row and the
* old row, as demonstrated above. You can call this function for
* NULL rows (it will just return) and for non-interlaced images
* (it just does the png_memcpy for you) if it will make the code
* easier. Thus, you can just do this for all cases:
*/
png_progressive_combine_row(png_ptr, old_row, new_row);
/* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have
* to pass the current row as new_row, and the function will combine
* the old row and the new row.
*/
/* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have
* to pass the current row as new_row, and the function will combine
* the old row and the new row.
*/
}
end_callback(png_structp png_ptr, png_infop info)
{
/* This function is called when the whole image has been read,
* including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added
* to the comments and time fields.
*
* Most people won't do much here, perhaps setting a flag that
* marks the image as finished.
*/
/* This function is called when the whole image has been read,
* including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added
* to the comments and time fields.
*
* Most people won't do much here, perhaps setting a flag that
* marks the image as finished.
*/
}
/* Write a png file */
......@@ -608,6 +609,7 @@ void write_png(char *file_name /* , ... other image information ... */)
}
/* One of the following I/O initialization functions is REQUIRED */
#ifdef streams /* I/O initialization method 1 */
/* Set up the output control if you are using standard C streams */
png_init_io(png_ptr, fp);
......@@ -619,7 +621,7 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
user_IO_flush_function);
/* where user_io_ptr is a structure you want available to the callbacks */
#endif no_streams /* only use one initialization method */
#endif no_streams /* Only use one initialization method */
#ifdef hilevel
/* This is the easy way. Use it if you already have all the
......@@ -771,7 +773,7 @@ void write_png(char *file_name /* , ... other image information ... */)
#ifdef entire /* Write out the entire image data in one call */
png_write_image(png_ptr, row_pointers);
/* the other way to write the image - deal with interlacing */
/* The other way to write the image - deal with interlacing */
#else no_entire /* Write out the image data by one or more scanlines */
......
libpng.txt - A description on how to use and modify libpng
libpng version 1.2.37rc01 - May 19, 2009
libpng version 1.2.37beta03 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
......@@ -9,7 +9,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.2.37rc01 - May 19, 2009
libpng versions 0.97, January 1998, through 1.2.37beta03 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
......@@ -2947,13 +2947,13 @@ when the Intel assembler code was removed due to a licensing issue.
IX. (Omitted)
X. Y2K Compliance in libpng
May 19, 2009
May 20, 2009
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.37rc01 are Y2K compliant. It is my belief that earlier
upward through 1.2.37beta03 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 LIBPNG 3 "May 19, 2009"
.TH LIBPNG 3 "May 20, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.37rc01
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.37beta03
.SH SYNOPSIS
\fI\fB
......@@ -821,7 +821,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.2.37rc01 - May 19, 2009
libpng version 1.2.37beta03 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
......@@ -830,7 +830,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.2.37rc01 - May 19, 2009
libpng versions 0.97, January 1998, through 1.2.37beta03 - May 20, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
......@@ -3768,13 +3768,13 @@ when the Intel assembler code was removed due to a licensing issue.
.SH IX. (Omitted)
.SH X. Y2K Compliance in libpng
May 19, 2009
May 20, 2009
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.37rc01 are Y2K compliant. It is my belief that earlier
upward through 1.2.37beta03 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
......@@ -4040,7 +4040,7 @@ the first widely used release:
1.2.36rc01 13 10236 12.so.0.36[.0]
1.0.44 10 10044 10.so.0.44[.0]
1.2.36 13 10236 12.so.0.36[.0]
1.2.37rc01 13 10237 12.so.0.37[.0]
1.2.37beta01-03 13 10237 12.so.0.37[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
......@@ -4096,7 +4096,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.2.37rc01 - May 19, 2009:
Libpng version 1.2.37beta03 - May 20, 2009:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
......@@ -4117,7 +4117,7 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following
this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.2.37rc01, May 19, 2009, are
libpng versions 1.2.6, August 15, 2004, through 1.2.37beta03, May 20, 2009, are
Copyright (c) 2004,2006-2008 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
......@@ -4216,7 +4216,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
May 19, 2009
May 20, 2009
.\" end of man page
.TH LIBPNGPF 3 "May 19, 2009"
.TH LIBPNGPF 3 "May 20, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.37rc01
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.37beta03
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP
......
.TH PNG 5 "May 19, 2009"
.TH PNG 5 "May 20, 2009"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
......
此差异已折叠。
/* png.h - header file for PNG reference library
*
* libpng version 1.2.37beta03 - May 19, 2009
* libpng version 1.2.37beta03 - May 20, 2009
* Copyright (c) 1998-2009 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.)
......@@ -8,7 +8,7 @@
* 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.37beta03 - May 19, 2009: Glenn
* libpng versions 0.97, January 1998, through 1.2.37beta03 - May 20, 2009: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
......@@ -169,65 +169,64 @@
* 1.0.30 10 10030 10.so.0.30[.0]
* 1.2.22 13 10222 12.so.0.22[.0]
* 1.2.23beta01-05 13 10223 12.so.0.23[.0]
* 1.2.23beta03 13 10223 12.so.0.23[.0]
* 1.2.23rc01 13 10223 12.so.0.23[.0]
* 1.2.23 13 10223 12.so.0.23[.0]
* 1.2.24beta01-02 13 10224 12.so.0.24[.0]
* 1.2.24beta03 13 10224 12.so.0.24[.0]
* 1.2.24rc01 13 10224 12.so.0.24[.0]
* 1.2.24 13 10224 12.so.0.24[.0]
* 1.2.25beta01-06 13 10225 12.so.0.25[.0]
* 1.2.25beta03-02 13 10225 12.so.0.25[.0]
* 1.2.25rc01-02 13 10225 12.so.0.25[.0]
* 1.0.31 10 10031 10.so.0.31[.0]
* 1.2.25 13 10225 12.so.0.25[.0]
* 1.2.26beta01-06 13 10226 12.so.0.26[.0]
* 1.2.26beta03 13 10226 12.so.0.26[.0]
* 1.2.26rc01 13 10226 12.so.0.26[.0]
* 1.2.26 13 10226 12.so.0.26[.0]
* 1.0.32 10 10032 10.so.0.32[.0]
* 1.2.27beta01-06 13 10227 12.so.0.27[.0]
* 1.2.27beta03 13 10227 12.so.0.27[.0]
* 1.2.27rc01 13 10227 12.so.0.27[.0]
* 1.0.33 10 10033 10.so.0.33[.0]
* 1.2.27 13 10227 12.so.0.27[.0]
* 1.0.34 10 10034 10.so.0.34[.0]
* 1.2.28 13 10228 12.so.0.28[.0]
* 1.2.29beta01-03 13 10229 12.so.0.29[.0]
* 1.2.29beta03 13 10229 12.so.0.29[.0]
* 1.2.29rc01 13 10229 12.so.0.29[.0]
* 1.0.35 10 10035 10.so.0.35[.0]
* 1.2.29 13 10229 12.so.0.29[.0]
* 1.0.37 10 10037 10.so.0.37[.0]
* 1.2.30beta01-04 13 10230 12.so.0.30[.0]
* 1.0.38beta03-08 10 10038 10.so.0.38[.0]
* 1.2.30beta03-08 13 10230 12.so.0.30[.0]
* 1.0.38rc01-08 10 10038 10.so.0.38[.0]
* 1.2.30rc01-08 13 10230 12.so.0.30[.0]
* 1.0.38 10 10038 10.so.0.38[.0]
* 1.2.30 13 10230 12.so.0.30[.0]
* 1.0.39beta03-03 10 10039 10.so.0.39[.0]
* 1.2.31beta03-03 13 10231 12.so.0.31[.0]
* 1.0.39rc01-03 10 10039 10.so.0.39[.0]
* 1.2.31rc01-03 13 10231 12.so.0.31[.0]
* 1.0.39 10 10039 10.so.0.39[.0]
* 1.2.31 13 10231 12.so.0.31[.0]
* 1.2.32beta01-02 13 10232 12.so.0.32[.0]
* 1.0.40beta03 10 10040 10.so.0.40[.0]
* 1.2.32beta03 13 10232 12.so.0.32[.0]
* 1.0.40rc01 10 10040 10.so.0.40[.0]
* 1.2.32rc01 13 10232 12.so.0.32[.0]
* 1.0.40 10 10040 10.so.0.40[.0]
* 1.2.32 13 10232 12.so.0.32[.0]
* 1.2.33beta01-02 13 10233 12.so.0.33[.0]
* 1.2.33beta03-02 13 10233 12.so.0.33[.0]
* 1.0.41beta03 10 10041 10.so.0.41[.0]
* 1.2.33rc01-02 13 10233 12.so.0.33[.0]
* 1.0.41rc01 10 10041 10.so.0.41[.0]
* 1.2.33 13 10233 12.so.0.33[.0]
* 1.0.41 10 10041 10.so.0.41[.0]
* 1.2.34beta01-07 13 10234 12.so.0.34[.0]
* 1.0.42beta03 10 10042 10.so.0.42[.0]
* 1.2.34beta03 13 10234 12.so.0.34[.0]
* 1.0.42rc01 10 10042 10.so.0.42[.0]
* 1.2.34rc01 13 10234 12.so.0.34[.0]
* 1.0.42 10 10042 10.so.0.42[.0]
* 1.2.34 13 10234 12.so.0.34[.0]
* 1.2.35beta01-03 13 10235 12.so.0.35[.0]
* 1.0.43beta03-02 10 10043 10.so.0.43[.0]
* 1.2.35beta03-02 13 10235 12.so.0.35[.0]
* 1.0.43rc01-02 10 10043 10.so.0.43[.0]
* 1.2.35rc01-02 13 10235 12.so.0.35[.0]
* 1.0.43 10 10043 10.so.0.43[.0]
* 1.2.35 13 10235 12.so.0.35[.0]
* 1.2.36beta01-05 13 10236 12.so.0.36[.0]
* 1.2.36beta03 13 10236 12.so.0.36[.0]
* 1.2.36rc01 13 10236 12.so.0.36[.0]
* 1.0.44 10 10044 10.so.0.44[.0]
* 1.2.36 13 10236 12.so.0.36[.0]
* 1.2.37beta01-03 13 10237 12.so.0.37[.0]
* 1.2.37beta03 13 10237 12.so.0.37[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
......@@ -257,7 +256,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* libpng versions 1.2.6, August 15, 2004, through 1.2.37beta03, May 19, 2009, are
* libpng versions 1.2.6, August 15, 2004, through 1.2.37beta03, May 20, 2009, are
* Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
......@@ -369,7 +368,7 @@
* Y2K compliance in libpng:
* =========================
*
* May 19, 2009
* May 20, 2009
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
......@@ -433,7 +432,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.2.37beta03"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.37beta03 - May 19, 2009\n"
" libpng version 1.2.37beta03 - May 20, 2009\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
......@@ -445,7 +444,7 @@
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
#define PNG_LIBPNG_VER_BUILD 01
#define PNG_LIBPNG_VER_BUILD 03
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
......@@ -462,7 +461,7 @@
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
PNG_LIBPNG_BUILD_PRIVATE */
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_RC
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
......
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.2.37rc01 - May 19, 2009
* libpng version 1.2.37beta03 - May 20, 2009
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
......
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.36 [May 7, 2009]
* Last changed in libpng 1.2.37 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
......@@ -234,9 +234,11 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
#endif
......@@ -263,7 +265,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
PNG_ABORT();
#endif
#ifdef PNG_NO_CONSOLE_IO
error_message = error_message; /* make compiler happy */
error_message = error_message; /* Make compiler happy */
#endif
}
......@@ -309,9 +311,9 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
warning_message = warning_message; /* make compiler happy */
warning_message = warning_message; /* Make compiler happy */
#endif
png_ptr = png_ptr; /* make compiler happy */
png_ptr = png_ptr; /* Make compiler happy */
}
#endif /* PNG_NO_WARNINGS */
......
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.2.30 [August 15, 2008]
* Last changed in libpng 1.2.37 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* Copyright (c) 1998-2009 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.)
*/
......@@ -17,6 +17,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
{
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->valid & flag);
else
return(0);
}
......@@ -26,6 +27,7 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->rowbytes);
else
return(0);
}
......@@ -36,20 +38,20 @@ png_get_rows(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->row_pointers);
else
return(0);
}
#endif
#ifdef PNG_EASY_ACCESS_SUPPORTED
/* easy access to info, added in libpng-0.99 */
/* Easy access to info, added in libpng-0.99 */
png_uint_32 PNGAPI
png_get_image_width(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->width;
}
return (0);
}
......@@ -57,9 +59,8 @@ png_uint_32 PNGAPI
png_get_image_height(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->height;
}
return (0);
}
......@@ -67,9 +68,8 @@ png_byte PNGAPI
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->bit_depth;
}
return (0);
}
......@@ -77,9 +77,8 @@ png_byte PNGAPI
png_get_color_type(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->color_type;
}
return (0);
}
......@@ -87,9 +86,8 @@ png_byte PNGAPI
png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->filter_type;
}
return (0);
}
......@@ -97,9 +95,8 @@ png_byte PNGAPI
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->interlace_type;
}
return (0);
}
......@@ -107,9 +104,8 @@ png_byte PNGAPI
png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->compression_type;
}
return (0);
}
......@@ -121,8 +117,10 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else return (info_ptr->x_pixels_per_unit);
}
#else
......@@ -139,8 +137,10 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else return (info_ptr->y_pixels_per_unit);
}
#else
......@@ -157,9 +157,11 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0);
else return (info_ptr->x_pixels_per_unit);
}
#else
......@@ -174,6 +176,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
......@@ -184,7 +187,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
/(float)info_ptr->x_pixels_per_unit));
}
#else
return (0.0);
return (0.0);
#endif
return ((float)0.0);
}
......@@ -195,15 +198,18 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
else return (info_ptr->x_offset);
}
#else
return (0);
return (0);
#endif
return (0);
}
......@@ -212,12 +218,15 @@ png_int_32 PNGAPI
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
else return (info_ptr->y_offset);
}
#else
......@@ -230,12 +239,15 @@ png_int_32 PNGAPI
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
else return (info_ptr->x_offset);
}
#else
......@@ -248,12 +260,15 @@ png_int_32 PNGAPI
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
else return (info_ptr->y_offset);
}
#else
......@@ -495,8 +510,9 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_debug1(1, "in %s retrieval function", "iCCP");
*name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile;
/* compression_type is a dummy so the API won't have to change
if we introduce multiple compression types later. */
/* Compression_type is a dummy so the API won't have to change
* if we introduce multiple compression types later.
*/
*proflen = (int)info_ptr->iccp_proflen;
*compression_type = (int)info_ptr->iccp_compression;
return (PNG_INFO_iCCP);
......@@ -549,22 +565,29 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
*height = info_ptr->height;
*bit_depth = info_ptr->bit_depth;
if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
png_error(png_ptr, "Invalid bit depth");
png_error(png_ptr, "Invalid bit depth");
*color_type = info_ptr->color_type;
if (info_ptr->color_type > 6)
png_error(png_ptr, "Invalid color type");
png_error(png_ptr, "Invalid color type");
if (compression_type != NULL)
*compression_type = info_ptr->compression_type;
if (filter_type != NULL)
*filter_type = info_ptr->filter_type;
if (interlace_type != NULL)
*interlace_type = info_ptr->interlace_type;
/* check for potential overflow of rowbytes */
/* Check for potential overflow of rowbytes */
if (*width == 0 || *width > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image width");
if (*height == 0 || *height > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image height");
if (info_ptr->width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RGBA pixels */
- 64 /* bigrowbuf hack */
......@@ -575,6 +598,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
png_warning(png_ptr,
"Width too large for libpng to process image data.");
}
return (1);
}
return (0);
......@@ -605,8 +629,8 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *units, png_charpp *params)
{
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL)
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL)
{
png_debug1(1, "in %s retrieval function", "pCAL");
*purpose = info_ptr->pcal_purpose;
......@@ -629,7 +653,7 @@ png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
int *unit, double *width, double *height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_pixel_width;
......@@ -645,7 +669,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_s_width;
......@@ -669,16 +693,19 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
(info_ptr->valid & PNG_INFO_pHYs))
{
png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL)
{
*res_x = info_ptr->x_pixels_per_unit;
retval |= PNG_INFO_pHYs;
}
if (res_y != NULL)
{
*res_y = info_ptr->y_pixels_per_unit;
retval |= PNG_INFO_pHYs;
}
if (unit_type != NULL)
{
*unit_type = (int)info_ptr->phys_unit_type;
......@@ -730,10 +757,13 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
png_debug1(1, "in %s retrieval function",
(png_ptr->chunk_name[0] == '\0' ? "text"
: (png_const_charp)png_ptr->chunk_name));
if (text_ptr != NULL)
*text_ptr = info_ptr->text;
if (num_text != NULL)
*num_text = info_ptr->num_text;
return ((png_uint_32)info_ptr->num_text);
}
if (num_text != NULL)
......@@ -773,6 +803,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
*trans = info_ptr->trans;
retval |= PNG_INFO_tRNS;
}
if (trans_values != NULL)
*trans_values = &(info_ptr->trans_values);
}
......@@ -783,6 +814,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
*trans_values = &(info_ptr->trans_values);
retval |= PNG_INFO_tRNS;
}
if (trans != NULL)
*trans = NULL;
}
......@@ -836,47 +868,47 @@ png_get_compression_buffer_size(png_structp png_ptr)
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
#ifndef PNG_1_0_X
/* this function was added to libpng 1.2.0 and should exist by default */
/* This function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI
png_get_asm_flags (png_structp png_ptr)
{
/* obsolete, to be removed from libpng-1.4.0 */
/* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0L: 0L);
}
/* this function was added to libpng 1.2.0 and should exist by default */
/* This function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select)
{
/* obsolete, to be removed from libpng-1.4.0 */
/* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select;
return 0L;
}
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
/* this function was added to libpng 1.2.0 */
/* This function was added to libpng 1.2.0 */
png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID)
{
/* obsolete, to be removed from libpng-1.4.0 */
/* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select;
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
return 0L;
}
/* this function was added to libpng 1.2.0 */
/* This function was added to libpng 1.2.0 */
png_byte PNGAPI
png_get_mmx_bitdepth_threshold (png_structp png_ptr)
{
/* obsolete, to be removed from libpng-1.4.0 */
/* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0: 0);
}
/* this function was added to libpng 1.2.0 */
/* This function was added to libpng 1.2.0 */
png_uint_32 PNGAPI
png_get_mmx_rowbytes_threshold (png_structp png_ptr)
{
/* obsolete, to be removed from libpng-1.4.0 */
/* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0L: 0L);
}
#endif /* ?PNG_1_0_X */
......
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.2.30 [August 15, 2008]
* Last changed in libpng 1.2.37 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* Copyright (c) 1998-2009 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.)
*
......@@ -20,7 +20,7 @@
/* Borland DOS special memory handler */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* if you change this, be sure to change the one in png.h also */
/* If you change this, be sure to change the one in png.h also */
/* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */
......@@ -40,11 +40,11 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info);
size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct);
size = png_sizeof(png_struct);
else
return (png_get_copyright(NULL));
return (png_get_copyright(NULL));
#ifdef PNG_USER_MEM_SUPPORTED
if (malloc_fn != NULL)
......@@ -56,7 +56,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
}
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);
......@@ -122,9 +122,9 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else
ret = (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);
......@@ -149,12 +149,12 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
#endif
if (size != (size_t)size)
ret = NULL;
ret = NULL;
else if (size == (png_uint_32)65536L)
{
if (png_ptr->offset_table == NULL)
{
/* try to see if we need to do any of this fancy stuff */
/* Try to see if we need to do any of this fancy stuff */
ret = farmalloc(size);
if (ret == NULL || ((png_size_t)ret & 0xffff))
{
......@@ -269,10 +269,10 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
return (ret);
}
/* free a pointer allocated by png_malloc(). In the default
configuration, png_ptr is not used, but is passed in case it
is needed. If ptr is NULL, return without taking any action. */
/* Free a pointer allocated by png_malloc(). In the default
* configuration, png_ptr is not used, but is passed in case it
* is needed. If ptr is NULL, return without taking any action.
*/
void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr)
{
......@@ -285,7 +285,8 @@ png_free(png_structp png_ptr, png_voidp ptr)
(*(png_ptr->free_fn))(png_ptr, ptr);
return;
}
else png_free_default(png_ptr, ptr);
else
png_free_default(png_ptr, ptr);
}
void PNGAPI
......@@ -293,7 +294,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || ptr == NULL) return;
if (png_ptr == NULL || ptr == NULL)
return;
if (png_ptr->offset_table != NULL)
{
......@@ -420,10 +422,11 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
}
/* Allocate memory. For reasonable files, size should never exceed
64K. However, zlib may allocate more then 64K if you don't tell
it not to. See zconf.h and png.h for more information. zlib does
need to allocate exactly 64K, so whatever you call here must
have the ability to do that. */
* 64K. However, zlib may allocate more then 64K if you don't tell
* it not to. See zconf.h and png.h for more information. zlib does
* need to allocate exactly 64K, so whatever you call here must
* have the ability to do that.
*/
png_voidp PNGAPI
......@@ -436,9 +439,9 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
return (NULL);
if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else
ret = (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);
......@@ -465,23 +468,23 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
}
#endif
/* Check for overflow */
/* Check for overflow */
#if defined(__TURBOC__) && !defined(__FLAT__)
if (size != (unsigned long)size)
ret = NULL;
else
ret = farmalloc(size);
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);
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);
if (size != (size_t)size)
ret = NULL;
else
ret = malloc((size_t)size);
# endif
#endif
......@@ -494,7 +497,8 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
}
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
without taking any action. */
* without taking any action.
*/
void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr)
{
......@@ -507,7 +511,8 @@ png_free(png_structp png_ptr, png_voidp ptr)
(*(png_ptr->free_fn))(png_ptr, ptr);
return;
}
else png_free_default(png_ptr, ptr);
else
png_free_default(png_ptr, ptr);
}
void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr)
......@@ -543,7 +548,8 @@ png_malloc_warn(png_structp png_ptr, png_uint_32 size)
{
png_voidp ptr;
png_uint_32 save_flags;
if (png_ptr == NULL) return (NULL);
if (png_ptr == NULL)
return (NULL);
save_flags = png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
......@@ -603,7 +609,8 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
png_voidp PNGAPI
png_get_mem_ptr(png_structp png_ptr)
{
if (png_ptr == NULL) return (NULL);
if (png_ptr == NULL)
return (NULL);
return ((png_voidp)png_ptr->mem_ptr);
}
#endif /* PNG_USER_MEM_SUPPORTED */
......
此差异已折叠。
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.2.35 [February 14, 2009]
* Last changed in libpng 1.2.37 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
......@@ -57,7 +57,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (png_ptr == NULL)
return (NULL);
/* added at libpng-1.2.6 */
/* 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;
......@@ -137,7 +137,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
}
}
/* initialize zbuf - compression buffer */
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
......@@ -266,7 +266,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_debug(1, "in png_read_init_3");
#ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */
/* Save jump buffer and error functions */
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
#endif
......@@ -277,21 +277,21 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_ptr = *ptr_ptr;
}
/* reset all variables to 0 */
/* Reset all variables to 0 */
png_memset(png_ptr, 0, png_sizeof(png_struct));
#ifdef PNG_SETJMP_SUPPORTED
/* restore jump buffer */
/* Restore jump buffer */
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
#endif
/* added at libpng-1.2.6 */
/* 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 */
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
......@@ -326,7 +326,8 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr == NULL || info_ptr == NULL) return;
if (png_ptr == NULL || info_ptr == NULL)
return;
png_debug(1, "in png_read_info");
/* If we haven't checked all of the PNG signature bytes, do so now. */
if (png_ptr->sig_bytes < 8)
......@@ -529,12 +530,13 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
}
#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* optional call to update the users info_ptr structure */
/* Optional call to update the users info_ptr structure */
void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_read_update_info");
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
else
......@@ -553,7 +555,8 @@ void PNGAPI
png_start_read_image(png_structp png_ptr)
{
png_debug(1, "in png_start_read_image");
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
}
......@@ -570,14 +573,15 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
#endif
int ret;
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
png_debug2(1, "in png_read_row (row %lu, pass %d)",
png_ptr->row_number, png_ptr->pass);
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
{
/* check for transforms that have been set but were defined out */
/* Check for transforms that have been set but were defined out */
#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED)
if (png_ptr->transformations & PNG_INVERT_MONO)
png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined.");
......@@ -609,7 +613,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
}
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* if interlaced and we do not need a new row, combine row and return */
/* If interlaced and we do not need a new row, combine row and return */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
switch (png_ptr->pass)
......@@ -756,15 +760,15 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_do_read_transformations(png_ptr);
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* blow up interlaced rows to full size */
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced &&
(png_ptr->transformations & PNG_INTERLACE))
{
if (png_ptr->pass < 6)
/* old interface (pre-1.0.9):
png_do_read_interlace(&(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/
/* Old interface (pre-1.0.9):
* png_do_read_interlace(&(png_ptr->row_info),
* png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/
png_do_read_interlace(png_ptr);
if (dsp_row != NULL)
......@@ -823,7 +827,8 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp dp;
png_debug(1, "in png_read_rows");
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
rp = row;
dp = display_row;
if (rp != NULL && dp != NULL)
......@@ -872,7 +877,8 @@ png_read_image(png_structp png_ptr, png_bytepp image)
png_bytepp rp;
png_debug(1, "in png_read_image");
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
pass = png_set_interlace_handling(png_ptr);
......@@ -908,7 +914,8 @@ void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_read_end");
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
do
......@@ -1075,7 +1082,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
}
#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
/* free all memory used by the read */
/* Free all memory used by the read */
void PNGAPI
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_infopp end_info_ptr_ptr)
......@@ -1147,7 +1154,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
}
}
/* free all memory used by the read (old method) */
/* Free all memory used by the read (old method) */
void /* PRIVATE */
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
{
......@@ -1296,7 +1303,8 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
void PNGAPI
png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
{
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
png_ptr->read_row_fn = read_row_fn;
}
......@@ -1310,9 +1318,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
{
int row;
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
#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);
......@@ -1328,10 +1337,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* -------------- image transformations start here ------------------- */
#if defined(PNG_READ_16_TO_8_SUPPORTED)
/* tell libpng to strip 16 bit/color files down to 8 bits per 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);
png_set_strip_16(png_ptr);
#endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
......@@ -1339,7 +1348,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
* the background (not recommended).
*/
if (transforms & PNG_TRANSFORM_STRIP_ALPHA)
png_set_strip_alpha(png_ptr);
png_set_strip_alpha(png_ptr);
#endif
#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED)
......@@ -1347,7 +1356,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
* byte into separate bytes (useful for paletted and grayscale images).
*/
if (transforms & PNG_TRANSFORM_PACKING)
png_set_packing(png_ptr);
png_set_packing(png_ptr);
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)
......@@ -1355,7 +1364,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
* (not useful if you are using png_set_packing).
*/
if (transforms & PNG_TRANSFORM_PACKSWAP)
png_set_packswap(png_ptr);
png_set_packswap(png_ptr);
#endif
#if defined(PNG_READ_EXPAND_SUPPORTED)
......@@ -1365,9 +1374,9 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
* channels so the data will be available as RGBA quartets.
*/
if (transforms & PNG_TRANSFORM_EXPAND)
if ((png_ptr->bit_depth < 8) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
if ((png_ptr->bit_depth < 8) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
png_set_expand(png_ptr);
#endif
......@@ -1375,10 +1384,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
*/
#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);
png_set_invert_mono(png_ptr);
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED)
......@@ -1397,24 +1406,24 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
#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);
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);
png_set_swap(png_ptr);
#endif
/* We don't handle adding filler bytes */
......@@ -1447,10 +1456,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_read_image(png_ptr, info_ptr->row_pointers);
info_ptr->valid |= PNG_INFO_IDAT;
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
transforms = transforms; /* quiet compiler warnings */
transforms = transforms; /* Quiet compiler warnings */
params = params;
}
......
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.2.36 [May 7, 2009]
* Last changed in libpng 1.2.37 [May 20, 2009]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
......@@ -20,10 +20,11 @@
#if defined(PNG_READ_SUPPORTED)
/* Read the data from whatever input you are using. The default routine
reads from a file pointer. Note that this routine sometimes gets called
with very small lengths, so you should implement some kind of simple
buffering if you are using unbuffered reads. This should never be asked
to read more then 64K on a 16 bit machine. */
* reads from a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered reads. This should never be asked
* to read more then 64K on a 16 bit machine.
*/
void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
......@@ -36,16 +37,18 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#if !defined(PNG_NO_STDIO)
/* This is the function that does the actual reading of data. If you are
not reading from a standard C stream, you should create a replacement
read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */
* not reading from a standard C stream, you should create a replacement
* read_data function and use it at run time with png_set_read_fn(), rather
* than changing the library.
*/
#ifndef USE_FAR_KEYWORD
void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns.
*/
......@@ -61,7 +64,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Read Error");
}
#else
/* this is the model-independent version. Since the standard I/O library
/* This is the model-independent version. Since the standard I/O library
can't handle far buffers in the medium and small models, we have to copy
the data.
*/
......@@ -76,7 +79,8 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_byte *n_data;
png_FILE_p io_ptr;
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
......@@ -121,25 +125,27 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif
/* This function allows the application to supply a new input function
for libpng if standard C streams aren't being used.
This function takes as its arguments:
png_ptr - pointer to a png input data structure
io_ptr - pointer to user supplied structure containing info about
the input functions. May be NULL.
read_data_fn - pointer to a new input function that takes as its
arguments a pointer to a png_struct, a pointer to
a location where input data can be stored, and a 32-bit
unsigned int that is the number of bytes to be read.
To exit and output any fatal error messages the new write
function should call png_error(png_ptr, "Error msg").
May be NULL, in which case libpng's default function will
be used. */
* for libpng if standard C streams aren't being used.
*
* This function takes as its arguments:
* png_ptr - pointer to a png input data structure
* io_ptr - pointer to user supplied structure containing info about
* the input functions. May be NULL.
* read_data_fn - pointer to a new input function that takes as its
* arguments a pointer to a png_struct, a pointer to
* a location where input data can be stored, and a 32-bit
* unsigned int that is the number of bytes to be read.
* To exit and output any fatal error messages the new write
* function should call png_error(png_ptr, "Error msg").
* May be NULL, in which case libpng's default function will
* be used.
*/
void PNGAPI
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn)
{
if (png_ptr == NULL) return;
if (png_ptr == NULL)
return;
png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册