[master] Imported from libpng-1.6.11.tar

This commit is contained in:
Glenn Randers-Pehrson 2014-06-05 09:53:19 -05:00
parent 1cc02f0395
commit d21eae44e7
85 changed files with 1020 additions and 894 deletions

105
ANNOUNCE
View File

@ -1,5 +1,5 @@
Libpng 1.6.10 - March 6, 2014 Libpng 1.6.11 - June 5, 2014
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production codes.
@ -8,80 +8,51 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.6.10.tar.xz (LZMA-compressed, recommended) libpng-1.6.11.tar.xz (LZMA-compressed, recommended)
libpng-1.6.10.tar.gz libpng-1.6.11.tar.gz
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lpng1610.7z (LZMA-compressed, recommended) lpng1611.7z (LZMA-compressed, recommended)
lpng1610.zip lpng1611.zip
Other information: Other information:
libpng-1.6.10-README.txt libpng-1.6.11-README.txt
libpng-1.6.10-LICENSE.txt libpng-1.6.11-LICENSE.txt
libpng-1.6.10-*.asc (armored detached GPG signatures) libpng-1.6.11-*.asc (armored detached GPG signatures)
Changes since the last public release (1.6.9): Changes since the last public release (1.6.10):
Backported changes from libpng-1.7.0beta30 and beta31:
Fixed a large number of instances where PNGCBAPI was omitted from Use "if (value != 0)" instead of "if (value)" consistently.
function definitions. Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio.
Added pngimage test program for png_read_png() and png_write_png() Moved configuration information from the manual to the INSTALL file.
with two new test scripts. Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because
Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3
png_set_packing() in png_read_png(). when using its "__builtin_pow()" function.
Fixed combination of ~alpha with shift. On read invert alpha, processing Silence 'unused parameter' build warnings (Cosmin Truta).
occurred after shift processing, which causes the final values to be $(CP) is now used alongside $(RM_F). Also, use 'copy' instead of 'cp'
outside the range that should be produced by the shift. Reversing the where applicable, and applied other minor makefile changes (Cosmin).
order on read makes the two transforms work together correctly and mirrors Don't warn about invalid dimensions exceeding user limits (Cosmin).
the order used on write. Allow an easy replacement of the default pre-built configuration
Do not read invalid sBIT chunks. Previously libpng only checked sBIT header with a custom header, via the make PNGLIBCONF_H_PREBUILT
values on write, so a malicious PNG writer could therefore cause macro (Cosmin).
the read code to return an invalid sBIT chunk, which might lead to Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
application errors or crashes. Such chunks are now skipped (with with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
chunk_benign_error). Made progressive reading of interlaced images consistent with the
Make png_read_png() and png_write_png() prototypes in png.h depend behavior of the sequential reader and consistent with the manual, by
upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED. moving some code out of the PNG_READ_INTERLACING_SUPPORTED blocks. The
Support builds with unsupported PNG_TRANSFORM_* values. All of the row_callback now receives the proper pass number and unexpanded rows, when
PNG_TRANSFORM_* values are always defined in png.h and, because they png_combine_row() isn't built or used, and png_set_interlace_handling()
are used for both read and write in some cases, it is not reliable is not called.
to #if out ones that are totally unsupported. This change adds error Allow PNG_sRGB_PROFILE_CHECKING = (-1) to mean no sRGB profile checking.
detection in png_read_image() and png_write_image() to do a Do not reject ICC V2 profiles that lack padding (Kai-Uwe Behrmann).
png_app_error() if the app requests something that cannot be done Relocated closing bracket of the sRGB profile test loop to avoid getting
and it adds corresponding code to pngimage.c to handle such options "Not recognizing known sRGB profile that has been edited" warning for
by not attempting to test them. ICC V2 profiles that lack the MD5 signature in the profile header.
Moved redefines of png_error(), png_warning(), png_chunk_error(), Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
and png_chunk_warning() from pngpriv.h to png.h to make them visible Test ZLIB_VERNUM instead of PNG_ZLIB_VERNUM in contrib/tools/pngfix.c
to libpng-calling applications.
Moved OS dependent code from arm/arm_init.c, to allow the included
implementation of the ARM NEON discovery function to be set at
build-time and provide sample implementations from the current code in the
contrib/arm-neon subdirectory. The __linux__ code has also been changed to
compile and link on Android by using /proc/cpuinfo, and the old linux code
is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
dependencies apart from opening /proc/cpuinfo and is C90 compliant.
Check for info_ptr == NULL early in png_read_end() so we don't need to
run all the png_handle_*() and depend on them to return if info_ptr == NULL.
This improves the performance of png_read_end(png_ptr, NULL) and makes
it more robust against future programming errors.
Check for __has_extension before using it in pngconf.h, to
support older Clang versions (Jeremy Sequoia).
Treat CRC error handling with png_set_crc_action(), instead of with
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
after recognizing the IDAT chunk, which avoids an infinite loop while
reading a datastream whose first IDAT chunk is of zero-length.
This fixes CERT VU#684412 and CVE-2014-0333.
Don't recognize known sRGB profiles as sRGB if they have been hacked,
but don't reject them and don't issue a copyright violation warning.
Moved some documentation from png.h to libpng.3 and libpng-manual.txt
Minor editing of contrib/arm-neon/README and contrib/examples/*.c
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
Un-deprecated png_data_freer().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

55
CHANGES
View File

@ -4345,8 +4345,9 @@ Version 1.6.0beta37 [January 10, 2013]
programs to generate and test a PNG which should have the problem. programs to generate and test a PNG which should have the problem.
Version 1.6.0beta39 [January 19, 2013] Version 1.6.0beta39 [January 19, 2013]
Again corrected attempt at overflow detection in png_set_unknown_chunks(). Again corrected attempt at overflow detection in png_set_unknown_chunks()
Added overflow detection in png_set_sPLT() and png_set_text_2(). (CVE-2013-7353). Added overflow detection in png_set_sPLT() and
png_set_text_2() (CVE-2013-7354).
Version 1.6.0beta40 [January 20, 2013] Version 1.6.0beta40 [January 20, 2013]
Use consistent handling of overflows in text, sPLT and unknown png_set_* APIs Use consistent handling of overflows in text, sPLT and unknown png_set_* APIs
@ -4873,6 +4874,56 @@ Version 1.6.10rc03 [March 4, 2014]
Un-deprecated png_data_freer(). Un-deprecated png_data_freer().
Version 1.6.10 [March 6, 2014] Version 1.6.10 [March 6, 2014]
No changes.
Version 1.6.11beta01 [March 17, 2014]
Use "if (value != 0)" instead of "if (value)" consistently.
Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio.
Moved configuration information from the manual to the INSTALL file.
Version 1.6.11beta02 [April 6, 2014]
Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because
they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3
when using its "__builtin_pow()" function.
Silence 'unused parameter' build warnings (Cosmin Truta).
$(CP) is now used alongside $(RM_F). Also, use 'copy' instead of 'cp'
where applicable, and applied other minor makefile changes (Cosmin).
Don't warn about invalid dimensions exceeding user limits (Cosmin).
Allow an easy replacement of the default pre-built configuration
header with a custom header, via the make PNGLIBCONF_H_PREBUILT
macro (Cosmin).
Version 1.6.11beta03 [April 6, 2014]
Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
Optionally use __builtin_bswap16() in png_do_swap().
Version 1.6.11beta04 [April 19, 2014]
Made progressive reading of interlaced images consistent with the
behavior of the sequential reader and consistent with the manual, by
moving some code out of the PNG_READ_INTERLACING_SUPPORTED blocks. The
row_callback now receives the proper pass number and unexpanded rows, when
png_combine_row() isn't built or used, and png_set_interlace_handling()
is not called.
Allow PNG_sRGB_PROFILE_CHECKING = (-1) to mean no sRGB profile checking.
Version 1.6.11beta05 [April 26, 2014]
Do not reject ICC V2 profiles that lack padding (Kai-Uwe Behrmann).
Relocated closing bracket of the sRGB profile test loop to avoid getting
"Not recognizing known sRGB profile that has been edited" warning for
ICC V2 profiles that lack the MD5 signature in the profile header.
Version 1.6.11beta06 [May 19, 2014]
Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
Version 1.6.11rc01 [May 27, 2014]
No changes.
Version 1.6.11rc02 [June 3, 2014]
Test ZLIB_VERNUM instead of PNG_ZLIB_VERNUM in contrib/tools/pngfix.c
Version 1.6.11 [June 5, 2014]
No changes.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -16,7 +16,7 @@ enable_testing()
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6) set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 10) set(PNGLIB_RELEASE 11)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@ -252,7 +252,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 16.${PNGLIB_RELEASE}.1.6.10 # VERSION 16.${PNGLIB_RELEASE}.1.6.11
VERSION 16.${PNGLIB_RELEASE}.0 VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 16 SOVERSION 16
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)

225
INSTALL
View File

@ -1,6 +1,27 @@
Installing libpng Installing libpng
Contents
I. Simple installation
II. Rebuilding the configure scripts
III. Using scripts/makefile*
IV. Using cmake
V. Directory structure
VI. Building with project files
VII. Building with makefiles
VIII. Configuring libpng for 16-bit platforms
IX. Configuring for DOS
X. Configuring for Medium Model
XI. Prepending a prefix to exported symbols
XII. Configuring for compiler xxx:
XIII. Removing unwanted object code
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
XV. Configuring libpng for multiprocessing
XVI. Other sources of information about libpng:
I. Simple installation
On Unix/Linux and similar systems, you can simply type On Unix/Linux and similar systems, you can simply type
./configure [--prefix=/path] ./configure [--prefix=/path]
@ -9,6 +30,8 @@ On Unix/Linux and similar systems, you can simply type
and ignore the rest of this document. and ignore the rest of this document.
II. Rebuilding the configure scripts
If configure does not work on your system, or if you have a need to If configure does not work on your system, or if you have a need to
change configure.ac or Makefile.am, and you have a reasonably change configure.ac or Makefile.am, and you have a reasonably
up-to-date set of tools, running ./autogen.sh in a git clone before up-to-date set of tools, running ./autogen.sh in a git clone before
@ -24,9 +47,12 @@ aren't using any of the included pre-built scripts, you can do this:
make install make install
make check make check
III. Using scripts/makefile*
Instead, you can use one of the custom-built makefiles in the Instead, you can use one of the custom-built makefiles in the
"scripts" directory "scripts" directory
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
cp scripts/makefile.system makefile cp scripts/makefile.system makefile
make test make test
make install make install
@ -59,15 +85,19 @@ LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test". in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
IV. Using cmake
If you want to use "cmake" (see www.cmake.org), type If you want to use "cmake" (see www.cmake.org), type
cmake . -DCMAKE_INSTALL_PREFIX=/path cmake . -DCMAKE_INSTALL_PREFIX=/path
make make
make install make install
V. Directory structure
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.7" might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.8"
or "zlib127") so that you have directories called "zlib" and "libpng". or "zlib128") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@ -110,6 +140,8 @@ If the line endings in the files look funny, you may wish to get the other
distribution of libpng. It is available in both tar.gz (UNIX style line distribution of libpng. It is available in both tar.gz (UNIX style line
endings) and zip (DOS style line endings) formats. endings) and zip (DOS style line endings) formats.
VI. Building with project files
If you are building libpng with MSVC, you can enter the If you are building libpng with MSVC, you can enter the
libpng projects\visualc6 or visualc71 directory and follow the instructions libpng projects\visualc6 or visualc71 directory and follow the instructions
in README.txt. in README.txt.
@ -118,11 +150,15 @@ Otherwise enter the zlib directory and follow the instructions in zlib/README,
then come back here and run "configure" or choose the appropriate then come back here and run "configure" or choose the appropriate
makefile.sys in the scripts directory. makefile.sys in the scripts directory.
VII. Building with makefiles
Copy the file (or files) that you need from the Copy the file (or files) that you need from the
scripts directory into this directory, for example scripts directory into this directory, for example
MSDOS example: copy scripts\makefile.msc makefile MSDOS example: copy scripts\makefile.msc makefile
UNIX example: cp scripts/makefile.std makefile copy scripts\pnglibconf.h.prebuilt pnglibconf.h
UNIX example: cp scripts/makefile.std makefile
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
Read the makefile to see if you need to change any source or Read the makefile to see if you need to change any source or
target directories to match your preferences. target directories to match your preferences.
@ -145,6 +181,189 @@ do that, run "make install" in the zlib directory first if necessary).
Some also allow you to run "make test-installed" after you have Some also allow you to run "make test-installed" after you have
run "make install". run "make install".
VIII. Configuring libpng for 16-bit platforms
You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
IX. Configuring for DOS
For DOS users who only have access to the lower 640K, you will
have to limit zlib's memory usage via a png_set_compression_mem_level()
call. See zlib.h or zconf.h in the zlib library for more information.
X. Configuring for Medium Model
Libpng's support for medium model has been tested on most of the popular
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
defined, and FAR gets defined to far in pngconf.h, and you should be
all set. Everything in the library (except for zlib's structure) is
expecting far data. You must use the typedefs with the p or pp on
the end for pointers (or at least look at them and be careful). Make
note that the rows of data are defined as png_bytepp, which is
an "unsigned char far * far *".
XI. Prepending a prefix to exported symbols
Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the
configuration option "--with-libpng-prefix=FOO_", where FOO_ can be any
string beginning with a letter and containing only uppercase
and lowercase letters, digits, and the underscore (i.e., a C language
identifier). This creates a set of macros in pnglibconf.h, so this is
transparent to applications; their function calls get transformed by
the macros to use the modified names.
XII. Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add, change
or delete an include, this is the place to do it.
The includes that are not needed outside libpng are placed in pngpriv.h,
which is only used by the routines inside libpng itself.
The files in libpng proper only include pngpriv.h and png.h, which
in turn includes pngconf.h and, as of libpng-1.5.0, pnglibconf.h.
As of libpng-1.5.0, pngpriv.h also includes three other private header
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
that previously appeared in the public headers.
XIII. Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with
PNG_NO_.
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four, along with directives to turn on any of the capabilities that
you do want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the
extra transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks. Use of the
PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
that is incapable of reading or writing ancillary chunks. If you are
not using the progressive reading capability, you can turn that off
with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
capability, which you'll still have).
All the reading and writing specific code are in separate files, so the
linker should only grab the files it needs. However, if you want to
make sure, or if you are building a stand alone library, all the
reading files start with "pngr" and all the writing files start with "pngw".
The files that don't match either (like png.c, pngtrans.c, etc.)
are used for both reading and writing, and always need to be included.
The progressive reader is in pngpread.c
If you are creating or distributing a dynamically linked library (a .so
or DLL file), you should not remove or disable any parts of the library,
as this will cause applications linked with different versions of the
library to fail if they call functions not available in your library.
The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory.
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast
majority of library users or builders; however, the few who configure libpng
to a non-default feature set may need to change how this is done.
There should be no need for library builders to alter build scripts if
these use the distributed build support - configure or the makefiles -
however, users of the makefiles may care to update their build scripts
to build pnglibconf.h where the corresponding makefile does not do so.
Building libpng with a non-default configuration has changed completely.
The old method using pngusr.h should still work correctly even though the
way pngusr.h is used in the build has been changed; however, library
builders will probably want to examine the changes to take advantage of
new capabilities and to simplify their build system.
A. Specific changes to library configuration capabilities
The exact mechanism used to control attributes of API functions has
changed. A single set of operating system independent macro definitions
is used and operating system specific directives are defined in
pnglibconf.h
As part of this the mechanism used to choose procedure call standards on
those systems that allow a choice has been changed. At present this only
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
running on Intel processors. As before, PNGAPI is defined where required
to control the exported API functions; however, two new macros, PNGCBAPI
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
(PNGCAPI) for functions that must match a C library prototype (currently
only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h
Despite these changes, libpng 1.5.0 only supports the native C function
calling standard on those platforms tested so far (__cdecl on Microsoft
Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list
(png-mng-implement) of this and library builders who use Openwatcom and
therefore set PNG_API_RULE to 2 should also contact the mailing list.
B. Changes to the configuration mechanism
Prior to libpng-1.5.0 library builders who needed to configure libpng
had either to modify the exported pngconf.h header file to add system
specific configuration or had to write feature selection macros into
pngusr.h and cause this to be included into pngconf.h by defining
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
application built without PNG_USER_CONFIG defined would see the
unmodified, default, libpng API and thus would probably fail to link.
These mechanisms still work in the configure build and in any makefile
build that builds pnglibconf.h, although the feature selection macros
have changed somewhat as described above. In 1.5.0, however, pngusr.h is
processed only once, when the exported header file pnglibconf.h is built.
pngconf.h no longer includes pngusr.h, therefore pngusr.h is ignored after the
build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
CPPFLAGS setting in the build also still works; however, the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
All configuration now only works if pnglibconf.h is built from
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
(the original author of awk) maintains C source code of that awk and this
and all known later implementations (often called by subtly different
names - nawk and gawk for example) are adequate to build pnglibconf.h.
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
and does not work; this may also apply to other systems that have a
functioning awk called 'nawk'.
Configuration options are now documented in scripts/pnglibconf.dfa. This
file also includes dependency information that ensures a configuration is
consistent; that is, if a feature is switched off dependent features are
also removed. As a recommended alternative to using feature macros in
pngusr.h a system builder may also define equivalent options in pngusr.dfa
(or, indeed, any file) and add that to the configuration by setting
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
how to do this, and a case where pngusr.h is still required.
XV. Configuring libpng for multiprocessing
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
is known to be not thread-safe on some platforms and we don't know of
any platform where it is guaranteed to be thread-safe. Therefore, if
your application is going to be using multiple threads, you should
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
-DPNG_NO_SETJMP on your compile line, or with
#undef PNG_SETJMP_SUPPORTED
in your pnglibconf.h or pngusr.h.
XVI. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.

View File

@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are libpng versions 1.2.6, August 15, 2004, through 1.6.11, June 5, 2014, are
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
March 6, 2014 June 5, 2014

2
README
View File

@ -1,4 +1,4 @@
README for libpng version 1.6.10 - March 6, 2014 (shared library 16.0) README for libpng version 1.6.11 - June 5, 2014 (shared library 16.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.

1
TODO
View File

@ -6,6 +6,7 @@ Better C++ wrapper/full C++ implementation?
Fix problem with C++ and EXTERN "C". Fix problem with C++ and EXTERN "C".
cHRM transformation. cHRM transformation.
Remove setjmp/longjmp usage in favor of returning error codes. Remove setjmp/longjmp usage in favor of returning error codes.
Palette creation.
Add "grayscale->palette" transformation and "palette->grayscale" detection. Add "grayscale->palette" transformation and "palette->grayscale" detection.
Improved dithering. Improved dithering.
Multi-lingual error and warning message support. Multi-lingual error and warning message support.

View File

@ -3,7 +3,7 @@
* *
* Copyright (c) 2014 Glenn Randers-Pehrson * Copyright (c) 2014 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011. * Written by Mans Rullgard, 2011.
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.10 [June 5, 2014]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -22,7 +22,7 @@
/* WARNING: it is strongly recommended that you do not build libpng with /* WARNING: it is strongly recommended that you do not build libpng with
* run-time checks for CPU features if at all possible. In the case of the ARM * run-time checks for CPU features if at all possible. In the case of the ARM
* NEON instructions there is no processor-specific way of detecting the * NEON instructions there is no processor-specific way of detecting the
* presense of the required support, therefore run-time detectioon is extremely * presence of the required support, therefore run-time detection is extremely
* OS specific. * OS specific.
* *
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing * You may set the macro PNG_ARM_NEON_FILE to the file name of file containing

View File

@ -18,7 +18,7 @@ AC_PREREQ([2.68])
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng],[1.6.10],[png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng],[1.6.11],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts]) AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign') # libpng does not follow GNU file name conventions (hence 'foreign')
@ -39,10 +39,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2]) dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
PNGLIB_VERSION=1.6.10 PNGLIB_VERSION=1.6.11
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=6 PNGLIB_MINOR=6
PNGLIB_RELEASE=10 PNGLIB_RELEASE=11
dnl End of version number stuff dnl End of version number stuff

View File

@ -386,9 +386,9 @@ next_format(png_bytep colour_type, png_bytep bit_depth,
/* Palette images are restricted to 8 bit depth */ /* Palette images are restricted to 8 bit depth */
if (*bit_depth <= 8 if (*bit_depth <= 8
# ifdef DO_16BIT #ifdef DO_16BIT
|| (*colour_type != 3 && *bit_depth <= 16) || (*colour_type != 3 && *bit_depth <= 16)
# endif #endif
) )
return 1; return 1;
@ -3155,10 +3155,10 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
for (; i<256; ++i) for (; i<256; ++i)
tRNS[i] = 24; tRNS[i] = 24;
# ifdef PNG_WRITE_tRNS_SUPPORTED # ifdef PNG_WRITE_tRNS_SUPPORTED
if (j > 0) if (j > 0)
png_set_tRNS(pp, pi, tRNS, j, 0/*color*/); png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
# endif # endif
} }
} }
@ -6776,14 +6776,14 @@ image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this,
* conversion adds another +/-2 in the 16-bit case and * conversion adds another +/-2 in the 16-bit case and
* +/-(1<<(15-PNG_MAX_GAMMA_8)) in the 8-bit case. * +/-(1<<(15-PNG_MAX_GAMMA_8)) in the 8-bit case.
*/ */
that->pm->limit += pow( that->pm->limit +=
# if PNG_MAX_GAMMA_8 < 14 # if PNG_MAX_GAMMA_8 < 14
(that->this.bit_depth == 16 ? 8. : pow((that->this.bit_depth == 16 ?
6. + (1<<(15-PNG_MAX_GAMMA_8))) 8. : 6. + (1<<(15-PNG_MAX_GAMMA_8)))/65535, data.gamma);
# else # else
8. pow((that->this.bit_depth == 16 ?
# endif 8. : 8. + (1<<(15-PNG_MAX_GAMMA_8)))/65535, data.gamma);
/65535, data.gamma); # endif
} }
else else
@ -6801,13 +6801,12 @@ image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this,
* internal calculation errors, not the actual limit imposed by * internal calculation errors, not the actual limit imposed by
* pngvalid on the output errors. * pngvalid on the output errors.
*/ */
that->pm->limit += pow( that->pm->limit +=
# if DIGITIZE # if DIGITIZE
1.1 pow(1.1 /255, data.gamma);
# else # else
1. pow(1.0 /255, data.gamma);
# endif # endif
/255, data.gamma);
} }
} }

0
contrib/pngminus/png2pnm.bat Normal file → Executable file
View File

0
contrib/pngminus/png2pnm.sh Normal file → Executable file
View File

0
contrib/pngminus/pngminus.bat Normal file → Executable file
View File

0
contrib/pngminus/pngminus.sh Normal file → Executable file
View File

0
contrib/pngminus/pnm2png.bat Normal file → Executable file
View File

0
contrib/pngminus/pnm2png.sh Normal file → Executable file
View File

View File

@ -79,7 +79,7 @@
# error "pngfix not supported in this libpng version" # error "pngfix not supported in this libpng version"
#endif #endif
#if PNG_ZLIB_VERNUM >= 0x1240 #if ZLIB_VERNUM >= 0x1240
/* Copied from pngpriv.h */ /* Copied from pngpriv.h */
#ifdef __cplusplus #ifdef __cplusplus
@ -4014,16 +4014,16 @@ main(int argc, const char **argv)
return global_end(&global); return global_end(&global);
} }
#else /* PNG_ZLIB_VERNUM < 0x1240 */ #else /* ZLIB_VERNUM < 0x1240 */
int int
main(void) main(void)
{ {
fprintf(stderr, fprintf(stderr,
"pngfix needs libpng with a zlib >=1.2.4 (not 0x%x)\n", "pngfix needs libpng with a zlib >=1.2.4 (not 0x%x)\n",
PNG_ZLIB_VERNUM); ZLIB_VERNUM);
return 77; return 77;
} }
#endif /* PNG_ZLIB_VERNUM */ #endif /* ZLIB_VERNUM */
#else /* No read support */ #else /* No read support */

View File

@ -2,8 +2,8 @@
#if 0 /* in case someone actually tries to compile this */ #if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng /* example.c - an example of using libpng
* Last changed in libpng 1.6.3 [July 18, 2013] * Last changed in libpng 1.6.11 [June 5, 2014]
* Maintained 1998-2013 Glenn Randers-Pehrson * Maintained 1998-2014 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger) * Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* To the extent possible under law, the authors have waived * To the extent possible under law, the authors have waived
@ -970,7 +970,7 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_packswap(png_ptr); png_set_packswap(png_ptr);
/* Turn on interlace handling if you are not using png_write_image() */ /* Turn on interlace handling if you are not using png_write_image() */
if (interlacing) if (interlacing != 0)
number_passes = png_set_interlace_handling(png_ptr); number_passes = png_set_interlace_handling(png_ptr);
else else

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.10 - March 6, 2014 libpng version 1.6.11 - June 5, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014 libpng versions 0.97, January 1998, through 1.6.11 - June 5, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -54,7 +54,7 @@ This file describes how to use and modify the PNG reference library
file, example.c is a good starting point for using the library, as file, example.c is a good starting point for using the library, as
it is heavily commented and should include everything most people it is heavily commented and should include everything most people
will need. We assume that libpng is already installed; see the will need. We assume that libpng is already installed; see the
INSTALL file for instructions on how to install libpng. INSTALL file for instructions on how to configure and install libpng.
For examples of libpng usage, see the files "example.c", "pngtest.c", For examples of libpng usage, see the files "example.c", "pngtest.c",
and the files in the "contrib" directory, all of which are included in and the files in the "contrib" directory, all of which are included in
@ -2636,7 +2636,7 @@ png_infop info_ptr;
png_progressive_combine_row(png_ptr, old_row, png_progressive_combine_row(png_ptr, old_row,
new_row); new_row);
/* where old_row is what was displayed for /* where old_row is what was displayed
previously for the row. Note that the first previously for the row. Note that the first
pass (pass == 0, really) will completely cover pass (pass == 0, really) will completely cover
the old row, so the rows do not have to be the old row, so the rows do not have to be
@ -3793,8 +3793,9 @@ and matches the 8-bit format expected by typical display devices.
The color/gray channels are not scaled (pre-multiplied) by the alpha The color/gray channels are not scaled (pre-multiplied) by the alpha
channel and are suitable for passing to color management software. channel and are suitable for passing to color management software.
b) As a value in the range 0..65535, contained in a 2-byte integer. All b) As a value in the range 0..65535, contained in a 2-byte integer, in
channels can be converted to the original value by dividing by 65535; all the native byte order of the platform on which the application is running.
All channels can be converted to the original value by dividing by 65535; all
channels are linear. Color channels use the RGB encoding (RGB end-points) of channels are linear. Color channels use the RGB encoding (RGB end-points) of
the sRGB specification. This encoding is identified by the the sRGB specification. This encoding is identified by the
PNG_FORMAT_FLAG_LINEAR flag below. PNG_FORMAT_FLAG_LINEAR flag below.
@ -3861,7 +3862,9 @@ First the single byte formats:
Then the linear 2-byte formats. When naming these "Y" is used to Then the linear 2-byte formats. When naming these "Y" is used to
indicate a luminance (gray) channel. The component order within the pixel indicate a luminance (gray) channel. The component order within the pixel
is always the same - there is no provision for swapping the order of the is always the same - there is no provision for swapping the order of the
components in the linear format. components in the linear format. The components are 16-bit integers in
the native byte order for your platform, and there is no provision for
swapping the bytes to a different endian condition.
PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
PNG_FORMAT_LINEAR_Y_ALPHA PNG_FORMAT_LINEAR_Y_ALPHA
@ -3926,7 +3929,7 @@ First the information about the samples.
* *
* png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)]; * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)];
* *
* Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the * Alternatively, use the PNG_IMAGE_COLORMAP_SIZE macro below to use the
* information from one of the png_image_begin_read_ APIs and dynamically * information from one of the png_image_begin_read_ APIs and dynamically
* allocate the required memory. * allocate the required memory.
*/ */
@ -3955,9 +3958,16 @@ Information about the whole row, or whole image
row. For a color-mapped image this is the minimum number of bytes in a row. For a color-mapped image this is the minimum number of bytes in a
row. row.
If you need the stride measured in bytes, row_stride_bytes is
PNG_IMAGE_ROW_STRIDE(image) * PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)
plus any padding bytes that your application might need, for example
to start the next row on a 4-byte boundary.
PNG_IMAGE_BUFFER_SIZE(image, row_stride) PNG_IMAGE_BUFFER_SIZE(image, row_stride)
Returns the size, in bytes, of an image buffer given a png_image and a row Returns the size, in bytes, of an image buffer given a png_image and a row
stride - the number of components to leave space for in each row. stride - the number of components to leave space for in each row. This
macro takes care of multiplying row_stride by PNG_IMAGE_PIXEL_COMONENT_SIZE
when the image has 2-byte components.
PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01 PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01
This indicates the the RGB values of the in-memory bitmap do not This indicates the the RGB values of the in-memory bitmap do not
@ -4086,14 +4096,11 @@ clears the newly allocated memory to zero; note that png_calloc(png_ptr, size)
is not the same as the calloc(number, size) function provided by stdlib.h. is not the same as the calloc(number, size) function provided by stdlib.h.
There is limited support for certain systems with segmented memory There is limited support for certain systems with segmented memory
architectures and the types of pointers declared by png.h match this; you architectures and the types of pointers declared by png.h match this; you
will have to use appropriate pointers in your application. Since it is will have to use appropriate pointers in your application. If you prefer
unlikely that the method of handling memory allocation on a platform to use a different method of allocating and freeing data, you can use
will change between applications, these functions must be modified in png_create_read_struct_2() or png_create_write_struct_2() to register your
the library at compile time. If you prefer to use a different method own functions as described above. These functions also provide a void
of allocating and freeing data, you can use png_create_read_struct_2() or pointer that can be retrieved via
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); mem_ptr=png_get_mem_ptr(png_ptr);
@ -4236,29 +4243,6 @@ the simpler ones to get an idea of how they work. Try to find a similar
transformation to the one you want to add and copy off of it. More details transformation to the one you want to add and copy off of it. More details
can be found in the comments inside the code itself. can be found in the comments inside the code itself.
Configuring for 16-bit platforms
You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
Configuring for DOS
For DOS users who only have access to the lower 640K, you will
have to limit zlib's memory usage via a png_set_compression_mem_level()
call. See zlib.h or zconf.h in the zlib library for more information.
Configuring for Medium Model
Libpng's support for medium model has been tested on most of the popular
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
defined, and FAR gets defined to far in pngconf.h, and you should be
all set. Everything in the library (except for zlib's structure) is
expecting far data. You must use the typedefs with the p or pp on
the end for pointers (or at least look at them and be careful). Make
note that the rows of data are defined as png_bytepp, which is
an "unsigned char far * far *".
Configuring for gui/windowing platforms: Configuring for gui/windowing platforms:
You will need to write new error and warning functions that use the GUI You will need to write new error and warning functions that use the GUI
@ -4268,18 +4252,6 @@ in order to have them available during the structure initialization.
They can be changed later via png_set_error_fn(). On some compilers, They can be changed later via png_set_error_fn(). On some compilers,
you may also have to change the memory allocators (png_malloc, etc.). you may also have to change the memory allocators (png_malloc, etc.).
Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add, change
or delete an include, this is the place to do it.
The includes that are not needed outside libpng are placed in pngpriv.h,
which is only used by the routines inside libpng itself.
The files in libpng proper only include pngpriv.h and png.h, which
in turn includes pngconf.h and, as of libpng-1.5.0, pnglibconf.h.
As of libpng-1.5.0, pngpriv.h also includes three other private header
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
that previously appeared in the public headers.
Configuring zlib: Configuring zlib:
There are special functions to configure the compression. Perhaps the There are special functions to configure the compression. Perhaps the
@ -4321,6 +4293,8 @@ zlib.h for more information on what these mean.
png_set_compression_method(png_ptr, method); png_set_compression_method(png_ptr, method);
This controls the size of the IDAT chunks (default 8192):
png_set_compression_buffer_size(png_ptr, size); png_set_compression_buffer_size(png_ptr, size);
As of libpng version 1.5.4, additional APIs became As of libpng version 1.5.4, additional APIs became
@ -4419,46 +4393,6 @@ Note that the numbers above were invented purely for this example and
are given only to help explain the function usage. Little testing has are given only to help explain the function usage. Little testing has
been done to find optimum values for either the costs or the weights. been done to find optimum values for either the costs or the weights.
Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with
PNG_NO_.
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra
transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks. Use of the
PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
that is incapable of reading or writing ancillary chunks. If you are
not using the progressive reading capability, you can turn that off
with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
capability, which you'll still have).
All the reading and writing specific code are in separate files, so the
linker should only grab the files it needs. However, if you want to
make sure, or if you are building a stand alone library, all the
reading files start with "pngr" and all the writing files start with "pngw".
The files that don't match either (like png.c, pngtrans.c, etc.)
are used for both reading and writing, and always need to be included.
The progressive reader is in pngpread.c
If you are creating or distributing a dynamically linked library (a .so
or DLL file), you should not remove or disable any parts of the library,
as this will cause applications linked with different versions of the
library to fail if they call functions not available in your library.
The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory.
Requesting debug printout Requesting debug printout
The macro definition PNG_DEBUG can be used to request debugging The macro definition PNG_DEBUG can be used to request debugging
@ -4496,17 +4430,6 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
having level = 0 will be printed. There aren't any such statements 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. this version of libpng, but if you insert some they will be printed.
Prepending a prefix to exported symbols
Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the
configuration option "--with-libpng-prefix=FOO_", where FOO_ can be any
string beginning with a letter and containing only uppercase
and lowercase letters, digits, and the underscore (i.e., a C language
identifier). This creates a set of macros in pnglibconf.h, so this is
transparent to applications; their function calls get transformed by
the macros to use the modified names.
VII. MNG support VII. MNG support
The MNG specification (available at http://www.libpng.org/pub/mng) allows The MNG specification (available at http://www.libpng.org/pub/mng) allows
@ -4833,8 +4756,6 @@ does not account for any palette index used by ancillary chunks such as the
bKGD chunk; you must check those separately to determine the maximum bKGD chunk; you must check those separately to determine the maximum
palette index actually used. palette index actually used.
A. Changes that affect users of libpng
There are no substantial API changes between the non-deprecated parts of There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info, members of the main libpng control structures, png_struct and png_info,
@ -4973,26 +4894,6 @@ limits are now
The png_set_option() function (and the "options" member of the png struct) was The png_set_option() function (and the "options" member of the png struct) was
added to libpng-1.5.15. added to libpng-1.5.15.
B. Changes to the build and configuration of libpng
Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast
majority of library users or builders; however, the few who configure libpng
to a non-default feature set may need to change how this is done.
There should be no need for library builders to alter build scripts if
these use the distributed build support - configure or the makefiles -
however, users of the makefiles may care to update their build scripts
to build pnglibconf.h where the corresponding makefile does not do so.
Building libpng with a non-default configuration has changed completely.
The old method using pngusr.h should still work correctly even though the
way pngusr.h is used in the build has been changed; however, library
builders will probably want to examine the changes to take advantage of
new capabilities and to simplify their build system.
B.1 Specific changes to library configuration capabilities
The library now supports a complete fixed point implementation and can The library now supports a complete fixed point implementation and can
thus be used on systems that have no floating point support or very thus be used on systems that have no floating point support or very
limited or slow support. Previously gamma correction, an essential part limited or slow support. Previously gamma correction, an essential part
@ -5003,27 +4904,7 @@ independent of the choice of fixed versus floating point APIs and all the
missing fixed point APIs have been implemented. missing fixed point APIs have been implemented.
The exact mechanism used to control attributes of API functions has The exact mechanism used to control attributes of API functions has
changed. A single set of operating system independent macro definitions changed, as described in the INSTALL file.
is used and operating system specific directives are defined in
pnglibconf.h
As part of this the mechanism used to choose procedure call standards on
those systems that allow a choice has been changed. At present this only
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
running on Intel processors. As before, PNGAPI is defined where required
to control the exported API functions; however, two new macros, PNGCBAPI
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
(PNGCAPI) for functions that must match a C library prototype (currently
only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h
Despite these changes, libpng 1.5.0 only supports the native C function
calling standard on those platforms tested so far (__cdecl on Microsoft
Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list
(png-mng-implement) of this and library builders who use Openwatcom and
therefore set PNG_API_RULE to 2 should also contact the mailing list.
A new test program, pngvalid, is provided in addition to pngtest. A new test program, pngvalid, is provided in addition to pngtest.
pngvalid validates the arithmetic accuracy of the gamma correction pngvalid validates the arithmetic accuracy of the gamma correction
@ -5099,46 +4980,6 @@ even though the default is to use the macros - this allows applications
to choose at app buildtime whether or not to use macros (previously to choose at app buildtime whether or not to use macros (previously
impossible because the functions weren't in the default build.) impossible because the functions weren't in the default build.)
B.2 Changes to the configuration mechanism
Prior to libpng-1.5.0 library builders who needed to configure libpng
had either to modify the exported pngconf.h header file to add system
specific configuration or had to write feature selection macros into
pngusr.h and cause this to be included into pngconf.h by defining
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
application built without PNG_USER_CONFIG defined would see the
unmodified, default, libpng API and thus would probably fail to link.
These mechanisms still work in the configure build and in any makefile
build that builds pnglibconf.h, although the feature selection macros
have changed somewhat as described above. In 1.5.0, however, pngusr.h is
processed only once, when the exported header file pnglibconf.h is built.
pngconf.h no longer includes pngusr.h, therefore pngusr.h is ignored after the
build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
CPPFLAGS setting in the build also still works; however, the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
All configuration now only works if pnglibconf.h is built from
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
(the original author of awk) maintains C source code of that awk and this
and all known later implementations (often called by subtly different
names - nawk and gawk for example) are adequate to build pnglibconf.h.
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
and does not work; this may also apply to other systems that have a
functioning awk called 'nawk'.
Configuration options are now documented in scripts/pnglibconf.dfa. This
file also includes dependency information that ensures a configuration is
consistent; that is, if a feature is switched off dependent features are
also removed. As a recommended alternative to using feature macros in
pngusr.h a system builder may also define equivalent options in pngusr.dfa
(or, indeed, any file) and add that to the configuration by setting
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
how to do this, and a case where pngusr.h is still required.
XII. Changes to Libpng from version 1.5.x to 1.6.x XII. Changes to Libpng from version 1.5.x to 1.6.x
A "simplified API" has been added (see documentation in png.h and a simple A "simplified API" has been added (see documentation in png.h and a simple
@ -5197,11 +5038,25 @@ Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad reader now does pretty complete validation of the basic format. Some bad
profiles that were previously accepted are now accepted with a warning or profiles that were previously accepted are now accepted with a warning or
rejected, depending upon the png_set_benign_errors() setting, in particular the rejected, depending upon the png_set_benign_errors() setting, in particular the
very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
that only grayscale profiles may appear in images with color type 0 or 4 and libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
that even if the image only contains gray pixels, only RGB profiles may appear means of
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type. #ifdef PNG_SKIP_sRGB_CHECK_PROFILE
png_set_option(ping, PNG_SKIP_sRGB_CHECK_PROFILE,
PNG_OPTION_ON);
#endif
It's not a good idea to do this if you are using the "simplified API",
which needs to be able to recognize an sRGB profile conveyed via the iCCP
chunk.
The PNG spec requirement that only grayscale profiles may appear in images
with color type 0 or 4 and that even if the image only contains gray pixels,
only RGB profiles may appear in images with color type 2, 3, or 6, is now
enforced. The sRGB chunk is allowed to appear in images with any color type
and is interpreted by libpng to convey a one-tracer-curve profile or a
three-tracer-curve profile as appropriate.
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
an empty language field or an empty translated keyword. Both of these an empty language field or an empty translated keyword. Both of these
@ -5235,16 +5090,16 @@ Libpng-1.6.0 through 1.6.2 used the CMF bytes at the beginning of the IDAT
stream to set the size of the sliding window for reading instead of using the stream to set the size of the sliding window for reading instead of using the
default 32-kbyte sliding window size. It was discovered that there are default 32-kbyte sliding window size. It was discovered that there are
hundreds of PNG files in the wild that have incorrect CMF bytes that caused hundreds of PNG files in the wild that have incorrect CMF bytes that caused
libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and zlib to issue the "invalid distance too far back" error and reject the file.
later calculate their own safe CMF from the image dimensions, provide a way Libpng-1.6.3 and later calculate their own safe CMF from the image dimensions,
to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a provide a way to revert to the libpng-1.5.x behavior (ignoring the CMF bytes
32-kbyte sliding window), by using and using a 32-kbyte sliding window), by using
png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW, png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
PNG_OPTION_ON); PNG_OPTION_ON);
and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes and provide a tool (contrib/tools/pngfix) for rewriting a PNG file while
correctly. optimizing the CMF bytes in its IDAT chunk correctly.
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
length, which resulted in PNG files that cannot be read beyond the bad iTXt length, which resulted in PNG files that cannot be read beyond the bad iTXt
@ -5286,7 +5141,8 @@ mailing list, or directly to glennrp.
XV. Coding style XV. Coding style
Our coding style is similar to the "Allman" style, with curly Our coding style is similar to the "Allman" style
(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines: braces on separate lines:
if (condition) if (condition)
@ -5408,6 +5264,9 @@ with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
We prefer to use underscores in variable names rather than camelCase, except We prefer to use underscores in variable names rather than camelCase, except
for a few type names that we inherit from zlib.h. for a few type names that we inherit from zlib.h.
We prefer "if (something != 0)" and "if (something == 0)"
over "if (something)" and if "(!something)", respectively.
We do not use the TAB character for indentation in the C sources. We do not use the TAB character for indentation in the C sources.
Lines do not exceed 80 characters. Lines do not exceed 80 characters.
@ -5416,13 +5275,13 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng XVI. Y2K Compliance in libpng
March 6, 2014 June 5, 2014
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.6.10 are Y2K compliant. It is my belief that earlier upward through 1.6.11 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer Libpng only has two year fields. One is a 2-byte unsigned integer

277
libpng.3
View File

@ -1,6 +1,6 @@
.TH LIBPNG 3 "March 6, 2014" .TH LIBPNG 3 "June 5, 2014"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.10 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.11
.SH SYNOPSIS .SH SYNOPSIS
\fB \fB
#include <png.h>\fP #include <png.h>\fP
@ -504,7 +504,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.10 - March 6, 2014 libpng version 1.6.11 - June 5, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014 libpng versions 0.97, January 1998, through 1.6.11 - June 5, 2014
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -558,7 +558,7 @@ This file describes how to use and modify the PNG reference library
file, example.c is a good starting point for using the library, as file, example.c is a good starting point for using the library, as
it is heavily commented and should include everything most people it is heavily commented and should include everything most people
will need. We assume that libpng is already installed; see the will need. We assume that libpng is already installed; see the
INSTALL file for instructions on how to install libpng. INSTALL file for instructions on how to configure and install libpng.
For examples of libpng usage, see the files "example.c", "pngtest.c", For examples of libpng usage, see the files "example.c", "pngtest.c",
and the files in the "contrib" directory, all of which are included in and the files in the "contrib" directory, all of which are included in
@ -3140,7 +3140,7 @@ png_infop info_ptr;
png_progressive_combine_row(png_ptr, old_row, png_progressive_combine_row(png_ptr, old_row,
new_row); new_row);
/* where old_row is what was displayed for /* where old_row is what was displayed
previously for the row. Note that the first previously for the row. Note that the first
pass (pass == 0, really) will completely cover pass (pass == 0, really) will completely cover
the old row, so the rows do not have to be the old row, so the rows do not have to be
@ -4297,8 +4297,9 @@ and matches the 8-bit format expected by typical display devices.
The color/gray channels are not scaled (pre-multiplied) by the alpha The color/gray channels are not scaled (pre-multiplied) by the alpha
channel and are suitable for passing to color management software. channel and are suitable for passing to color management software.
b) As a value in the range 0..65535, contained in a 2-byte integer. All b) As a value in the range 0..65535, contained in a 2-byte integer, in
channels can be converted to the original value by dividing by 65535; all the native byte order of the platform on which the application is running.
All channels can be converted to the original value by dividing by 65535; all
channels are linear. Color channels use the RGB encoding (RGB end-points) of channels are linear. Color channels use the RGB encoding (RGB end-points) of
the sRGB specification. This encoding is identified by the the sRGB specification. This encoding is identified by the
PNG_FORMAT_FLAG_LINEAR flag below. PNG_FORMAT_FLAG_LINEAR flag below.
@ -4365,7 +4366,9 @@ First the single byte formats:
Then the linear 2-byte formats. When naming these "Y" is used to Then the linear 2-byte formats. When naming these "Y" is used to
indicate a luminance (gray) channel. The component order within the pixel indicate a luminance (gray) channel. The component order within the pixel
is always the same - there is no provision for swapping the order of the is always the same - there is no provision for swapping the order of the
components in the linear format. components in the linear format. The components are 16-bit integers in
the native byte order for your platform, and there is no provision for
swapping the bytes to a different endian condition.
PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
PNG_FORMAT_LINEAR_Y_ALPHA PNG_FORMAT_LINEAR_Y_ALPHA
@ -4430,7 +4433,7 @@ First the information about the samples.
* *
* png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)]; * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)];
* *
* Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the * Alternatively, use the PNG_IMAGE_COLORMAP_SIZE macro below to use the
* information from one of the png_image_begin_read_ APIs and dynamically * information from one of the png_image_begin_read_ APIs and dynamically
* allocate the required memory. * allocate the required memory.
*/ */
@ -4459,9 +4462,16 @@ Information about the whole row, or whole image
row. For a color-mapped image this is the minimum number of bytes in a row. For a color-mapped image this is the minimum number of bytes in a
row. row.
If you need the stride measured in bytes, row_stride_bytes is
PNG_IMAGE_ROW_STRIDE(image) * PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)
plus any padding bytes that your application might need, for example
to start the next row on a 4-byte boundary.
PNG_IMAGE_BUFFER_SIZE(image, row_stride) PNG_IMAGE_BUFFER_SIZE(image, row_stride)
Returns the size, in bytes, of an image buffer given a png_image and a row Returns the size, in bytes, of an image buffer given a png_image and a row
stride - the number of components to leave space for in each row. stride - the number of components to leave space for in each row. This
macro takes care of multiplying row_stride by PNG_IMAGE_PIXEL_COMONENT_SIZE
when the image has 2-byte components.
PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01 PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01
This indicates the the RGB values of the in-memory bitmap do not This indicates the the RGB values of the in-memory bitmap do not
@ -4590,14 +4600,11 @@ clears the newly allocated memory to zero; note that png_calloc(png_ptr, size)
is not the same as the calloc(number, size) function provided by stdlib.h. is not the same as the calloc(number, size) function provided by stdlib.h.
There is limited support for certain systems with segmented memory There is limited support for certain systems with segmented memory
architectures and the types of pointers declared by png.h match this; you architectures and the types of pointers declared by png.h match this; you
will have to use appropriate pointers in your application. Since it is will have to use appropriate pointers in your application. If you prefer
unlikely that the method of handling memory allocation on a platform to use a different method of allocating and freeing data, you can use
will change between applications, these functions must be modified in png_create_read_struct_2() or png_create_write_struct_2() to register your
the library at compile time. If you prefer to use a different method own functions as described above. These functions also provide a void
of allocating and freeing data, you can use png_create_read_struct_2() or pointer that can be retrieved via
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); mem_ptr=png_get_mem_ptr(png_ptr);
@ -4740,29 +4747,6 @@ the simpler ones to get an idea of how they work. Try to find a similar
transformation to the one you want to add and copy off of it. More details transformation to the one you want to add and copy off of it. More details
can be found in the comments inside the code itself. can be found in the comments inside the code itself.
.SS Configuring for 16-bit platforms
You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
.SS Configuring for DOS
For DOS users who only have access to the lower 640K, you will
have to limit zlib's memory usage via a png_set_compression_mem_level()
call. See zlib.h or zconf.h in the zlib library for more information.
.SS Configuring for Medium Model
Libpng's support for medium model has been tested on most of the popular
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
defined, and FAR gets defined to far in pngconf.h, and you should be
all set. Everything in the library (except for zlib's structure) is
expecting far data. You must use the typedefs with the p or pp on
the end for pointers (or at least look at them and be careful). Make
note that the rows of data are defined as png_bytepp, which is
an "unsigned char far * far *".
.SS Configuring for gui/windowing platforms: .SS Configuring for gui/windowing platforms:
You will need to write new error and warning functions that use the GUI You will need to write new error and warning functions that use the GUI
@ -4772,19 +4756,6 @@ in order to have them available during the structure initialization.
They can be changed later via png_set_error_fn(). On some compilers, They can be changed later via png_set_error_fn(). On some compilers,
you may also have to change the memory allocators (png_malloc, etc.). you may also have to change the memory allocators (png_malloc, etc.).
.SS Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add, change
or delete an include, this is the place to do it.
The includes that are not needed outside libpng are placed in pngpriv.h,
which is only used by the routines inside libpng itself.
The files in libpng proper only include pngpriv.h and png.h, which
%14%in turn includes pngconf.h.
in turn includes pngconf.h and, as of libpng-1.5.0, pnglibconf.h.
As of libpng-1.5.0, pngpriv.h also includes three other private header
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
that previously appeared in the public headers.
.SS Configuring zlib: .SS Configuring zlib:
There are special functions to configure the compression. Perhaps the There are special functions to configure the compression. Perhaps the
@ -4826,6 +4797,8 @@ zlib.h for more information on what these mean.
png_set_compression_method(png_ptr, method); png_set_compression_method(png_ptr, method);
This controls the size of the IDAT chunks (default 8192):
png_set_compression_buffer_size(png_ptr, size); png_set_compression_buffer_size(png_ptr, size);
As of libpng version 1.5.4, additional APIs became As of libpng version 1.5.4, additional APIs became
@ -4924,46 +4897,6 @@ Note that the numbers above were invented purely for this example and
are given only to help explain the function usage. Little testing has are given only to help explain the function usage. Little testing has
been done to find optimum values for either the costs or the weights. been done to find optimum values for either the costs or the weights.
.SS Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of
libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with
PNG_NO_.
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
You can also turn all of the transforms and ancillary chunk capabilities
off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra
transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks. Use of the
PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
that is incapable of reading or writing ancillary chunks. If you are
not using the progressive reading capability, you can turn that off
with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
capability, which you'll still have).
All the reading and writing specific code are in separate files, so the
linker should only grab the files it needs. However, if you want to
make sure, or if you are building a stand alone library, all the
reading files start with "pngr" and all the writing files start with "pngw".
The files that don't match either (like png.c, pngtrans.c, etc.)
are used for both reading and writing, and always need to be included.
The progressive reader is in pngpread.c
If you are creating or distributing a dynamically linked library (a .so
or DLL file), you should not remove or disable any parts of the library,
as this will cause applications linked with different versions of the
library to fail if they call functions not available in your library.
The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory.
.SS Requesting debug printout .SS Requesting debug printout
The macro definition PNG_DEBUG can be used to request debugging The macro definition PNG_DEBUG can be used to request debugging
@ -5001,17 +4934,6 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
having level = 0 will be printed. There aren't any such statements 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. this version of libpng, but if you insert some they will be printed.
.SS Prepending a prefix to exported symbols
Starting with libpng-1.6.0, you can configure libpng (when using the
"configure" script) to prefix all exported symbols by means of the
configuration option "\-\-with\-libpng\-prefix=FOO_", where FOO_ can be any
string beginning with a letter and containing only uppercase
and lowercase letters, digits, and the underscore (i.e., a C language
identifier). This creates a set of macros in pnglibconf.h, so this is
transparent to applications; their function calls get transformed by
the macros to use the modified names.
.SH VII. MNG support .SH VII. MNG support
The MNG specification (available at http://www.libpng.org/pub/mng) allows The MNG specification (available at http://www.libpng.org/pub/mng) allows
@ -5338,8 +5260,6 @@ does not account for any palette index used by ancillary chunks such as the
bKGD chunk; you must check those separately to determine the maximum bKGD chunk; you must check those separately to determine the maximum
palette index actually used. palette index actually used.
A. Changes that affect users of libpng
There are no substantial API changes between the non-deprecated parts of There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info, members of the main libpng control structures, png_struct and png_info,
@ -5478,26 +5398,6 @@ limits are now
The png_set_option() function (and the "options" member of the png struct) was The png_set_option() function (and the "options" member of the png struct) was
added to libpng-1.5.15. added to libpng-1.5.15.
B. Changes to the build and configuration of libpng
Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast
majority of library users or builders; however, the few who configure libpng
to a non-default feature set may need to change how this is done.
There should be no need for library builders to alter build scripts if
these use the distributed build support - configure or the makefiles -
however, users of the makefiles may care to update their build scripts
to build pnglibconf.h where the corresponding makefile does not do so.
Building libpng with a non-default configuration has changed completely.
The old method using pngusr.h should still work correctly even though the
way pngusr.h is used in the build has been changed; however, library
builders will probably want to examine the changes to take advantage of
new capabilities and to simplify their build system.
B.1 Specific changes to library configuration capabilities
The library now supports a complete fixed point implementation and can The library now supports a complete fixed point implementation and can
thus be used on systems that have no floating point support or very thus be used on systems that have no floating point support or very
limited or slow support. Previously gamma correction, an essential part limited or slow support. Previously gamma correction, an essential part
@ -5508,27 +5408,7 @@ independent of the choice of fixed versus floating point APIs and all the
missing fixed point APIs have been implemented. missing fixed point APIs have been implemented.
The exact mechanism used to control attributes of API functions has The exact mechanism used to control attributes of API functions has
changed. A single set of operating system independent macro definitions changed, as described in the INSTALL file.
is used and operating system specific directives are defined in
pnglibconf.h
As part of this the mechanism used to choose procedure call standards on
those systems that allow a choice has been changed. At present this only
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
running on Intel processors. As before, PNGAPI is defined where required
to control the exported API functions; however, two new macros, PNGCBAPI
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
(PNGCAPI) for functions that must match a C library prototype (currently
only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h
Despite these changes, libpng 1.5.0 only supports the native C function
calling standard on those platforms tested so far (__cdecl on Microsoft
Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list
(png-mng-implement) of this and library builders who use Openwatcom and
therefore set PNG_API_RULE to 2 should also contact the mailing list.
A new test program, pngvalid, is provided in addition to pngtest. A new test program, pngvalid, is provided in addition to pngtest.
pngvalid validates the arithmetic accuracy of the gamma correction pngvalid validates the arithmetic accuracy of the gamma correction
@ -5604,46 +5484,6 @@ even though the default is to use the macros - this allows applications
to choose at app buildtime whether or not to use macros (previously to choose at app buildtime whether or not to use macros (previously
impossible because the functions weren't in the default build.) impossible because the functions weren't in the default build.)
B.2 Changes to the configuration mechanism
Prior to libpng-1.5.0 library builders who needed to configure libpng
had either to modify the exported pngconf.h header file to add system
specific configuration or had to write feature selection macros into
pngusr.h and cause this to be included into pngconf.h by defining
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
application built without PNG_USER_CONFIG defined would see the
unmodified, default, libpng API and thus would probably fail to link.
These mechanisms still work in the configure build and in any makefile
build that builds pnglibconf.h, although the feature selection macros
have changed somewhat as described above. In 1.5.0, however, pngusr.h is
processed only once, when the exported header file pnglibconf.h is built.
pngconf.h no longer includes pngusr.h, therefore pngusr.h is ignored after the
build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
CPPFLAGS setting in the build also still works; however, the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
All configuration now only works if pnglibconf.h is built from
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
(the original author of awk) maintains C source code of that awk and this
and all known later implementations (often called by subtly different
names - nawk and gawk for example) are adequate to build pnglibconf.h.
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
and does not work; this may also apply to other systems that have a
functioning awk called 'nawk'.
Configuration options are now documented in scripts/pnglibconf.dfa. This
file also includes dependency information that ensures a configuration is
consistent; that is, if a feature is switched off dependent features are
also removed. As a recommended alternative to using feature macros in
pngusr.h a system builder may also define equivalent options in pngusr.dfa
(or, indeed, any file) and add that to the configuration by setting
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
how to do this, and a case where pngusr.h is still required.
.SH XII. Changes to Libpng from version 1.5.x to 1.6.x .SH XII. Changes to Libpng from version 1.5.x to 1.6.x
A "simplified API" has been added (see documentation in png.h and a simple A "simplified API" has been added (see documentation in png.h and a simple
@ -5702,11 +5542,25 @@ Error detection in some chunks has improved; in particular the iCCP chunk
reader now does pretty complete validation of the basic format. Some bad reader now does pretty complete validation of the basic format. Some bad
profiles that were previously accepted are now accepted with a warning or profiles that were previously accepted are now accepted with a warning or
rejected, depending upon the png_set_benign_errors() setting, in particular the rejected, depending upon the png_set_benign_errors() setting, in particular the
very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement very old broken Microsoft/HP 3144-byte sRGB profile. Starting with
that only grayscale profiles may appear in images with color type 0 or 4 and libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
that even if the image only contains gray pixels, only RGB profiles may appear means of
in images with color type 2, 3, or 6, is now enforced. The sRGB chunk
is allowed to appear in images with any color type. #ifdef PNG_SKIP_sRGB_CHECK_PROFILE
png_set_option(ping, PNG_SKIP_sRGB_CHECK_PROFILE,
PNG_OPTION_ON);
#endif
It's not a good idea to do this if you are using the "simplified API",
which needs to be able to recognize an sRGB profile conveyed via the iCCP
chunk.
The PNG spec requirement that only grayscale profiles may appear in images
with color type 0 or 4 and that even if the image only contains gray pixels,
only RGB profiles may appear in images with color type 2, 3, or 6, is now
enforced. The sRGB chunk is allowed to appear in images with any color type
and is interpreted by libpng to convey a one-tracer-curve profile or a
three-tracer-curve profile as appropriate.
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
an empty language field or an empty translated keyword. Both of these an empty language field or an empty translated keyword. Both of these
@ -5740,16 +5594,16 @@ Libpng-1.6.0 through 1.6.2 used the CMF bytes at the beginning of the IDAT
stream to set the size of the sliding window for reading instead of using the stream to set the size of the sliding window for reading instead of using the
default 32-kbyte sliding window size. It was discovered that there are default 32-kbyte sliding window size. It was discovered that there are
hundreds of PNG files in the wild that have incorrect CMF bytes that caused hundreds of PNG files in the wild that have incorrect CMF bytes that caused
libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and zlib to issue the "invalid distance too far back" error and reject the file.
later calculate their own safe CMF from the image dimensions, provide a way Libpng-1.6.3 and later calculate their own safe CMF from the image dimensions,
to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a provide a way to revert to the libpng-1.5.x behavior (ignoring the CMF bytes
32-kbyte sliding window), by using and using a 32-kbyte sliding window), by using
png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW, png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
PNG_OPTION_ON); PNG_OPTION_ON);
and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes and provide a tool (contrib/tools/pngfix) for rewriting a PNG file while
correctly. optimizing the CMF bytes in its IDAT chunk correctly.
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
length, which resulted in PNG files that cannot be read beyond the bad iTXt length, which resulted in PNG files that cannot be read beyond the bad iTXt
@ -5791,7 +5645,8 @@ mailing list, or directly to glennrp.
.SH XV. Coding style .SH XV. Coding style
Our coding style is similar to the "Allman" style, with curly Our coding style is similar to the "Allman" style
(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines: braces on separate lines:
if (condition) if (condition)
@ -5913,6 +5768,9 @@ with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
We prefer to use underscores in variable names rather than camelCase, except We prefer to use underscores in variable names rather than camelCase, except
for a few type names that we inherit from zlib.h. for a few type names that we inherit from zlib.h.
We prefer "if (something != 0)" and "if (something == 0)"
over "if (something)" and if "(!something)", respectively.
We do not use the TAB character for indentation in the C sources. We do not use the TAB character for indentation in the C sources.
Lines do not exceed 80 characters. Lines do not exceed 80 characters.
@ -5921,13 +5779,13 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVI. Y2K Compliance in libpng .SH XVI. Y2K Compliance in libpng
March 6, 2014 June 5, 2014
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.6.10 are Y2K compliant. It is my belief that earlier upward through 1.6.11 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer Libpng only has two year fields. One is a 2-byte unsigned integer
@ -6159,8 +6017,11 @@ the first widely used release:
1.6.9rc01-02 16 10609 16.so.16.9[.0] 1.6.9rc01-02 16 10609 16.so.16.9[.0]
1.6.9 16 10609 16.so.16.9[.0] 1.6.9 16 10609 16.so.16.9[.0]
1.6.10beta01-03 16 10610 16.so.16.10[.0] 1.6.10beta01-03 16 10610 16.so.16.10[.0]
1.6.10rc01-04 16 10610 16.so.16.10[.0] 1.6.10rc01-03 16 10610 16.so.16.10[.0]
1.6.10 16 10610 16.so.16.10[.0] 1.6.10 16 10610 16.so.16.10[.0]
1.6.11beta01-06 16 10611 16.so.16.11[.0]
1.6.11rc01-02 16 10611 16.so.16.11[.0]
1.6.11 16 10611 16.so.16.11[.0]
Henceforth the source version will match the shared-library minor Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be and patch numbers; the shared-library major version number will be
@ -6217,7 +6078,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.6.10 - March 6, 2014: Libpng version 1.6.11 - June 5, 2014:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -6240,8 +6101,8 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are libpng versions 1.2.6, August 15, 2004, through 1.6.11, June 5, 2014, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2014 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -6339,7 +6200,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
March 6, 2014 June 5, 2014
.\" end of man page .\" end of man page

View File

@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "March 6, 2014" .TH LIBPNGPF 3 "June 5, 2014"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.10 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.11
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include \fI"pngpriv.h" \fB#include \fI"pngpriv.h"

2
png.5
View File

@ -1,4 +1,4 @@
.TH PNG 5 "March 6, 2014" .TH PNG 5 "June 5, 2014"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

115
png.c
View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.6.9 [February 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -14,7 +14,7 @@
#include "pngpriv.h" #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_10 Your_png_h_is_not_version_1_6_10; typedef png_libpng_version_1_6_11 Your_png_h_is_not_version_1_6_11;
/* Tells libpng that we have already handled the first "num_bytes" bytes /* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another * of the PNG file signature. If the PNG data is embedded into another
@ -165,7 +165,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
int int
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver) png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
{ {
if (user_png_ver) if (user_png_ver != NULL)
{ {
int i = 0; int i = 0;
@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.10 - March 6, 2014" PNG_STRING_NEWLINE \ "libpng version 1.6.11 - June 5, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.10 - March 6, 2014\ return "libpng version 1.6.11 - June 5, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -1558,10 +1558,10 @@ png_colorspace_check_xy(png_XYZ *XYZ, const png_xy *xy)
/* As a side-effect this routine also returns the XYZ endpoints. */ /* As a side-effect this routine also returns the XYZ endpoints. */
result = png_XYZ_from_xy(XYZ, xy); result = png_XYZ_from_xy(XYZ, xy);
if (result) return result; if (result != 0) return result;
result = png_xy_from_XYZ(&xy_test, XYZ); result = png_xy_from_XYZ(&xy_test, XYZ);
if (result) return result; if (result != 0) return result;
if (png_colorspace_endpoints_match(xy, &xy_test, if (png_colorspace_endpoints_match(xy, &xy_test,
5/*actually, the math is pretty accurate*/)) 5/*actually, the math is pretty accurate*/))
@ -1581,10 +1581,10 @@ png_colorspace_check_XYZ(png_xy *xy, png_XYZ *XYZ)
png_XYZ XYZtemp; png_XYZ XYZtemp;
result = png_XYZ_normalize(XYZ); result = png_XYZ_normalize(XYZ);
if (result) return result; if (result != 0) return result;
result = png_xy_from_XYZ(xy, XYZ); result = png_xy_from_XYZ(xy, XYZ);
if (result) return result; if (result != 0) return result;
XYZtemp = *XYZ; XYZtemp = *XYZ;
return png_colorspace_check_xy(&XYZtemp, xy); return png_colorspace_check_xy(&XYZtemp, xy);
@ -1625,7 +1625,7 @@ png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
} }
/* Only overwrite with preferred values */ /* Only overwrite with preferred values */
if (!preferred) if (preferred == 0)
return 1; /* ok, but no change */ return 1; /* ok, but no change */
} }
@ -1906,10 +1906,6 @@ png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
return png_icc_profile_error(png_ptr, colorspace, name, profile_length, return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"too short"); "too short");
if (profile_length & 3)
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"invalid length");
return 1; return 1;
} }
@ -1930,6 +1926,11 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
return png_icc_profile_error(png_ptr, colorspace, name, temp, return png_icc_profile_error(png_ptr, colorspace, name, temp,
"length does not match profile"); "length does not match profile");
temp = (png_uint_32) (*(profile+8));
if (temp > 3 && (profile_length & 3))
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"invalid length");
temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */ temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */ if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
profile_length < 132+12*temp) /* truncated tag table */ profile_length < 132+12*temp) /* truncated tag table */
@ -2044,7 +2045,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
"invalid embedded Abstract ICC profile"); "invalid embedded Abstract ICC profile");
case 0x6C696E6B: /* 'link' */ case 0x6C696E6B: /* 'link' */
/* DeviceLink profiles cannnot be interpreted in a non-device specific /* DeviceLink profiles cannot be interpreted in a non-device specific
* fashion, if an app uses the AToB0Tag in the profile the results are * fashion, if an app uses the AToB0Tag in the profile the results are
* undefined unless the result is sent to the intended device, * undefined unless the result is sent to the intended device,
* therefore a DeviceLink profile should not be found embedded in a * therefore a DeviceLink profile should not be found embedded in a
@ -2055,7 +2056,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
case 0x6E6D636C: /* 'nmcl' */ case 0x6E6D636C: /* 'nmcl' */
/* A NamedColor profile is also device specific, however it doesn't /* A NamedColor profile is also device specific, however it doesn't
* contain an AToB0 tag that is open to misintrepretation. Almost * contain an AToB0 tag that is open to misinterpretation. Almost
* certainly it will fail the tests below. * certainly it will fail the tests below.
*/ */
(void)png_icc_profile_error(png_ptr, NULL, name, temp, (void)png_icc_profile_error(png_ptr, NULL, name, temp,
@ -2136,7 +2137,7 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
return 1; /* success, maybe with warnings */ return 1; /* success, maybe with warnings */
} }
#ifdef PNG_sRGB_SUPPORTED #if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
/* Information about the known ICC sRGB profiles */ /* Information about the known ICC sRGB profiles */
static const struct static const struct
{ {
@ -2210,11 +2211,18 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
* by sRGB (but maybe defined by a later ICC specification) the read of * by sRGB (but maybe defined by a later ICC specification) the read of
* the profile will fail at that point. * the profile will fail at that point.
*/ */
/* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
PNG_OPTION_ON)
return 0;
png_uint_32 length = 0; png_uint_32 length = 0;
png_uint_32 intent = 0x10000; /* invalid */ png_uint_32 intent = 0x10000; /* invalid */
#if PNG_sRGB_PROFILE_CHECKS > 1 #if PNG_sRGB_PROFILE_CHECKS > 1
uLong crc = 0; /* the value for 0 length data */ uLong crc = 0; /* the value for 0 length data */
#endif #endif
unsigned int i; unsigned int i;
for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i) for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)
@ -2294,7 +2302,6 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
return 1+png_sRGB_checks[i].is_broken; return 1+png_sRGB_checks[i].is_broken;
} }
} }
}
# if PNG_sRGB_PROFILE_CHECKS > 0 # if PNG_sRGB_PROFILE_CHECKS > 0
/* The signature matched, but the profile had been changed in some /* The signature matched, but the profile had been changed in some
@ -2306,6 +2313,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
PNG_CHUNK_WARNING); PNG_CHUNK_WARNING);
break; break;
# endif # endif
}
} }
} }
@ -2321,7 +2329,9 @@ png_icc_set_sRGB(png_const_structrp png_ptr,
/* Is this profile one of the known ICC sRGB profiles? If it is, just set /* Is this profile one of the known ICC sRGB profiles? If it is, just set
* the sRGB information. * the sRGB information.
*/ */
#if PNG_sRGB_PROFILE_CHECKS >= 0
if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler)) if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler))
#endif
(void)png_colorspace_set_sRGB(png_ptr, colorspace, (void)png_colorspace_set_sRGB(png_ptr, colorspace,
(int)/*already checked*/png_get_uint_32(profile+64)); (int)/*already checked*/png_get_uint_32(profile+64));
} }
@ -2435,45 +2445,46 @@ png_check_IHDR(png_const_structrp png_ptr,
png_warning(png_ptr, "Image width is zero in IHDR"); png_warning(png_ptr, "Image width is zero in IHDR");
error = 1; error = 1;
} }
else if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
else
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max)
# else
if (width > PNG_USER_WIDTH_MAX)
# endif
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
}
if (height == 0) if (height == 0)
{ {
png_warning(png_ptr, "Image height is zero in IHDR"); png_warning(png_ptr, "Image height is zero in IHDR");
error = 1; error = 1;
} }
else if (height > PNG_UINT_31_MAX)
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max)
# else
if (width > PNG_USER_WIDTH_MAX)
# endif
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max)
# else
if (height > PNG_USER_HEIGHT_MAX)
# endif
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
if (height > PNG_UINT_31_MAX)
{ {
png_warning(png_ptr, "Invalid image height in IHDR"); png_warning(png_ptr, "Invalid image height in IHDR");
error = 1; error = 1;
} }
else
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max)
# else
if (height > PNG_USER_HEIGHT_MAX)
# endif
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
}
/* Check other values */ /* Check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
@ -2738,7 +2749,7 @@ png_pow10(int power)
} }
while (power > 0); while (power > 0);
if (recip) d = 1/d; if (recip != 0) d = 1/d;
} }
/* else power is 0 and d is 1 */ /* else power is 0 and d is 1 */
@ -3261,7 +3272,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
if (s00 >= (D >> 1)) if (s00 >= (D >> 1))
++result; ++result;
if (negative) if (negative != 0)
result = -result; result = -result;
/* Check for overflow. */ /* Check for overflow. */
@ -3788,7 +3799,7 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5); double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5);
sub_table[j] = (png_uint_16)d; sub_table[j] = (png_uint_16)d;
# else # else
if (shift) if (shift != 0)
ig = (ig * 65535U + max_by_2)/max; ig = (ig * 65535U + max_by_2)/max;
sub_table[j] = png_gamma_16bit_correct(ig, gamma_val); sub_table[j] = png_gamma_16bit_correct(ig, gamma_val);
@ -3804,7 +3815,7 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
{ {
png_uint_32 ig = (j << (8-shift)) + i; png_uint_32 ig = (j << (8-shift)) + i;
if (shift) if (shift != 0)
ig = (ig * 65535U + max_by_2)/max; ig = (ig * 65535U + max_by_2)/max;
sub_table[j] = (png_uint_16)ig; sub_table[j] = (png_uint_16)ig;
@ -4092,7 +4103,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
} }
#endif /* READ_GAMMA */ #endif /* READ_GAMMA */
/* HARDWARE OPTION SUPPORT */ /* HARDWARE OR SOFTWARE OPTION SUPPORT */
#ifdef PNG_SET_OPTION_SUPPORTED #ifdef PNG_SET_OPTION_SUPPORTED
int PNGAPI int PNGAPI
png_set_option(png_structrp png_ptr, int option, int onoff) png_set_option(png_structrp png_ptr, int option, int onoff)

38
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.6.10 - March 6, 2014 * libpng version 1.6.11 - June 5, 2014
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014: Glenn * libpng versions 0.97, January 1998, through 1.6.11 - June 5, 2014: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -193,8 +193,11 @@
* 1.6.9rc01-02 16 10609 16.so.16.9[.0] * 1.6.9rc01-02 16 10609 16.so.16.9[.0]
* 1.6.9 16 10609 16.so.16.9[.0] * 1.6.9 16 10609 16.so.16.9[.0]
* 1.6.10beta01-03 16 10610 16.so.16.10[.0] * 1.6.10beta01-03 16 10610 16.so.16.10[.0]
* 1.6.10betarc01-04 16 10610 16.so.16.10[.0] * 1.6.10rc01-03 16 10610 16.so.16.10[.0]
* 1.6.10beta 16 10610 16.so.16.10[.0] * 1.6.10 16 10610 16.so.16.10[.0]
* 1.6.11beta01-06 16 10611 16.so.16.11[.0]
* 1.6.11rc01-02 16 10611 16.so.16.11[.0]
* 1.6.11 16 10611 16.so.16.11[.0]
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@ -226,7 +229,7 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are * libpng versions 1.2.6, August 15, 2004, through 1.6.11, June 5, 2014, are
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -338,13 +341,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* March 6, 2014 * June 5, 2014
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.6.10 are Y2K compliant. It is my belief that * upward through 1.6.11 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant. * earlier versions were also Y2K compliant.
* *
* Libpng only has two year fields. One is a 2-byte unsigned integer * Libpng only has two year fields. One is a 2-byte unsigned integer
@ -397,16 +400,18 @@
/* This is not the place to learn how to use libpng. The file libpng-manual.txt /* This is not the place to learn how to use libpng. The file libpng-manual.txt
* describes how to use libpng, and the file example.c summarizes it * describes how to use libpng, and the file example.c summarizes it
* with some code on which to build. This file is useful for looking * with some code on which to build. This file is useful for looking
* at the actual function definitions and structure components. * at the actual function definitions and structure components. If that
* file has been stripped from your copy of libpng, you can find it at
* <http://www.libpng.org/pub/png/libpng-manual.txt>
* *
* If you just need to read a PNG file and don't want to read the documentation * If you just need to read a PNG file and don't want to read the documentation
* skip to the end of this file and read the section entitled 'simplified API'. * skip to the end of this file and read the section entitled 'simplified API'.
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.10" #define PNG_LIBPNG_VER_STRING "1.6.11"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.10 - March 6, 2014\n" " libpng version 1.6.11 - June 5, 2014\n"
#define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_DLLNUM 16
@ -414,7 +419,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6 #define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 10 #define PNG_LIBPNG_VER_RELEASE 11
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@ -445,7 +450,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/ */
#define PNG_LIBPNG_VER 10610 /* 1.6.10 */ #define PNG_LIBPNG_VER 10611 /* 1.6.11 */
/* Library configuration: these options cannot be changed after /* Library configuration: these options cannot be changed after
* the library has been built. * the library has been built.
@ -550,7 +555,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef char* png_libpng_version_1_6_10; typedef char* png_libpng_version_1_6_11;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
* *
@ -1849,7 +1854,6 @@ PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
*/ */
PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Function that combines rows. 'new_row' is a flag that should come from /* Function that combines rows. 'new_row' is a flag that should come from
* the callback and be non-NULL if anything needs to be done; the library * the callback and be non-NULL if anything needs to be done; the library
* stores its own version of the new data internally and ignores the passed * stores its own version of the new data internally and ignores the passed
@ -1857,7 +1861,6 @@ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
*/ */
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr, PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
png_bytep old_row, png_const_bytep new_row)); png_bytep old_row, png_const_bytep new_row));
#endif /* PNG_READ_INTERLACING_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr, PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
@ -3225,7 +3228,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
#endif #endif
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ #define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */ /* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
@ -3238,7 +3242,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
#endif #endif
/******************************************************************************* /*******************************************************************************
* END OF HARDWARE OPTIONS * END OF HARDWARE AND SOFTWARE OPTIONS
******************************************************************************/ ******************************************************************************/
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project /* Maintainer: Put new public prototypes here ^, in libpng.3, and project

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.6.10 - March 6, 2014 * libpng version 1.6.11 - June 5, 2014
* *
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -195,7 +195,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
* drop the decimal point. If the number is a true zero handle that * drop the decimal point. If the number is a true zero handle that
* here. * here.
*/ */
if (output) if (output != 0)
*--end = '.'; *--end = '.';
else if (number == 0) /* and !output */ else if (number == 0) /* and !output */
*--end = '0'; *--end = '0';
@ -759,6 +759,9 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr) if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val); png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(val)
#endif #endif
/* If control reaches this point, png_longjmp() must not return. The only /* If control reaches this point, png_longjmp() must not return. The only
@ -939,7 +942,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
saved_error_buf = image->opaque->error_buf; saved_error_buf = image->opaque->error_buf;
result = setjmp(safe_jmpbuf) == 0; result = setjmp(safe_jmpbuf) == 0;
if (result) if (result != 0)
{ {
image->opaque->error_buf = safe_jmpbuf; image->opaque->error_buf = safe_jmpbuf;
@ -949,7 +952,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
image->opaque->error_buf = saved_error_buf; image->opaque->error_buf = saved_error_buf;
/* And do the cleanup prior to any failure return. */ /* And do the cleanup prior to any failure return. */
if (!result) if (result == 0)
png_image_free(image); png_image_free(image);
return result; return result;

View File

@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.6.1 [March 28, 2013] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -124,6 +124,9 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
return (info_ptr->x_pixels_per_unit); return (info_ptr->x_pixels_per_unit);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -142,6 +145,9 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
return (info_ptr->y_pixels_per_unit); return (info_ptr->y_pixels_per_unit);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -159,6 +165,9 @@ png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit) info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
return (info_ptr->x_pixels_per_unit); return (info_ptr->x_pixels_per_unit);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -229,6 +238,9 @@ png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
return (info_ptr->x_offset); return (info_ptr->x_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -245,6 +257,9 @@ png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
return (info_ptr->y_offset); return (info_ptr->y_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -261,6 +276,9 @@ png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
return (info_ptr->x_offset); return (info_ptr->x_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -277,6 +295,9 @@ png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
return (info_ptr->y_offset); return (info_ptr->y_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -49,7 +49,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
/* It's easiest for the caller if we do the save, then the caller doesn't /* It's easiest for the caller if we do the save, then the caller doesn't
* have to supply the same data again: * have to supply the same data again:
*/ */
if (save) if (save != 0)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
else else
{ {
@ -979,15 +979,15 @@ png_push_process_row(png_structrp png_ptr)
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */ /* Expand interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{ {
if (png_ptr->pass < 6) if (png_ptr->pass < 6)
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
png_ptr->transformations); png_ptr->transformations);
switch (png_ptr->pass) switch (png_ptr->pass)
{ {
case 0: case 0:
{ {
int i; int i;
@ -1154,7 +1154,6 @@ png_push_process_row(png_structrp png_ptr)
} }
} }
else else
#endif
{ {
png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_push_have_row(png_ptr, png_ptr->row_buf + 1);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
@ -1164,7 +1163,6 @@ png_push_process_row(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_push_finish_row(png_structrp png_ptr) png_read_push_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@ -1189,7 +1187,6 @@ png_read_push_finish_row(png_structrp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
@ -1224,7 +1221,6 @@ png_read_push_finish_row(png_structrp png_ptr)
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
} }
void /* PRIVATE */ void /* PRIVATE */
@ -1249,7 +1245,6 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
(int)png_ptr->pass); (int)png_ptr->pass);
} }
#ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI void PNGAPI
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
png_const_bytep new_row) png_const_bytep new_row)
@ -1262,9 +1257,8 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
* it must be png_ptr->row_buf+1 * it must be png_ptr->row_buf+1
*/ */
if (new_row != NULL) if (new_row != NULL)
png_combine_row(png_ptr, old_row, 1/*display*/); png_combine_row(png_ptr, old_row, 1/*blocky display*/);
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
void PNGAPI void PNGAPI
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr, png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,

View File

@ -6,7 +6,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.10 [March 6, 1014]]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -822,7 +822,7 @@
* zlib version number and because this affects handling of certain broken * zlib version number and because this affects handling of certain broken
* PNG files the -I directives must match. * PNG files the -I directives must match.
* *
* The most likely explanation is that you passed a -I in CFLAGS, this will * The most likely explanation is that you passed a -I in CFLAGS. This will
* not work; all the preprocessor directories and in particular all the -I * not work; all the preprocessor directories and in particular all the -I
* directives must be in CPPFLAGS. * directives must be in CPPFLAGS.
*/ */

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -572,7 +572,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
png_error(png_ptr, "internal sequential row size calculation error"); png_error(png_ptr, "internal sequential row size calculation error");
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */ /* Expand interlaced rows to full size */
if (png_ptr->interlaced && if (png_ptr->interlaced &&
(png_ptr->transformations & PNG_INTERLACE)) (png_ptr->transformations & PNG_INTERLACE))
{ {
@ -1788,7 +1788,7 @@ png_create_colormap_entry(png_image_read_control *display,
/* This is set if the color isn't gray but the output is. */ /* This is set if the color isn't gray but the output is. */
if (encoding == P_LINEAR) if (encoding == P_LINEAR)
{ {
if (convert_to_Y) if (convert_to_Y != 0)
{ {
/* NOTE: these values are copied from png_do_rgb_to_gray */ /* NOTE: these values are copied from png_do_rgb_to_gray */
png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green + png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
@ -3317,11 +3317,11 @@ png_image_read_composite(png_voidp argument)
* PNG_COMPOSITE * PNG_COMPOSITE
* PNG_GAMMA * PNG_GAMMA
* *
* This is a work-round for the fact that both the PNG_RGB_TO_GRAY and * This is a work-around for the fact that both the PNG_RGB_TO_GRAY and
* PNG_COMPOSITE code performs gamma correction, so we get double gamma * PNG_COMPOSITE code performs gamma correction, so we get double gamma
* correction. The fix-up is to prevent the PNG_COMPOSITE operation happening * correction. The fix-up is to prevent the PNG_COMPOSITE operation from
* inside libpng, so this routine sees an 8 or 16-bit gray+alpha row and handles * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha
* the removal or pre-multiplication of the alpha channel. * row and handles the removal or pre-multiplication of the alpha channel.
*/ */
static int static int
png_image_read_background(png_voidp argument) png_image_read_background(png_voidp argument)
@ -3586,7 +3586,7 @@ png_image_read_background(png_voidp argument)
component = 0; component = 0;
outrow[swap_alpha] = (png_uint_16)component; outrow[swap_alpha] = (png_uint_16)component;
if (preserve_alpha) if (preserve_alpha != 0)
outrow[1 ^ swap_alpha] = alpha; outrow[1 ^ swap_alpha] = alpha;
inrow += 2; /* components and alpha channel */ inrow += 2; /* components and alpha channel */
@ -3679,7 +3679,7 @@ png_image_read_direct(png_voidp argument)
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default); png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default);
} }
if (linear) if (linear != 0)
{ {
/* If there *is* an alpha channel in the input it must be multiplied /* If there *is* an alpha channel in the input it must be multiplied
* out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG. * out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
@ -3705,7 +3705,7 @@ png_image_read_direct(png_voidp argument)
* *
* TODO: fix libpng and remove this. * TODO: fix libpng and remove this.
*/ */
if (do_local_background) if (do_local_background != 0)
{ {
png_fixed_point gtest; png_fixed_point gtest;
@ -3753,11 +3753,11 @@ png_image_read_direct(png_voidp argument)
* *
* TODO: fix libpng and remove this. * TODO: fix libpng and remove this.
*/ */
if (do_local_background) if (do_local_background != 0)
do_local_background = 2/*required*/; do_local_background = 2/*required*/;
/* 16-bit output: just remove the channel */ /* 16-bit output: just remove the channel */
else if (linear) /* compose on black (well, pre-multiply) */ else if (linear != 0) /* compose on black (well, pre-multiply) */
png_set_strip_alpha(png_ptr); png_set_strip_alpha(png_ptr);
/* 8-bit output: do an appropriate compose */ /* 8-bit output: do an appropriate compose */
@ -3804,7 +3804,7 @@ png_image_read_direct(png_voidp argument)
png_uint_32 filler; /* opaque filler */ png_uint_32 filler; /* opaque filler */
int where; int where;
if (linear) if (linear != 0)
filler = 65535; filler = 65535;
else else
@ -3877,7 +3877,7 @@ png_image_read_direct(png_voidp argument)
/* If the *output* is 16-bit then we need to check for a byte-swap on this /* If the *output* is 16-bit then we need to check for a byte-swap on this
* architecture. * architecture.
*/ */
if (linear) if (linear != 0)
{ {
PNG_CONST png_uint_16 le = 0x0001; PNG_CONST png_uint_16 le = 0x0001;
@ -3886,7 +3886,7 @@ png_image_read_direct(png_voidp argument)
} }
/* If change is not now 0 some transformation is missing - error out. */ /* If change is not now 0 some transformation is missing - error out. */
if (change) if (change != 0)
png_error(png_ptr, "png_read_image: unsupported transformation"); png_error(png_ptr, "png_read_image: unsupported transformation");
} }
@ -3898,7 +3898,7 @@ png_image_read_direct(png_voidp argument)
* *
* TODO: remove the do_local_background fixup below. * TODO: remove the do_local_background fixup below.
*/ */
if (!do_local_compose && do_local_background != 2) if (do_local_compose == 0 && do_local_background != 2)
passes = png_set_interlace_handling(png_ptr); passes = png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info_ptr); png_read_update_info(png_ptr, info_ptr);
@ -3912,7 +3912,7 @@ png_image_read_direct(png_voidp argument)
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
{ {
/* do_local_compose removes this channel below. */ /* do_local_compose removes this channel below. */
if (!do_local_compose) if (do_local_compose == 0)
{ {
/* do_local_background does the same if required. */ /* do_local_background does the same if required. */
if (do_local_background != 2 || if (do_local_background != 2 ||
@ -3921,7 +3921,7 @@ png_image_read_direct(png_voidp argument)
} }
} }
else if (do_local_compose) /* internal error */ else if (do_local_compose != 0) /* internal error */
png_error(png_ptr, "png_image_read: alpha channel lost"); png_error(png_ptr, "png_image_read: alpha channel lost");
if (info_ptr->bit_depth == 16) if (info_ptr->bit_depth == 16)
@ -3964,7 +3964,7 @@ png_image_read_direct(png_voidp argument)
png_voidp first_row = display->buffer; png_voidp first_row = display->buffer;
ptrdiff_t row_bytes = display->row_stride; ptrdiff_t row_bytes = display->row_stride;
if (linear) if (linear != 0)
row_bytes *= 2; row_bytes *= 2;
/* The following expression is designed to work correctly whether it gives /* The following expression is designed to work correctly whether it gives
@ -3981,7 +3981,7 @@ png_image_read_direct(png_voidp argument)
display->row_bytes = row_bytes; display->row_bytes = row_bytes;
} }
if (do_local_compose) if (do_local_compose != 0)
{ {
int result; int result;
png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -143,7 +143,7 @@ png_set_background_fixed(png_structrp png_ptr,
png_ptr->background = *background_color; png_ptr->background = *background_color;
png_ptr->background_gamma = background_gamma; png_ptr->background_gamma = background_gamma;
png_ptr->background_gamma_type = (png_byte)(background_gamma_code); png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
if (need_expand) if (need_expand != 0)
png_ptr->transformations |= PNG_BACKGROUND_EXPAND; png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
else else
png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND; png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
@ -226,7 +226,7 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
# else # else
PNG_UNUSED(png_ptr) PNG_UNUSED(png_ptr)
# endif # endif
if (is_screen) if (is_screen != 0)
output_gamma = PNG_GAMMA_sRGB; output_gamma = PNG_GAMMA_sRGB;
else else
output_gamma = PNG_GAMMA_sRGB_INVERSE; output_gamma = PNG_GAMMA_sRGB_INVERSE;
@ -235,7 +235,7 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
else if (output_gamma == PNG_GAMMA_MAC_18 || else if (output_gamma == PNG_GAMMA_MAC_18 ||
output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18) output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18)
{ {
if (is_screen) if (is_screen != 0)
output_gamma = PNG_GAMMA_MAC_OLD; output_gamma = PNG_GAMMA_MAC_OLD;
else else
output_gamma = PNG_GAMMA_MAC_INVERSE; output_gamma = PNG_GAMMA_MAC_INVERSE;
@ -363,7 +363,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
/* Finally, if pre-multiplying, set the background fields to achieve the /* Finally, if pre-multiplying, set the background fields to achieve the
* desired result. * desired result.
*/ */
if (compose) if (compose != 0)
{ {
/* And obtain alpha pre-multiplication by composing on black: */ /* And obtain alpha pre-multiplication by composing on black: */
memset(&png_ptr->background, 0, (sizeof png_ptr->background)); memset(&png_ptr->background, 0, (sizeof png_ptr->background));
@ -420,7 +420,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
png_ptr->transformations |= PNG_QUANTIZE; png_ptr->transformations |= PNG_QUANTIZE;
if (!full_quantize) if (full_quantize == 0)
{ {
int i; int i;
@ -475,12 +475,12 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
} }
} }
if (done) if (done != 0)
break; break;
} }
/* Swap the palette around, and set up a table, if necessary */ /* Swap the palette around, and set up a table, if necessary */
if (full_quantize) if (full_quantize != 0)
{ {
int j = num_palette; int j = num_palette;
@ -663,7 +663,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
num_new_palette--; num_new_palette--;
palette[png_ptr->index_to_palette[j]] palette[png_ptr->index_to_palette[j]]
= palette[num_new_palette]; = palette[num_new_palette];
if (!full_quantize) if (full_quantize == 0)
{ {
int k; int k;
@ -731,7 +731,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
} }
png_ptr->num_palette = (png_uint_16)num_palette; png_ptr->num_palette = (png_uint_16)num_palette;
if (full_quantize) if (full_quantize != 0)
{ {
int i; int i;
png_bytep distance; png_bytep distance;
@ -1131,7 +1131,7 @@ png_init_palette_transformations(png_structrp png_ptr)
} }
/* If no alpha we can optimize. */ /* If no alpha we can optimize. */
if (!input_has_alpha) if (input_has_alpha == 0)
{ {
/* Any alpha means background and associative alpha processing is /* Any alpha means background and associative alpha processing is
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
@ -1140,7 +1140,7 @@ png_init_palette_transformations(png_structrp png_ptr)
png_ptr->transformations &= ~PNG_ENCODE_ALPHA; png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA; png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
if (!input_has_transparency) if (input_has_transparency == 0)
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND); png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
} }
@ -1196,7 +1196,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
int input_has_transparency = png_ptr->num_trans > 0; int input_has_transparency = png_ptr->num_trans > 0;
/* If no alpha we can optimize. */ /* If no alpha we can optimize. */
if (!input_has_alpha) if (input_has_alpha == 0)
{ {
/* Any alpha means background and associative alpha processing is /* Any alpha means background and associative alpha processing is
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
@ -1207,7 +1207,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA; png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
# endif # endif
if (!input_has_transparency) if (input_has_transparency == 0)
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND); png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
} }
@ -1336,7 +1336,7 @@ png_init_read_transformations(png_structrp png_ptr)
* the code immediately below if the transform can be handled outside the * the code immediately below if the transform can be handled outside the
* row loop. * row loop.
*/ */
if (gamma_correction) if (gamma_correction != 0)
png_ptr->transformations |= PNG_GAMMA; png_ptr->transformations |= PNG_GAMMA;
else else
@ -1743,11 +1743,11 @@ png_init_read_transformations(png_structrp png_ptr)
g_sig = png_gamma_significant(g); g_sig = png_gamma_significant(g);
gs_sig = png_gamma_significant(gs); gs_sig = png_gamma_significant(gs);
if (g_sig) if (g_sig != 0)
png_ptr->background_1.gray = png_gamma_correct(png_ptr, png_ptr->background_1.gray = png_gamma_correct(png_ptr,
png_ptr->background.gray, g); png_ptr->background.gray, g);
if (gs_sig) if (gs_sig != 0)
png_ptr->background.gray = png_gamma_correct(png_ptr, png_ptr->background.gray = png_gamma_correct(png_ptr,
png_ptr->background.gray, gs); png_ptr->background.gray, gs);
@ -1756,7 +1756,7 @@ png_init_read_transformations(png_structrp png_ptr)
(png_ptr->background.red != png_ptr->background.gray)) (png_ptr->background.red != png_ptr->background.gray))
{ {
/* RGB or RGBA with color background */ /* RGB or RGBA with color background */
if (g_sig) if (g_sig != 0)
{ {
png_ptr->background_1.red = png_gamma_correct(png_ptr, png_ptr->background_1.red = png_gamma_correct(png_ptr,
png_ptr->background.red, g); png_ptr->background.red, g);
@ -1768,7 +1768,7 @@ png_init_read_transformations(png_structrp png_ptr)
png_ptr->background.blue, g); png_ptr->background.blue, g);
} }
if (gs_sig) if (gs_sig != 0)
{ {
png_ptr->background.red = png_gamma_correct(png_ptr, png_ptr->background.red = png_gamma_correct(png_ptr,
png_ptr->background.red, gs); png_ptr->background.red, gs);
@ -2118,7 +2118,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_ptr->info_rowbytes = info_ptr->rowbytes; png_ptr->info_rowbytes = info_ptr->rowbytes;
#ifndef PNG_READ_EXPAND_SUPPORTED #ifndef PNG_READ_EXPAND_SUPPORTED
if (png_ptr) if (png_ptr != NULL)
return; return;
#endif #endif
} }
@ -2277,7 +2277,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
have_shift = 1; have_shift = 1;
} }
if (!have_shift) if (have_shift == 0)
return; return;
} }
@ -3038,7 +3038,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
*(dp++) = red; *(dp++) = red;
} }
if (have_alpha) if (have_alpha != 0)
*(dp++) = *(sp++); *(dp++) = *(sp++);
} }
} }
@ -3067,7 +3067,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
else else
*(dp++) = red; *(dp++) = red;
if (have_alpha) if (have_alpha != 0)
*(dp++) = *(sp++); *(dp++) = *(sp++);
} }
} }
@ -3119,7 +3119,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)((w>>8) & 0xff); *(dp++) = (png_byte)((w>>8) & 0xff);
*(dp++) = (png_byte)(w & 0xff); *(dp++) = (png_byte)(w & 0xff);
if (have_alpha) if (have_alpha != 0)
{ {
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
@ -3153,7 +3153,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)((gray16>>8) & 0xff); *(dp++) = (png_byte)((gray16>>8) & 0xff);
*(dp++) = (png_byte)(gray16 & 0xff); *(dp++) = (png_byte)(gray16 & 0xff);
if (have_alpha) if (have_alpha != 0)
{ {
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
@ -3221,7 +3221,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 7; shift = 7;
sp++; sp++;
@ -3260,7 +3260,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 6; shift = 6;
sp++; sp++;
@ -3286,7 +3286,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 6; shift = 6;
sp++; sp++;
@ -3326,7 +3326,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 4; shift = 4;
sp++; sp++;
@ -3352,7 +3352,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 4; shift = 4;
sp++; sp++;
@ -3605,7 +3605,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_to_1[*sp]; v = gamma_to_1[*sp];
png_composite(w, v, a, png_ptr->background_1.gray); png_composite(w, v, a, png_ptr->background_1.gray);
if (!optimize) if (optimize == 0)
w = gamma_from_1[w]; w = gamma_from_1[w];
*sp = w; *sp = w;
} }
@ -3662,7 +3662,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
png_composite_16(v, g, a, png_ptr->background_1.gray); png_composite_16(v, g, a, png_ptr->background_1.gray);
if (optimize) if (optimize != 0)
w = v; w = v;
else else
w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8]; w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
@ -3736,17 +3736,17 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_to_1[*sp]; v = gamma_to_1[*sp];
png_composite(w, v, a, png_ptr->background_1.red); png_composite(w, v, a, png_ptr->background_1.red);
if (!optimize) w = gamma_from_1[w]; if (optimize == 0) w = gamma_from_1[w];
*sp = w; *sp = w;
v = gamma_to_1[*(sp + 1)]; v = gamma_to_1[*(sp + 1)];
png_composite(w, v, a, png_ptr->background_1.green); png_composite(w, v, a, png_ptr->background_1.green);
if (!optimize) w = gamma_from_1[w]; if (optimize == 0) w = gamma_from_1[w];
*(sp + 1) = w; *(sp + 1) = w;
v = gamma_to_1[*(sp + 2)]; v = gamma_to_1[*(sp + 2)];
png_composite(w, v, a, png_ptr->background_1.blue); png_composite(w, v, a, png_ptr->background_1.blue);
if (!optimize) w = gamma_from_1[w]; if (optimize == 0) w = gamma_from_1[w];
*(sp + 2) = w; *(sp + 2) = w;
} }
} }
@ -3828,7 +3828,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
png_composite_16(w, v, a, png_ptr->background_1.red); png_composite_16(w, v, a, png_ptr->background_1.red);
if (!optimize) if (optimize == 0)
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
8]; 8];
*sp = (png_byte)((w >> 8) & 0xff); *sp = (png_byte)((w >> 8) & 0xff);
@ -3836,7 +3836,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
png_composite_16(w, v, a, png_ptr->background_1.green); png_composite_16(w, v, a, png_ptr->background_1.green);
if (!optimize) if (optimize == 0)
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
8]; 8];
@ -3845,7 +3845,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
png_composite_16(w, v, a, png_ptr->background_1.blue); png_composite_16(w, v, a, png_ptr->background_1.blue);
if (!optimize) if (optimize == 0)
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
8]; 8];
@ -4763,7 +4763,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
png_do_rgb_to_gray(png_ptr, row_info, png_do_rgb_to_gray(png_ptr, row_info,
png_ptr->row_buf + 1); png_ptr->row_buf + 1);
if (rgb_error) if (rgb_error != 0)
{ {
png_ptr->rgb_to_gray_status=1; png_ptr->rgb_to_gray_status=1;
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -265,7 +265,7 @@ png_crc_error(png_structrp png_ptr)
/* The chunk CRC must be serialized in a single I/O call. */ /* The chunk CRC must be serialized in a single I/O call. */
png_read_data(png_ptr, crc_bytes, 4); png_read_data(png_ptr, crc_bytes, 4);
if (need_crc) if (need_crc != 0)
{ {
crc = png_get_uint_32(crc_bytes); crc = png_get_uint_32(crc_bytes);
return ((int)(crc != png_ptr->crc)); return ((int)(crc != png_ptr->crc));
@ -311,7 +311,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
else if (warn < 2) /* else silent */ else if (warn < 2) /* else silent */
{ {
if (warn) if (warn != 0)
png_chunk_warning(png_ptr, "insufficient memory to read chunk"); png_chunk_warning(png_ptr, "insufficient memory to read chunk");
else else
@ -637,7 +637,7 @@ png_decompress_chunk(png_structrp png_ptr,
{ {
if (new_size == *newlength) if (new_size == *newlength)
{ {
if (terminate) if (terminate != 0)
text[prefix_size + *newlength] = 0; text[prefix_size + *newlength] = 0;
if (prefix_size > 0) if (prefix_size > 0)
@ -1558,7 +1558,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
errmsg = "too many profiles"; errmsg = "too many profiles";
/* Failure: the reason is in 'errmsg' */ /* Failure: the reason is in 'errmsg' */
if (!finished) if (finished == 0)
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID; png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
@ -2672,7 +2672,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
buffer[uncompressed_length+prefix_length] = 0; buffer[uncompressed_length+prefix_length] = 0;
if (compressed) if (compressed != 0)
text.compression = PNG_ITXT_COMPRESSION_NONE; text.compression = PNG_ITXT_COMPRESSION_NONE;
else else
@ -3153,7 +3153,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
# define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\ # define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) } S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
# define B_MASKS(d,s) { B_MASK(1,d,s), S_MASK(3,d,s), S_MASK(5,d,s) } # define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
# define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2)) # define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
@ -3192,7 +3192,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
#endif /* !PNG_USE_COMPILE_TIME_MASKS */ #endif /* !PNG_USE_COMPILE_TIME_MASKS */
/* Use the appropriate mask to copy the required bits. In some cases /* Use the appropriate mask to copy the required bits. In some cases
* the byte mask will be 0 or 0xff, optimize these cases. row_width is * the byte mask will be 0 or 0xff; optimize these cases. row_width is
* the number of pixels, but the code copies bytes, so it is necessary * the number of pixels, but the code copies bytes, so it is necessary
* to special case the end. * to special case the end.
*/ */
@ -3264,7 +3264,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
} }
/* Work out the bytes to copy. */ /* Work out the bytes to copy. */
if (display) if (display != 0)
{ {
/* When doing the 'block' algorithm the pixel in the pass gets /* When doing the 'block' algorithm the pixel in the pass gets
* replicated to adjacent pixels. This is why the even (0,2,4,6) * replicated to adjacent pixels. This is why the even (0,2,4,6)
@ -3464,7 +3464,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
/* Here if pixel_depth < 8 to check 'end_ptr' below. */ /* Here if pixel_depth < 8 to check 'end_ptr' below. */
} }
else else
#endif #endif /* PNG_READ_INTERLACING_SUPPORTED */
/* If here then the switch above wasn't used so just memcpy the whole row /* If here then the switch above wasn't used so just memcpy the whole row
* from the temporary row buffer (notice that this overwrites the end of the * from the temporary row buffer (notice that this overwrites the end of the
@ -4114,7 +4114,6 @@ png_read_finish_IDAT(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_finish_row(png_structrp png_ptr) png_read_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@ -4128,14 +4127,12 @@ png_read_finish_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif /* PNG_READ_INTERLACING_SUPPORTED */
png_debug(1, "in png_read_finish_row"); png_debug(1, "in png_read_finish_row");
png_ptr->row_number++; png_ptr->row_number++;
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
@ -4173,7 +4170,6 @@ png_read_finish_row(png_structrp png_ptr)
if (png_ptr->pass < 7) if (png_ptr->pass < 7)
return; return;
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
/* Here after at the end of the last row of the last pass. */ /* Here after at the end of the last row of the last pass. */
png_read_finish_IDAT(png_ptr); png_read_finish_IDAT(png_ptr);
@ -4183,7 +4179,6 @@ png_read_finish_row(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_start_row(png_structrp png_ptr) png_read_start_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@ -4197,7 +4192,6 @@ png_read_start_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
int max_pixel_depth; int max_pixel_depth;
png_size_t row_bytes; png_size_t row_bytes;
@ -4207,7 +4201,6 @@ png_read_start_row(png_structrp png_ptr)
#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_TRANSFORMS_SUPPORTED
png_init_read_transformations(png_ptr); png_init_read_transformations(png_ptr);
#endif #endif
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
if (!(png_ptr->transformations & PNG_INTERLACE)) if (!(png_ptr->transformations & PNG_INTERLACE))
@ -4224,7 +4217,6 @@ png_read_start_row(png_structrp png_ptr)
} }
else else
#endif /* PNG_READ_INTERLACING_SUPPORTED */
{ {
png_ptr->num_rows = png_ptr->height; png_ptr->num_rows = png_ptr->height;
png_ptr->iwidth = png_ptr->width; png_ptr->iwidth = png_ptr->width;

View File

@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.6.8 [December 19, 2013] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -637,7 +637,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
png_colorspace_sync_info(png_ptr, info_ptr); png_colorspace_sync_info(png_ptr, info_ptr);
/* Don't do any of the copying if the profile was bad, or inconsistent. */ /* Don't do any of the copying if the profile was bad, or inconsistent. */
if (!result) if (result == 0)
return; return;
/* But do write the gAMA and cHRM chunks from the profile. */ /* But do write the gAMA and cHRM chunks from the profile. */
@ -686,7 +686,7 @@ png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
int ret; int ret;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
if (ret) if (ret != 0)
png_error(png_ptr, "Insufficient memory to store text"); png_error(png_ptr, "Insufficient memory to store text");
} }
@ -855,7 +855,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
textp->text = textp->key + key_len + 1; textp->text = textp->key + key_len + 1;
} }
if (text_length) if (text_length != 0)
memcpy(textp->text, text_ptr[i].text, text_length); memcpy(textp->text, text_ptr[i].text, text_length);
*(textp->text + text_length) = '\0'; *(textp->text + text_length) = '\0';
@ -1353,7 +1353,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
* required because add_one_chunk above doesn't extend the list if the 'keep' * required because add_one_chunk above doesn't extend the list if the 'keep'
* parameter is the default. * parameter is the default.
*/ */
if (keep) if (keep != 0)
{ {
new_list = png_voidcast(png_bytep, png_malloc(png_ptr, new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
5 * (num_chunks + old_num_chunks))); 5 * (num_chunks + old_num_chunks)));
@ -1449,7 +1449,7 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
info_ptr->row_pointers = row_pointers; info_ptr->row_pointers = row_pointers;
if (row_pointers) if (row_pointers != NULL)
info_ptr->valid |= PNG_INFO_IDAT; info_ptr->valid |= PNG_INFO_IDAT;
} }
#endif #endif
@ -1536,7 +1536,7 @@ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
void PNGAPI void PNGAPI
png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max) png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
{ {
if (png_ptr) if (png_ptr != NULL)
png_ptr->user_chunk_cache_max = user_chunk_cache_max; png_ptr->user_chunk_cache_max = user_chunk_cache_max;
} }
@ -1545,7 +1545,7 @@ void PNGAPI
png_set_chunk_malloc_max (png_structrp png_ptr, png_set_chunk_malloc_max (png_structrp png_ptr,
png_alloc_size_t user_chunk_malloc_max) png_alloc_size_t user_chunk_malloc_max)
{ {
if (png_ptr) if (png_ptr != NULL)
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max; png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
} }
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
@ -1563,7 +1563,7 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
* is the default behavior if png_set_benign_errors() is not called). * is the default behavior if png_set_benign_errors() is not called).
*/ */
if (allowed) if (allowed != 0)
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN | png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN; PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;

View File

@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* Last changed in libpng 1.6.9 [February 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -359,7 +359,7 @@ pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
default: default:
err = 1; /* uninitialized */ err = 1; /* uninitialized */
} }
if (err) if (err != 0)
png_error(png_ptr, "Bad I/O state or buffer size"); png_error(png_ptr, "Bad I/O state or buffer size");
} }
#endif #endif
@ -540,7 +540,7 @@ PNGCBAPI png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
/* Make sure the caller isn't assuming zeroed memory. */ /* Make sure the caller isn't assuming zeroed memory. */
memset(pinfo->pointer, 0xdd, pinfo->size); memset(pinfo->pointer, 0xdd, pinfo->size);
if (verbose) if (verbose != 0)
printf("png_malloc %lu bytes at %p\n", (unsigned long)size, printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
pinfo->pointer); pinfo->pointer);
@ -580,7 +580,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* We must free the list element too, but first kill /* We must free the list element too, but first kill
the memory that is to be freed. */ the memory that is to be freed. */
memset(ptr, 0x55, pinfo->size); memset(ptr, 0x55, pinfo->size);
if (pinfo) if (pinfo != NULL)
free(pinfo); free(pinfo);
pinfo = NULL; pinfo = NULL;
break; break;
@ -597,10 +597,10 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
} }
/* Finally free the data. */ /* Finally free the data. */
if (verbose) if (verbose != 0)
printf("Freeing %p\n", ptr); printf("Freeing %p\n", ptr);
if (ptr) if (ptr != NULL)
free(ptr); free(ptr);
ptr = NULL; ptr = NULL;
} }
@ -734,7 +734,7 @@ write_sTER_chunk(png_structp write_ptr)
{ {
png_byte sTER[5] = {115, 84, 69, 82, '\0'}; png_byte sTER[5] = {115, 84, 69, 82, '\0'};
if (verbose) if (verbose != 0)
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode); fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1); png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
@ -747,7 +747,7 @@ write_vpAg_chunk(png_structp write_ptr)
png_byte vpag_chunk_data[9]; png_byte vpag_chunk_data[9];
if (verbose) if (verbose != 0)
fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n", fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
(unsigned long)user_chunk_data.vpAg_width, (unsigned long)user_chunk_data.vpAg_width,
(unsigned long)user_chunk_data.vpAg_height, (unsigned long)user_chunk_data.vpAg_height,
@ -938,7 +938,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
#endif #endif
if (strict) if (strict != 0)
{ {
/* Treat png_benign_error() as errors on read */ /* Treat png_benign_error() as errors on read */
png_set_benign_errors(read_ptr, 0); png_set_benign_errors(read_ptr, 0);
@ -954,7 +954,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
*/ */
} }
else if (relaxed) else if (relaxed != 0)
{ {
/* Allow application (pngtest) errors and warnings to pass */ /* Allow application (pngtest) errors and warnings to pass */
png_set_benign_errors(read_ptr, 1); png_set_benign_errors(read_ptr, 1);
@ -1254,7 +1254,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
pngtest_check_text_support(read_ptr, text_ptr, num_text); pngtest_check_text_support(read_ptr, text_ptr, num_text);
if (verbose) if (verbose != 0)
{ {
int i; int i;
@ -1320,7 +1320,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr, int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
&unknowns); &unknowns);
if (num_unknowns) if (num_unknowns != 0)
{ {
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns, png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
num_unknowns); num_unknowns);
@ -1436,7 +1436,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
pngtest_check_text_support(read_ptr, text_ptr, num_text); pngtest_check_text_support(read_ptr, text_ptr, num_text);
if (verbose) if (verbose != 0)
{ {
int i; int i;
@ -1480,7 +1480,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr, int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
&unknowns); &unknowns);
if (num_unknowns) if (num_unknowns != 0)
{ {
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns, png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
num_unknowns); num_unknowns);
@ -1521,7 +1521,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
#ifdef PNG_EASY_ACCESS_SUPPORTED #ifdef PNG_EASY_ACCESS_SUPPORTED
if (verbose) if (verbose != 0)
{ {
png_uint_32 iwidth, iheight; png_uint_32 iwidth, iheight;
iwidth = png_get_image_width(write_ptr, write_info_ptr); iwidth = png_get_image_width(write_ptr, write_info_ptr);
@ -1599,7 +1599,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
} }
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */ #ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
if (interlace_preserved) /* else the files will be changed */ if (interlace_preserved != 0) /* else the files will be changed */
{ {
for (;;) for (;;)
{ {
@ -1638,7 +1638,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (0); return (0);
} }
if (!num_in) if (num_in == 0)
break; break;
if (memcmp(inbuf, outbuf, num_in)) if (memcmp(inbuf, outbuf, num_in))
@ -1795,7 +1795,7 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
if (multiple) if (multiple != 0)
{ {
int i; int i;
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
@ -1991,4 +1991,4 @@ main(void)
#endif #endif
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_10 Your_png_h_is_not_version_1_6_10; typedef png_libpng_version_1_6_11 Your_png_h_is_not_version_1_6_11;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.6.9 [February 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -327,9 +327,16 @@ png_do_swap(png_row_infop row_info, png_bytep row)
for (i = 0; i < istop; i++, rp += 2) for (i = 0; i < istop; i++, rp += 2)
{ {
#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
/* Feature added to libpng-1.6.11 for testing purposes, not
* enabled by default.
*/
*(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
#else
png_byte t = *rp; png_byte t = *rp;
*rp = *(rp + 1); *rp = *(rp + 1);
*(rp + 1) = t; *(rp + 1) = t;
#endif
} }
} }
} }
@ -503,7 +510,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 2, ++dp; sp += 2, ++dp;
@ -517,7 +524,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 4, dp += 2; sp += 4, dp += 2;
@ -543,7 +550,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 4, dp += 3; sp += 4, dp += 3;
@ -557,7 +564,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 8, dp += 6; sp += 8, dp += 6;

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -432,6 +432,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
/* Write end of PNG file */ /* Write end of PNG file */
png_write_IEND(png_ptr); png_write_IEND(png_ptr);
/* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
* and restored again in libpng-1.2.30, may cause some applications that * and restored again in libpng-1.2.30, may cause some applications that
* do not set png_ptr->output_flush_fn to crash. If your application * do not set png_ptr->output_flush_fn to crash. If your application
@ -479,7 +480,7 @@ png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr, png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, NULL, NULL, NULL); error_fn, warn_fn, NULL, NULL, NULL);
#else #else
return png_create_write_struct_2(user_png_ver, error_ptr, error_fn, return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
warn_fn, NULL, NULL, NULL); warn_fn, NULL, NULL, NULL);
@ -492,7 +493,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr, png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn); error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -525,10 +526,10 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
* applications that must not fail to write at all costs! * applications that must not fail to write at all costs!
*/ */
#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED #ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
/* In stable builds only warn if an application error can be completely /* In stable builds only warn if an application error can be completely
* handled. * handled.
*/ */
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
#endif #endif
/* App warnings are warnings in release (or release candidate) builds but /* App warnings are warnings in release (or release candidate) builds but
@ -826,7 +827,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
{ {
png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass); png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
/* This should always get caught above, but still ... */ /* This should always get caught above, but still ... */
if (!(row_info.width)) if (row_info.width == 0)
{ {
png_write_finish_row(png_ptr); png_write_finish_row(png_ptr);
return; return;
@ -2177,7 +2178,7 @@ png_image_write_main(png_voidp argument)
* write an interlaced image. * write an interlaced image.
*/ */
if (write_16bit) if (write_16bit != 0)
{ {
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */ /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR); png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
@ -2209,7 +2210,7 @@ png_image_write_main(png_voidp argument)
* *
* First check for a little endian system if writing 16 bit files. * First check for a little endian system if writing 16 bit files.
*/ */
if (write_16bit) if (write_16bit != 0)
{ {
PNG_CONST png_uint_16 le = 0x0001; PNG_CONST png_uint_16 le = 0x0001;
@ -2250,7 +2251,7 @@ png_image_write_main(png_voidp argument)
png_const_bytep row = png_voidcast(png_const_bytep, display->buffer); png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
ptrdiff_t row_bytes = display->row_stride; ptrdiff_t row_bytes = display->row_stride;
if (linear) if (linear != 0)
row_bytes *= (sizeof (png_uint_16)); row_bytes *= (sizeof (png_uint_16));
if (row_bytes < 0) if (row_bytes < 0)
@ -2283,7 +2284,7 @@ png_image_write_main(png_voidp argument)
int result; int result;
display->local_row = row; display->local_row = row;
if (write_16bit) if (write_16bit != 0)
result = png_safe_execute(image, png_write_image_16bit, display); result = png_safe_execute(image, png_write_image_16bit, display);
else else
result = png_safe_execute(image, png_write_image_8bit, display); result = png_safe_execute(image, png_write_image_8bit, display);
@ -2292,7 +2293,7 @@ png_image_write_main(png_voidp argument)
png_free(png_ptr, row); png_free(png_ptr, row);
/* Skip the 'write_end' on error: */ /* Skip the 'write_end' on error: */
if (!result) if (result == 0)
return 0; return 0;
} }

View File

@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.6.2 [April 25, 2013] * Last changed in libpng 1.6.11 [June 5, 2014]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -699,7 +699,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/)) if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
*new_key++ = ch, ++key_len, space = 0; *new_key++ = ch, ++key_len, space = 0;
else if (!space) else if (space == 0)
{ {
/* A space or an invalid character when one wasn't seen immediately /* A space or an invalid character when one wasn't seen immediately
* before; output just a space. * before; output just a space.
@ -711,14 +711,14 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
bad_character = ch; bad_character = ch;
} }
else if (!bad_character) else if (bad_character == 0)
bad_character = ch; /* just skip it, record the first error */ bad_character = ch; /* just skip it, record the first error */
} }
if (key_len > 0 && space) /* trailing space */ if (key_len > 0 && space) /* trailing space */
{ {
--key_len, --new_key; --key_len, --new_key;
if (!bad_character) if (bad_character == 0)
bad_character = 32; bad_character = 32;
} }
@ -732,7 +732,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
if (*key) /* keyword too long */ if (*key) /* keyword too long */
png_warning(png_ptr, "keyword truncated"); png_warning(png_ptr, "keyword truncated");
else if (bad_character) else if (bad_character != 0)
{ {
PNG_WARNING_PARAMETERS(p) PNG_WARNING_PARAMETERS(p)
@ -898,7 +898,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
/* Write the chunk */ /* Write the chunk */
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13); png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
if (!(png_ptr->do_filter)) if ((png_ptr->do_filter) == PNG_NO_FILTERS)
{ {
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
png_ptr->bit_depth < 8) png_ptr->bit_depth < 8)
@ -1193,6 +1193,7 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
png_uint_32 profile_len; png_uint_32 profile_len;
png_byte new_name[81]; /* 1 byte for the compression byte */ png_byte new_name[81]; /* 1 byte for the compression byte */
compression_state comp; compression_state comp;
png_uint_32 temp;
png_debug(1, "in png_write_iCCP"); png_debug(1, "in png_write_iCCP");
@ -1207,7 +1208,8 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
if (profile_len < 132) if (profile_len < 132)
png_error(png_ptr, "ICC profile too short"); png_error(png_ptr, "ICC profile too short");
if (profile_len & 0x03) temp = (png_uint_32) (*(profile+8));
if (temp > 3 && (profile_len & 0x03))
png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)"); png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)");
{ {
@ -1608,7 +1610,7 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
*/ */
png_write_chunk_data(png_ptr, new_key, key_len + 1); png_write_chunk_data(png_ptr, new_key, key_len + 1);
if (text_len) if (text_len != 0)
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len); png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
png_write_chunk_end(png_ptr); png_write_chunk_end(png_ptr);
@ -1734,7 +1736,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text)); png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
if (compression) if (compression != 0)
{ {
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK) if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
png_error(png_ptr, png_ptr->zstream.msg); png_error(png_ptr, png_ptr->zstream.msg);
@ -1757,7 +1759,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len); png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
if (compression) if (compression != 0)
png_write_compressed_data_out(png_ptr, &comp); png_write_compressed_data_out(png_ptr, &comp);
else else

View File

@ -1,7 +1,7 @@
VisualStudio instructions VisualStudio instructions
libpng version 1.6.10 - March 6, 2014 libpng version 1.6.11 - June 5, 2014
Copyright (c) 1998-2010 Glenn Randers-Pehrson Copyright (c) 1998-2010 Glenn Randers-Pehrson

View File

@ -2,7 +2,7 @@
<!-- <!--
* zlib.props - location of zlib source * zlib.props - location of zlib source
* *
* libpng version 1.6.10 - March 6, 2014 * libpng version 1.6.11 - June 5, 2014
* *
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* *
@ -24,7 +24,7 @@
source. source.
If you use a relative directory name (as below) then it must be If you use a relative directory name (as below) then it must be
relative to the project directories; these are one level deepers than relative to the project directories; these are one level deeper than
the directories containing this file. the directories containing this file.
If the version of zlib you use does not match that used when the If the version of zlib you use does not match that used when the
@ -32,7 +32,7 @@
versions do not match. The zlib version used in this build is recorded versions do not match. The zlib version used in this build is recorded
below: below:
--> -->
<ZLibSrcDir>..\..\..\..\zlib-1.2.5</ZLibSrcDir> <ZLibSrcDir>..\..\..\..\zlib-1.2.8</ZLibSrcDir>
<!-- The following line allows compilation for an ARM target with Visual <!-- The following line allows compilation for an ARM target with Visual
Studio 2012. Notice that this is not supported by the Visual Studio Studio 2012. Notice that this is not supported by the Visual Studio

View File

@ -1,9 +1,9 @@
Makefiles for libpng version 1.6.10 - March 6, 2014 Makefiles for libpng version 1.6.11 - June 5, 2014
pnglibconf.h.prebuilt => Stores configuration settings pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng16.so.16.1.6.10) (gcc, creates libpng16.so.16.1.6.11)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@ -20,7 +20,7 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.dec => DEC Alpha UNIX makefile makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
(gcc, creates libpng16.so.16.1.6.10) (gcc, creates libpng16.so.16.1.6.11)
makefile.freebsd => FreeBSD makefile makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc makefile.hpgcc => HPUX makefile using gcc
@ -35,12 +35,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def) makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc, makefile.sggcc => Silicon Graphics (gcc,
creates libpng16.so.16.1.6.10) creates libpng16.so.16.1.6.11)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng16.so.16.1.6.10) creates libpng16.so.16.1.6.11)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng16.so.16.1.6.10) creates libpng16.so.16.1.6.11)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile

View File

@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE" PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
PNG_DFN "" PNG_DFN ""
PNG_DFN "EXPORTS" PNG_DFN "EXPORTS"
PNG_DFN ";Version 1.6.10" PNG_DFN ";Version 1.6.11"
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@" PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"

0
scripts/dfn.awk Normal file → Executable file
View File

0
scripts/libpng-config-body.in Executable file → Normal file
View File

2
scripts/libpng-config-head.in Executable file → Normal file
View File

@ -11,7 +11,7 @@
# Modeled after libxml-config. # Modeled after libxml-config.
version=1.6.10 version=1.6.11
prefix="" prefix=""
libdir="" libdir=""
libs="" libs=""

View File

@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.6.10 Version: 1.6.11
Libs: -L${libdir} -lpng16 Libs: -L${libdir} -lpng16
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -24,13 +24,15 @@ LDLIBS= libpng.lib libgz.lib LIB:scm.lib LIB:sc.lib Lib:amiga.lib
LN= slink LN= slink
# file deletion command # file deletion command
RM= delete quiet RM= delete quiet
# file copy command?
CP= copy
# library (.lib) file creation command # library (.lib) file creation command
AR= oml AR= oml
# make directory command # make directory command
MKDIR= makedir MKDIR= makedir
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -43,8 +45,8 @@ $(AR) libpng.lib r $(OBJS)
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h $(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
pnglibconf.h: scripts/pnglibconf.h.prebuilt pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) scripts/pnglibconf.h.prebuilt pnglibconf.h COPY $(PNGLIBCONF_H_PREBUILT) TO pnglibconf.h
pngtest: pngtest.o libpng.lib pngtest: pngtest.o libpng.lib
$(LN) <WITH < $(LN) <WITH <

View File

@ -29,6 +29,10 @@ LIBPATH=$(prefix)/lib
# you execute make install. # you execute make install.
DESTDIR= DESTDIR=
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\ OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\ $(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
$(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\ $(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\
@ -44,8 +48,8 @@ $(LBR): $(OBJS)
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h $(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
pnglibconf.h: scripts/pnglibconf.h.prebuilt pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
cp scripts/pnglibconf.h.prebuilt pnglibconf.h cp $< $@
pngtest.ttp: pngtest.o $(LBR) pngtest.ttp: pngtest.o $(LBR)
$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o $(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o

View File

@ -11,10 +11,11 @@
## Where zlib.h, zconf.h and zlib.lib are ## Where zlib.h, zconf.h and zlib.lib are
ZLIB_DIR=..\zlib ZLIB_DIR=..\zlib
## Compiler, linker and lib stuff ## Compiler, linker, librarian and other tools
CC=bcc32 CC=bcc32
LD=bcc32 LD=bcc32
LIB=tlib LIB=tlib
CP=copy
# -3 = 386, -4 = 486, -5 = Pentium etc. # -3 = 386, -4 = 486, -5 = Pentium etc.
!ifndef TARGET_CPU !ifndef TARGET_CPU
@ -49,6 +50,10 @@ CFLAGS=-O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
# -M generate map file # -M generate map file
LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG) LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
## Variables ## Variables
OBJS = \ OBJS = \
png.obj \ png.obj \
@ -111,10 +116,8 @@ test: pngtest.exe
## Minor Targets ## Minor Targets
# see scripts\pnglibconf.mak for how to make this file pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
# with different options $(CP) $< $@
pnglibconf.h: scripts\pnglibconf.h.prebuilt
copy scripts\pnglibconf.h.prebuilt $@
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h

View File

@ -24,6 +24,7 @@ AR_RC=ar rc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where the zlib library and include files are located # Where the zlib library and include files are located
@ -68,6 +69,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -81,9 +86,8 @@ OBJSDLL = $(OBJS)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# try include scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -12,10 +12,11 @@
## Where zlib.h, zconf.h and zlib_MODEL.lib are ## Where zlib.h, zconf.h and zlib_MODEL.lib are
ZLIB_DIR=..\zlib ZLIB_DIR=..\zlib
## Compiler, linker and lib stuff ## Compiler, linker, librarian and other tools
CC=bcc CC=bcc
LD=bcc LD=bcc
LIB=tlib LIB=tlib
CP=copy
!ifndef MODEL !ifndef MODEL
MODEL=l MODEL=l
@ -57,6 +58,10 @@ CFLAGS=-O2 -Z -X- -w -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
# -M generate map file # -M generate map file
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG) LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
## Variables ## Variables
OBJS = \ OBJS = \
@ -110,9 +115,9 @@ LIBNAME=libpng$(MODEL).lib
all: libpng pngtest all: libpng pngtest
# try !inlude scripts\pnglibconf.mak for more options # try !include scripts\pnglibconf.mak for more options
pnglibconf.h: scripts\pnglibconf.h.prebuilt pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
copy scripts\pnglibconf.h.prebuilt $@ $(CP) $< $@
libpng: $(LIBNAME) libpng: $(LIBNAME)

View File

@ -23,7 +23,7 @@
VERMAJ = 1 VERMAJ = 1
VERMIN = 6 VERMIN = 6
VERMIC = 10 VERMIC = 11
VER = $(VERMAJ).$(VERMIN).$(VERMIC) VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng NAME = libpng
PACKAGE = $(NAME)-$(VER) PACKAGE = $(NAME)-$(VER)

View File

@ -34,6 +34,7 @@ AR_RC=ar rc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
ARCH=-arch ppc -arch i386 -arch x86_64 ARCH=-arch ppc -arch i386 -arch x86_64
@ -62,6 +63,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -78,9 +83,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -22,6 +22,7 @@ CC=cc
MKDIR_P=mkdir MKDIR_P=mkdir
LN_SF=ln -f -s LN_SF=ln -f -s
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
@ -57,6 +58,10 @@ CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=-std -w1 -O # -g CFLAGS=-std -w1 -O # -g
LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -66,9 +71,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)
@ -181,7 +185,7 @@ test-installed:
./pngtesti pngtest.png ./pngtesti pngtest.png
clean: clean:
/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \ $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
libpng-config $(LIBSO) $(LIBSOMAJ)* \ libpng-config $(LIBSO) $(LIBSOMAJ)* \
libpng.pc pnglibconf.h libpng.pc pnglibconf.h

View File

@ -19,6 +19,13 @@ LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=rm -f
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o pngwtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o pngwtran.o \
pngmem.o pngerror.o pngpread.o pngmem.o pngerror.o pngpread.o
@ -28,9 +35,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest all: libpng.a pngtest
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)
@ -43,7 +49,7 @@ pngtest: pngtest.o libpng.a
test: pngtest test: pngtest
./pngtest ./pngtest
clean: clean:
rm -f *.o libpng.a pngtest pngout.png pnglibconf.h $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@ -30,6 +30,7 @@ CC=gcc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where "make install" puts libpng16.a, libpng16.so*, # where "make install" puts libpng16.a, libpng16.so*,
@ -82,6 +83,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -98,9 +103,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -13,7 +13,7 @@ LIB= png
SHLIB_MAJOR= ${SHLIB_VER} SHLIB_MAJOR= ${SHLIB_VER}
SHLIB_MINOR= 0 SHLIB_MINOR= 0
NO_PROFILE= YES NO_PROFILE= YES
NO_OBJ= YES NO_OBJ= YES
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
DESTDIR= ${PREFIX} DESTDIR= ${PREFIX}
@ -39,6 +39,10 @@ DPADD+= ${LIBM} ${LIBZ}
CPPFLAGS+= -I. -I${ZLIBINC} CPPFLAGS+= -I. -I${ZLIBINC}
CFLAGS+= -W -Wall CFLAGS+= -W -Wall
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c
@ -55,9 +59,8 @@ CLEANFILES= pngtest pngtest.o pngout.png
test: pngtest test: pngtest
./pngtest ./pngtest
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt cp $< $@
cp scripts/pnglibconf.h.prebuilt $@
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -16,6 +16,7 @@ CC = gcc
LD = $(CC) LD = $(CC)
AR_RC = ar rcs AR_RC = ar rcs
RANLIB = ranlib RANLIB = ranlib
CP = cp
RM_F = rm -f RM_F = rm -f
WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \ WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
@ -29,6 +30,10 @@ LIBS = -lz -lm
# File extensions # File extensions
EXEEXT = EXEEXT =
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
# Variables # Variables
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
@ -37,9 +42,8 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
# Targets # Targets
all: static all: static
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
.c.o: .c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<

View File

@ -34,6 +34,7 @@ CC=cc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
CPPFLAGS=-I$(ZLIBINC) \ CPPFLAGS=-I$(ZLIBINC) \
@ -67,6 +68,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -83,9 +88,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -25,6 +25,7 @@ AR_RC=ar rc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where "make install" puts libpng.a, $(OLDSO)*, png.h, pngconf.h # where "make install" puts libpng.a, $(OLDSO)*, png.h, pngconf.h

View File

@ -66,6 +66,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -82,9 +86,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -21,12 +21,17 @@ ZLIBLIB = ../zlib
CC = icc CC = icc
LD = ilink LD = ilink
AR = ilib AR = ilib
CP = copy
RM = del RM = del
CPPFLAGS = -I$(ZLIBINC) CPPFLAGS = -I$(ZLIBINC)
CFLAGS = -Mc -O2 -W3 CFLAGS = -Mc -O2 -W3
LDFLAGS = LDFLAGS =
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
# File extensions # File extensions
O=.obj O=.obj
A=.lib A=.lib
@ -45,9 +50,8 @@ LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A)
all: libpng$(A) pngtest$(E) all: libpng$(A) pngtest$(E)
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng$(A): $(OBJS) libpng$(A): $(OBJS)
$(AR) -out:$@ $(OBJS) $(AR) -out:$@ $(OBJS)

View File

@ -36,6 +36,11 @@ CPPFLAGS=-I$(ZLIBINC)
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -nologo CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -nologo
LD=link LD=link
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
CP=cp
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
O=.obj O=.obj
@ -45,9 +50,8 @@ pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
all: test all: test
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)

View File

@ -36,15 +36,21 @@ ANSI2KNRFLAGS=
RANLIB = ranlib RANLIB = ranlib
#RANLIB = echo #RANLIB = echo
CP = cp
RM_F = rm -f
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
all: ansi2knr libpng.a pngtest all: ansi2knr libpng.a pngtest
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
# general rule to allow ansi2knr to work # general rule to allow ansi2knr to work
.c.o: .c.o:
@ -83,7 +89,7 @@ install: libpng.a png.h pngconf.h pnglibconf.h
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
clean: clean:
rm -f *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h $(RM_F) *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: writelock:

View File

@ -10,7 +10,7 @@
# Library name: # Library name:
LIBNAME = libpng16 LIBNAME = libpng16
PNGMAJ = 16 PNGMAJ = 16
RELEASE = 10 RELEASE = 11
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@ -24,6 +24,7 @@ CC=gcc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where "make install" puts libpng16.a, libpng16.so*, # where "make install" puts libpng16.a, libpng16.so*,
@ -75,6 +76,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -91,9 +96,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -30,6 +30,12 @@ LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
#RANLIB=ranlib #RANLIB=ranlib
RANLIB=echo RANLIB=echo
CP=cp
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -39,9 +45,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest all: libpng.a pngtest
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
ar rc $@ $(OBJS) ar rc $@ $(OBJS)

View File

@ -16,8 +16,13 @@ CFLAGS=-Oait -Gs -nologo -W3 -A$(MODEL)
CC=cl CC=cl
LD=link LD=link
LDFLAGS=/e/st:0x1500/noe LDFLAGS=/e/st:0x1500/noe
CP=copy
O=.obj O=.obj
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
#uncomment next to put error messages in a file #uncomment next to put error messages in a file
ERRFILE= >> pngerrs ERRFILE= >> pngerrs
@ -28,12 +33,11 @@ OBJS3 = pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
all: libpng.lib all: libpng.lib
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)

View File

@ -18,7 +18,7 @@ exec_prefix=$(prefix)
# Library name: # Library name:
LIBNAME = libpng16 LIBNAME = libpng16
PNGMAJ = 16 PNGMAJ = 16
RELEASE = 10 RELEASE = 11
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).dll LIBSO=$(LIBNAME).dll
@ -37,6 +37,7 @@ CC = gcc
LD = $(CC) LD = $(CC)
AR_RC = ar rcs AR_RC = ar rcs
RANLIB = ranlib RANLIB = ranlib
CP = cp
RM_F = rm -rf RM_F = rm -rf
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
@ -73,6 +74,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
# Variables # Variables
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
@ -81,9 +86,8 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
# Targets # Targets
all: static shared all: static shared
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
.c.o: .c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< $(CC) -c $(CPPFLAGS) $(CFLAGS) $<

View File

@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
LIB= png16 LIB= png16
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.6.10 SHLIB_MINOR= 1.6.11
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c
@ -26,6 +26,10 @@ MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} CPPFLAGS+=-I${.CURDIR}
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
# We should be able to do something like this instead of the manual # We should be able to do something like this instead of the manual
# uncommenting, but it core dumps for me at the moment: # uncommenting, but it core dumps for me at the moment:
# .if ${MACHINE_ARCH} == "i386" # .if ${MACHINE_ARCH} == "i386"
@ -37,9 +41,8 @@ CLEANFILES+=pngtest.o pngtest pnglibconf.h
.c.o: .c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt cp $< $@
cp scripts/pnglibconf.h.prebuilt $@
pngtest.o: pngtest.c pngtest.o: pngtest.c
${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} ${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}

View File

@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
LIB= png LIB= png
SHLIB_MAJOR= 16 SHLIB_MAJOR= 16
SHLIB_MINOR= 1.6.10 SHLIB_MINOR= 1.6.11
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c
@ -26,6 +26,10 @@ MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} CPPFLAGS+=-I${.CURDIR}
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
# We should be able to do something like this instead of the manual # We should be able to do something like this instead of the manual
# uncommenting, but it core dumps for me at the moment: # uncommenting, but it core dumps for me at the moment:
# .if ${MACHINE_ARCH} == "i386" # .if ${MACHINE_ARCH} == "i386"
@ -37,9 +41,8 @@ CLEANFILES+=pngtest.o pngtest pnglibconf.h
.c.o: .c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt cp $< $@
cp scripts/pnglibconf.h.prebuilt $@
pngtest.o: pngtest.c pngtest.o: pngtest.c
${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} ${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}

View File

@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 16 SHLIB_MAJOR= 16
SHLIB_MINOR= 1.6.10 SHLIB_MINOR= 1.6.11
LIB= png LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
@ -31,12 +31,15 @@ MAN= libpng.3 libpngpf.3 png.5
DOCS= ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \ DOCS= ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
libpng-manual.txt libpng-manual.txt
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
.c.o: .c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt cp $< $@
cp scripts/pnglibconf.h.prebuilt $@
pngtest.o: pngtest.c pngtest.o: pngtest.c
${CC} ${CPPFLAGS} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} ${CC} ${CPPFLAGS} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}

View File

@ -25,6 +25,7 @@ AR_RC=ar rc
MKDIR_P=mkdir MKDIR_P=mkdir
LN_SF=ln -f -s LN_SF=ln -f -s
RANLIB=echo RANLIB=echo
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where make install puts libpng.a, $(OLDSO)*, and png.h # where make install puts libpng.a, $(OLDSO)*, and png.h
@ -61,6 +62,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -77,9 +82,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -22,6 +22,7 @@ CC=gcc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=echo RANLIB=echo
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng16.so, and libpng16/png.h # Where make install puts libpng.a, libpng16.so, and libpng16/png.h
@ -71,6 +72,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -80,9 +85,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest shared libpng.pc libpng-config all: libpng.a pngtest shared libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -22,6 +22,7 @@ CC=cc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -sf LN_SF=ln -sf
RANLIB=echo RANLIB=echo
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng16.so, and libpng16/png.h # Where make install puts libpng.a, libpng16.so, and libpng16/png.h
@ -74,6 +75,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -83,9 +88,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest shared libpng.pc libpng-config all: libpng.a pngtest shared libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -26,6 +26,7 @@ AR_RC=ar rc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -f -s LN_SF=ln -f -s
RANLIB=echo RANLIB=echo
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, $(OLDSO)*, and png.h # Where make install puts libpng.a, $(OLDSO)*, and png.h
@ -71,6 +72,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -87,9 +92,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -24,6 +24,7 @@ CC=gcc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -f -s LN_SF=ln -f -s
RANLIB=echo RANLIB=echo
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng16.so*, and png.h # Where make install puts libpng.a, libpng16.so*, and png.h
@ -67,6 +68,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -83,9 +88,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -24,6 +24,7 @@ CC=gcc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -f -s LN_SF=ln -f -s
RANLIB=echo RANLIB=echo
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng16.so*, and png.h # Where make install puts libpng.a, libpng16.so*, and png.h
@ -66,6 +67,10 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -82,9 +87,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -32,6 +32,7 @@ AR_RC = ar rc
MKDIR_P = mkdir MKDIR_P = mkdir
LN_SF = ln -sf LN_SF = ln -sf
RANLIB = ranlib RANLIB = ranlib
CP = cp
RM_F = rm -f RM_F = rm -f
AWK = awk AWK = awk
SED = sed SED = sed
@ -44,6 +45,10 @@ CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS = -O # -g CFLAGS = -O # -g
LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o

View File

@ -37,12 +37,17 @@ AR_RC=ar rc
MKDIR_P=mkdir -p MKDIR_P=mkdir -p
LN_SF=ln -f -s LN_SF=ln -f -s
RANLIB=ranlib RANLIB=ranlib
CP=cp
RM_F=/bin/rm -f RM_F=/bin/rm -f
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS=-O # $(WARNMORE) CFLAGS=-O # $(WARNMORE)
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o
@ -52,9 +57,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest all: libpng.a pngtest
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS) libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS) $(AR_RC) $@ $(OBJS)

View File

@ -12,6 +12,12 @@ CC=tcc
LD=tcc LD=tcc
LIB=tlib LIB=tlib
LDFLAGS=-m$(MODEL) -L..\zlib LDFLAGS=-m$(MODEL) -L..\zlib
CP=copy
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
O=.obj O=.obj
E=.exe E=.exe
@ -25,9 +31,8 @@ OBJSL3 = +pngwrite$(O) +pngrtran$(O) +pngwtran$(O) +pngrio$(O) +pngwio$(O)
all: libpng$(MODEL).lib pngtest$(E) all: libpng$(MODEL).lib pngtest$(E)
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts/pnglibconf.h.prebuilt $(CP) $< $@
cp scripts/pnglibconf.h.prebuilt $@
pngtest: pngtest$(E) pngtest: pngtest$(E)

View File

@ -9,9 +9,9 @@
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib # Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
# To use, do "nmake /f scripts\makefile.vcwin32" # To use, do "nmake /f scripts\makefile.vcwin32"
# -------- Microsoft Visual C++ 2.0 and later, no assembler code -------- # -------- Microsoft Visual C++ 2.0 and later --------
# Compiler, linker, librarian, and other tools # Compiler, linker, librarian and other tools
CC = cl CC = cl
LD = link LD = link
AR = lib AR = lib
@ -19,8 +19,13 @@ CPPFLAGS = -I..\zlib
CFLAGS = -nologo -D_CRT_SECURE_NO_DEPRECATE -MD -O2 -W3 CFLAGS = -nologo -D_CRT_SECURE_NO_DEPRECATE -MD -O2 -W3
LDFLAGS = -nologo LDFLAGS = -nologo
ARFLAGS = -nologo ARFLAGS = -nologo
CP = copy
RM = del RM = del
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
# File extensions # File extensions
O=.obj O=.obj
@ -36,9 +41,8 @@ OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
# Targets # Targets
all: libpng.lib all: libpng.lib
# see scripts/pnglibconf.mak for more options pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
pnglibconf.h: scripts\pnglibconf.h.prebuilt $(CP) $< $@
copy scripts\pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)

View File

@ -269,7 +269,7 @@ $1 == "option" && NF >= 2{
if (val != 1) { # error reading it if (val != 1) { # error reading it
if (val == 0) if (val == 0)
print "option", opt ": ERROR: missing contination line" print "option", opt ": ERROR: missing continuation line"
else else
print "option", opt ": ERROR: error reading continuation line" print "option", opt ": ERROR: error reading continuation line"
@ -362,7 +362,7 @@ pre != 0 && $1 == "chunk" && NF >= 2{
if (val != 1) { # error reading it if (val != 1) { # error reading it
if (val == 0) if (val == 0)
print "chunk", opt ": ERROR: missing contination line" print "chunk", opt ": ERROR: missing continuation line"
else else
print "chunk", opt ": ERROR: error reading continuation line" print "chunk", opt ": ERROR: error reading continuation line"
@ -493,7 +493,7 @@ $1 ~ /^@/{
next next
} }
# Check for unreognized lines, because of the preprocessing chunk # Check for unrecognized lines, because of the preprocessing chunk
# format errors will be detected on the first pass independent of # format errors will be detected on the first pass independent of
# any other format errors. # any other format errors.
{ {
@ -585,7 +585,7 @@ END{
# If an option[opt] is 'on' then turn on all requires[opt] # If an option[opt] is 'on' then turn on all requires[opt]
# If an option[opt] is 'off' then turn off all enabledby[opt] # If an option[opt] is 'off' then turn off all enabledby[opt]
# #
# Error out if we have to turn 'on' an 'off' option or vice versa. # Error out if we have to turn 'on' to an 'off' option or vice versa.
npending = 0 npending = 0
for (opt in option) if (opt != "") { for (opt in option) if (opt != "") {
if (option[opt] == "on" || option[opt] == "off") { if (option[opt] == "on" || option[opt] == "off") {
@ -677,7 +677,7 @@ END{
for (j=1; j<=nreqs; ++j) { for (j=1; j<=nreqs; ++j) {
print "#ifndef PNG_" r[j] "_SUPPORTED" >out print "#ifndef PNG_" r[j] "_SUPPORTED" >out
print "# undef PNG_on /*!" r[j] "*/" >out print "# undef PNG_on /*!" r[j] "*/" >out
# this error appears in the final output if something # This error appears in the final output if something
# was switched 'on' but the processing above to force # was switched 'on' but the processing above to force
# the requires did not work # the requires did not work
if (option[i] == "on") { if (option[i] == "on") {

28
scripts/pnglibconf.dfa Executable file → Normal file
View File

@ -305,10 +305,6 @@ option FLOATING_ARITHMETIC
option FLOATING_POINT option FLOATING_POINT
option FIXED_POINT option FIXED_POINT
# The following is always on (defined empty)
setting CALLOC_SUPPORTED default
# This protects us against compilers that run on a windowing system # This protects us against compilers that run on a windowing system
# and thus don't have or would rather us not use the stdio types: # and thus don't have or would rather us not use the stdio types:
# stdin, stdout, and stderr. The only one currently used is stderr # stdin, stdout, and stderr. The only one currently used is stderr
@ -582,19 +578,21 @@ option COLORSPACE enables GAMMA disabled
# PNG_sRGB_PROFILE_CHECKS setting controls how much work is done during the # PNG_sRGB_PROFILE_CHECKS setting controls how much work is done during the
# check: # check:
# #
# 0: Just validate the profile MD5 signature if present, otherwise use # -1: Don't do any sRGB profile checking.
# the checks in option 1.
# #
# 1: Additionally check the length, intent and adler32 checksum of the # 0: Just validate the profile MD5 signature if present, otherwise use
# actual data. If enabled this will reject known profiles that have # the checks in option 1.
# had the rendering intent in the header changed as well as other edits
# done without updating the checksum. See the discussion below.
# #
# 2: Additionally checksum all the data using the ethernet CRC32 algorithm. # 1: Additionally check the length, intent and adler32 checksum of the
# This makes it more difficult to fake profiles and makes it less likely # actual data. If enabled this will reject known profiles that have
# to get a false positive on profiles with no signature, but is probably # had the rendering intent in the header changed as well as other edits
# just a waste of time since all currently approved ICC sRGB profiles have # done without updating the checksum. See the discussion below.
# a secure MD5 signature. #
# 2: Additionally checksum all the data using the ethernet CRC32 algorithm.
# This makes it more difficult to fake profiles and makes it less likely
# to get a false positive on profiles with no signature, but is probably
# just a waste of time since all currently approved ICC sRGB profiles have
# a secure MD5 signature.
# #
# The rendering intent. An ICC profile stores an intended rendering intent, # The rendering intent. An ICC profile stores an intended rendering intent,
# but does not include the value in the signature. The intent is documented # but does not include the value in the signature. The intent is documented

View File

@ -1,10 +1,10 @@
/* libpng 1.6.10 STANDARD API DEFINITION */ /* libpng 1.6.11 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* Libpng version 1.6.10 - March 6, 2014 */ /* Libpng version 1.6.11 - June 5, 2014 */
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */ /* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */ /* For conditions of distribution and use, see the disclaimer */
@ -187,7 +187,6 @@
/* end of options */ /* end of options */
/* settings */ /* settings */
#define PNG_API_RULE 0 #define PNG_API_RULE 0
#define PNG_CALLOC_SUPPORTED
#define PNG_COST_SHIFT 3 #define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1 #define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000 #define PNG_GAMMA_THRESHOLD_FIXED 5000

View File

@ -1,4 +1,4 @@
;Version 1.6.10 ;Version 1.6.11
;-------------------------------------------------------------- ;--------------------------------------------------------------
; LIBPNG symbol list as a Win32 DEF file ; LIBPNG symbol list as a Win32 DEF file
; Contains all the symbols that can be exported from libpng ; Contains all the symbols that can be exported from libpng

View File

@ -11,9 +11,9 @@
/* NOTE: making 'symbols.chk' checks both that the exported /* NOTE: making 'symbols.chk' checks both that the exported
* symbols in the library don't change and (implicitly) that * symbols in the library don't change and (implicitly) that
* scripts/pnglibconf.h.prebuilt is as expected. If scripts/pnglibconf.h.prebuilt * scripts/pnglibconf.h.prebuilt is as expected.
* is remade using scripts/pnglibconf.dfa then this checks the * If scripts/pnglibconf.h.prebuilt is remade using
* .dfa file too. * scripts/pnglibconf.dfa then this checks the .dfa file too.
*/ */
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\