Compare commits

...

3 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
752945701e Imported from libpng-1.0.7beta11.tar 2009-04-06 16:05:05 -05:00
Glenn Randers-Pehrson
98c9d73605 Imported from libpng-1.0.6j.tar 2009-04-06 16:05:04 -05:00
Glenn Randers-Pehrson
6942d53c25 Imported from libpng-1.0.6i.tar 2009-04-06 16:05:02 -05:00
46 changed files with 1598 additions and 996 deletions

View File

@@ -1,12 +1,10 @@
Libpng 1.0.6h - April 24, 2000 Libpng 1.0.7beta11 - May 6, 2000
This is not intended to be a public release. It will be replaced This is a public release of libpng, intended for use in production codes.
within a few weeks by a public version or by another test version.
Changes since the last public release (1.0.6): Changes since the last public release (1.0.6):
version 1.0.6d [April 8, 2000]
Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO
Added data_length parameter to png_decompress_chunk() function Added data_length parameter to png_decompress_chunk() function
Revised documentation to remove reference to abandoned png_free_chnk functions Revised documentation to remove reference to abandoned png_free_chnk functions
@@ -15,31 +13,53 @@ version 1.0.6d [April 8, 2000]
Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file
Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c Added a check for info_ptr->free_me&PNG_FREE_TEXT when free'ing text in png.c
Simplify png_sig_bytes() function to remove use of non-ISO-C strdup(). Simplify png_sig_bytes() function to remove use of non-ISO-C strdup().
version 1.0.6e [April 9, 2000]
Added png_data_freer() function. Added png_data_freer() function.
In the code that checks for over-length tRNS chunks, added check of In the code that checks for over-length tRNS chunks, added check of
info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann) info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann)
Minor revisions of libpng.txt/libpng.3.
Check for existing data and free it if the free_me flag is set, in png_set_*() Check for existing data and free it if the free_me flag is set, in png_set_*()
and png_handle_*(). and png_handle_*().
Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED
is defined. is defined.
Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c
and mentioned the purposes of the two macros in libpng.txt/libpng.3. and mentioned the purposes of the two macros in libpng.txt/libpng.3.
version 1.0.6f [April 14, 2000]
Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data. Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data.
Add checks in png_set_text() for NULL members of the input text structure. Add checks in png_set_text() for NULL members of the input text structure.
Revised libpng.txt/libpng.3.
Removed superfluous prototype for png_set_itxt from png.h Removed superfluous prototype for png_set_itxt from png.h
Removed "else" from pngread.c, after png_error(), and changed "0" to "length". Removed "else" from pngread.c, after png_error(), and changed "0" to "length".
Changed several png_errors about malformed ancillary chunks to png_warnings. Changed several png_errors about malformed ancillary chunks to png_warnings.
version 1.0.6h [April 24, 2000]
Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined. Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined.
Relocated paragraph about png_set_background() in libpng.3/libpng.txt Relocated paragraph about png_set_background() in libpng.3/libpng.txt
and other revisions (Matthias Benckmann) and other revisions (Matthias Benckmann)
Relocated info_ptr->free_me to restore binary compatibility with libpng-1.0.5
(breaks compatibility with libpng-1.0.6).
Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and
png_ptr members to restore binary compatibility with libpng-1.0.5 png_ptr members to restore binary compatibility with libpng-1.0.5
(breaks compatibility with libpng-1.0.6). (breaks compatibility with libpng-1.0.6).
Rearranged some members at the end of png_info and png_struct, to put
unknown_chunks_num and free_me within the original size of the png_structs
and free_me, png_read_user_fn, and png_free_fn within the original png_info,
because some old applications allocate the structs directly instead of
using png_create_*().
Added documentation of user memory functions in libpng.txt/libpng.3
Modified png_read_png so that it will use user_allocated row_pointers
if present, unless free_me directs that it be freed, and added description
of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3.
Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version
1.00) members of png_struct and png_info, to regain binary compatibility
when you define this macro. Capabilities lost in this event
are user transforms (new in version 1.0.0),the user transform pointer
(new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT,
the high-level interface, and unknown chunks support (all new in 1.0.6).
This was necessary because of old applications that allocate the structs
directly as authors were instructed to do in libpng-0.88 and earlier,
instead of using png_create_*().
Added makefile.intel and updated makefile.watcom (Pawel Mrochen)
Overloaded png_read_init() and png_write_init() with macros that convert
calls to png_read_init_2() or png_write_init_2() that check the version
and structure sizes.
In png_set_text, check if old application had allocated the png_text structure;
if so, only allow one text chunk to be processed to avoid memory overrun.
Added PNGAPI macro, and added it to the definitions of all exported functions.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

38
CHANGES
View File

@@ -699,6 +699,44 @@ version 1.0.6g [April 24, 2000]
version 1.0.6h [April 24, 2000] version 1.0.6h [April 24, 2000]
Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds
libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h) libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h)
This is a temporary change for test purposes.
version 1.0.6i [May 2, 2000]
Rearranged some members at the end of png_info and png_struct, to put
unknown_chunks_num and free_me within the original size of the png_structs
and free_me, png_read_user_fn, and png_free_fn within the original png_info,
because some old applications allocate the structs directly instead of
using png_create_*().
Added documentation of user memory functions in libpng.txt/libpng.3
Modified png_read_png so that it will use user_allocated row_pointers
if present, unless free_me directs that it be freed, and added description
of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3.
Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version
1.00) members of png_struct and png_info, to regain binary compatibility
when you define this macro. Capabilities lost in this event
are user transforms (new in version 1.0.0),the user transform pointer
(new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT,
the high-level interface, and unknown chunks support (all new in 1.0.6).
This was necessary because of old applications that allocate the structs
directly as authors were instructed to do in libpng-0.88 and earlier,
instead of using png_create_*().
Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which
can be used to detect codes that directly allocate the structs, and
code to check these modes in png_read_init() and png_write_init() and
generate a libpng error if the modes aren't set and PNG_LEGACY_SUPPORTED
was not defined.
Added makefile.intel and updated makefile.watcom (Pawel Mrochen)
version 1.0.6j [May 3, 2000]
Overloaded png_read_init() and png_write_init() with macros that convert
calls to png_read_init_2() or png_write_init_2() that check the version
and structure sizes.
version 1.0.7beta11 [May 6, 2000]
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
which are no longer used.
Eliminated the three new members of png_text when PNG_NO_iTXt_SUPPORTED
or PNG_LEGACY_SUPPORTED is defined.
In png_set_text, check if old application had allocated the png_text structure;
if so, only allow one text chunk to be processed to avoid memory overrun.
Added PNGAPI macro, and added it to the definitions of all exported functions.
Send comments/corrections/commendations to Send comments/corrections/commendations to
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu

12
INSTALL
View File

@@ -1,5 +1,5 @@
Installing libpng version 1.0.6h - April 24, 2000 Installing libpng version 1.0.7beta11 - May 6, 2000
Before installing libpng, you must first install zlib. zlib Before installing libpng, you must first install zlib. zlib
can usually be found wherever you got libpng. zlib can be can usually be found wherever you got libpng. zlib can be
@@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
version of zlib that's installed. version of zlib that's installed.
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-1.0.6h" or "lpng106" and "zlib-1.1.3" might be called "libpng-1.0.7beta11" or "lpng106" and "zlib-1.1.3"
or "zlib113") so that you have directories called "zlib" and "libpng". or "zlib113") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@@ -47,8 +47,8 @@ The files that are presently available in the scripts directory
include include
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6h) makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta11)
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6h, makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta11,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@@ -59,9 +59,9 @@ include
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6h) makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta11)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.6h) makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.7beta11)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile makefile.acorn => Acorn makefile

View File

@@ -1,21 +1,57 @@
Known bugs and suggested enhancements in libpng-1.0.6 Known bugs and suggested enhancements in libpng-1.0.6
1. April 23, 2000 -- BUG -- binary incompatibility 1. April 24, 2000 -- BUG -- binary incompatibility
Libpng-1.0.6 is binary incompatible with old applications that
allocate the png_struct and png_info structures themselves instead
of using png_create_*(). They do not allocate enough space for
the structures because they have an incorrect notion of
sizeof(png_struct) and sizeof(png_info). Although such applications
should be considered broken rather than considering libpng to be broken,
they are numerous and include products of the PNG group, such
as gif2png and pnmtopng-2.36 (pnmtopng-2.37 is OK), so libpng will
be fixed in version 1.0.7 to work around this problem.
Applications that use png_create_*() instead of png_ptr=malloc(...)
are immune to this problem.
STATUS: Fixed in libpng-1.0.6ad, libpng-1.0.6j, and patch-d
which are currently being tested by the PNG group.
The fix necessarily reintroduces a binary incompatibility with any
application that makes direct access to the png_info and
png_struct members that deal with the pCAL chunk, palette_lookup,
dither_index, time_buffer, or weighted filtering, i.e., any members
coming after the new "free_me" member of either structure. It
is believed that applications affected by this reintroduced binary
incompatibility are rare (none are known to the PNG group). An
effective workaround for this and the next bug is to recompile the
old applications with the installed version of libpng.
2. April 23, 2000 -- BUG -- binary incompatibility
Libpng-1.0.6 introduced binary incompatibility for applications that Libpng-1.0.6 introduced binary incompatibility for applications that
make direct access to the info_ptr and png_ptr, due to the insertion make direct access to members of the png_struct and png_info structures,
of the free_me member ahead of some previously existing members. due to the insertion of the free_me member ahead of some previously
existing members.
STATUS: Fixed in libpng-1.0.6g Applications that use png_set_*(), png_get_*() are immune to this
problem, but people are still to this day writing applications that
make ill-advised direct access to members of the png_struct and
png_info structures, so libpng-1.0.6 will be patched to work around
this problem.
2. April 15, 2000 -- BUG -- pnggccrd.c STATUS: Fixed in libpng-1.0.6j and patch-d, which are currently being
tested by the PNG group. Users can work around the problem without
patching libpng by recompiling their applications.
3. April 15, 2000 -- BUG -- pnggccrd.c
If PNG_NO_GLOBAL_ARRAYS is defined, pnggccrd.c will not compile. If PNG_NO_GLOBAL_ARRAYS is defined, pnggccrd.c will not compile.
STATUS: Fixed in libpng-1.0.6g STATUS: Fixed in libpng-1.0.6g
3. April 1, 2000 -- BUG 4. April 1, 2000 -- BUG
Under some circumstances old applications that make direct access to Under some circumstances old applications that make direct access to
the info_ptr->text and its members might free the same memory that the info_ptr->text and its members might free the same memory that
@@ -25,21 +61,21 @@ Known bugs and suggested enhancements in libpng-1.0.6
bit in info_ptr->free_me is now checked to make sure libpng is responsible bit in info_ptr->free_me is now checked to make sure libpng is responsible
for freeing the memory. for freeing the memory.
4. April 1, 2000 -- BUG 5. April 1, 2000 -- BUG
The non-ISO-C "strdup()" function is used in png.c The non-ISO-C "strdup()" function is used in png.c
STATUS: The function has been simplified and no longer uses strdup() STATUS: The function has been simplified and no longer uses strdup()
in libpng-1.0.6-patch-c and libpng-1.0.6d. in libpng-1.0.6-patch-c and libpng-1.0.6d.
5. March 24, 2000 -- BUG 6. March 24, 2000 -- BUG
The png_set_rgb_to_gray_fixed() function is setting incorrect weighting The png_set_rgb_to_gray_fixed() function is setting incorrect weighting
factors. factors.
STATUS: Fixed in libpng-1.0.6-patch-b and libpng-1.0.6d. STATUS: Fixed in libpng-1.0.6-patch-b and libpng-1.0.6d.
6. March 22, 2000 -- BUG 7. March 22, 2000 -- BUG
There are some printf() and fprintf() statements active in pngwutil.c There are some printf() and fprintf() statements active in pngwutil.c
when PNG_NO_STDIO and PNG_sCAL_SUPPORTED are both defined. when PNG_NO_STDIO and PNG_sCAL_SUPPORTED are both defined.
@@ -47,7 +83,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d. The strcpy() STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d. The strcpy()
function is used instead. function is used instead.
7. March 22, 2000 -- BUG 8. March 22, 2000 -- BUG
The length of the iCCP chunk data is calculated incorrectly; because The length of the iCCP chunk data is calculated incorrectly; because
it can contain zeroes, strlen() doesn't work. it can contain zeroes, strlen() doesn't work.
@@ -55,7 +91,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d by adding a STATUS: Fixed in libpng-1.0.6-patch-a and libpng-1.0.6d by adding a
data_length parameter to the png_decompress_chunk() function. data_length parameter to the png_decompress_chunk() function.
8. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey 9. March 15, 1998 -- OPTIMIZATION -- Kevin Bracey
Loops need to be optimized everywhere Loops need to be optimized everywhere
@@ -70,7 +106,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
libpng-1.1.0. About 160 loops will be turned around libpng-1.1.0. About 160 loops will be turned around
in libpng-1.1.Nn, for testing. in libpng-1.1.Nn, for testing.
9. July 4, 1998 -- ENHANCEMENT -- Glenn R-P 10. July 4, 1998 -- ENHANCEMENT -- Glenn R-P
libpng-1.0.5 and earlier transform colors to gamma=1.0 space for libpng-1.0.5 and earlier transform colors to gamma=1.0 space for
merging with background, and then back to the image's gamma. The merging with background, and then back to the image's gamma. The
@@ -82,7 +118,7 @@ Known bugs and suggested enhancements in libpng-1.0.6
STATUS: under development. STATUS: under development.
10. September 1999 -- ENHANCEMENT -- 11. September 1999 -- ENHANCEMENT --
It should be possible to use libpng without floating-point aritmetic. It should be possible to use libpng without floating-point aritmetic.

View File

@@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.90, December 1996, through 0.96, May 1997) (libpng versions 0.90, December 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.6h, April 24, 2000) (libpng versions 0.97, January 1998, through 1.0.7beta11, May 6, 2000)
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:
@@ -68,4 +68,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
randeg@alum.rpi.edu randeg@alum.rpi.edu
April 24, 2000 May 6, 2000

10
README
View File

@@ -1,4 +1,4 @@
README for libpng 1.0.6h - April 24, 2000 (shared library 2.1) README for libpng 1.0.7beta11 - May 6, 2000 (shared library 2.1)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
@@ -172,9 +172,9 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng.so.2.1.0.6h) (gcc, creates libpng.so.2.1.0.7beta11)
makefile.gcmmx => Linux/ELF makefile (gcc, creates makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng.so.2.1.0.6h, uses assembler code libpng.so.2.1.0.7beta11, uses assembler code
tuned for Intel MMX platform) tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@@ -185,10 +185,10 @@ Files in this distribution:
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6h) makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta11)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng.so.2.1.0.6h) (gcc, creates libpng.so.2.1.0.7beta11)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile makefile.acorn => Acorn makefile

2
TODO
View File

@@ -1,6 +1,7 @@
TODO - list of things to do for libpng: TODO - list of things to do for libpng:
Final bug fixes. Final bug fixes.
Improve API by hiding the png_struct and png_info structs.
Finish work on the no-floating-point version (including gamma compensation) Finish work on the no-floating-point version (including gamma compensation)
Better C++ wrapper/full C++ implementation? Better C++ wrapper/full C++ implementation?
Fix problem with C++ and EXTERN "C". Fix problem with C++ and EXTERN "C".
@@ -16,4 +17,3 @@ Better filter selection
(counting huffman bits/precompression? filter inertia? filter costs?). (counting huffman bits/precompression? filter inertia? filter costs?).
Histogram creation. Histogram creation.
Text conversion between different code pages (Latin-1 -> Mac and DOS). Text conversion between different code pages (Latin-1 -> Mac and DOS).
Improve API by hiding the info_ptr.

View File

@@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
April 24, 2000 May 6, 2000
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.6h are Y2K compliant. It is my belief that earlier upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer Libpng only has three year fields. One is a 2-byte unsigned integer

2
configure vendored
View File

@@ -1,5 +1,5 @@
echo " echo "
There is no \"configure\" script for Libpng-1.0.6h. Instead, please There is no \"configure\" script for Libpng-1.0.7beta11. Instead, please
copy the appropriate makefile for your system from the \"scripts\" copy the appropriate makefile for your system from the \"scripts\"
directory. Read the INSTALL file for more details. directory. Read the INSTALL file for more details.
" "

View File

@@ -307,7 +307,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
} }
/* flip the RGB pixels to BGR (or RGBA to BGRA) */ /* flip the RGB pixels to BGR (or RGBA to BGRA) */
png_set_bgr(png_ptr); if (color_type & PNG_COLOR_MASK_COLOR)
png_set_bgr(png_ptr);
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
png_set_swap_alpha(png_ptr); png_set_swap_alpha(png_ptr);

181
libpng.3
View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "April 24, 2000" .TH LIBPNG 3 "May 6, 2000"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta11
.SH SYNOPSIS .SH SYNOPSIS
\fI\fB \fI\fB
@@ -354,6 +354,12 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h
\fI\fB \fI\fB
\fBDEPRECATED: void png_read_init (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBDEPRECATED: void png_read_init_2 (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fP\fIuser_png_ver\fP\fB, png_size_t \fP\fIpng_struct_size\fP\fB, png_size_t \fIpng_info_size\fP\fB);\fP
\fBvoid png_read_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_read_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB \fI\fB
@@ -694,6 +700,14 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h
\fI\fB \fI\fB
\fBDEPRECATED: void png_write_init (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBDEPRECATED: void png_write_init_2 (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fP\fIuser_png_ver\fP\fB, png_size_t \fP\fIpng_struct_size\fP\fB, png_size_t \fIpng_info_size\fP\fB);\fP
\fI\fB
\fBvoid png_write_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_write_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB \fI\fB
@@ -725,7 +739,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.6h - April 24, 2000 libpng version 1.0.7beta11 - May 6, 2000
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -819,9 +833,20 @@ The png_info structure is designed to provide information about the
PNG file. At one time, the fields of png_info were intended to be PNG file. At one time, the fields of png_info were intended to be
directly accessible to the user. However, this tended to cause problems directly accessible to the user. However, this tended to cause problems
with applications using dynamically loaded libraries, and as a result with applications using dynamically loaded libraries, and as a result
a set of interface functions for png_info was developed. The fields a set of interface functions for png_info (the png_get_*() and png_set_*()
of png_info are still available for older applications, but it is functions) was developed. The fields of png_info are still available for
suggested that applications use the new interfaces if at all possible. older applications, but it is suggested that applications use the new
interfaces if at all possible.
Applications that do make direct access to the members of png_struct (except
for png_ptr->jmpbuf) must be recompiled whenever the library is updated,
and applications that make direct access to the members of png_info must
be recompiled if they were compiled or loaded with libpng version 1.0.6,
in which the members were in a different order. In version 1.0.7, the
members of the png_info structure reverted to the old order, as they were
in versions 0.97c through 1.0.5. Starting with version 2.0.0, both
structures are going to be hidden, and the contents of the structures will
only be accessible through the png_get/png_set functions.
The png.h header file is an invaluable reference for programming with libpng. The png.h header file is an invaluable reference for programming with libpng.
And while I'm on the topic, make sure you include the libpng header file: And while I'm on the topic, make sure you include the libpng header file:
@@ -1062,14 +1087,39 @@ dithering, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL) png_read_png(png_ptr, info_ptr, png_transforms, NULL)
where png_transforms is an integer containing the logical-or of some set of where png_transforms is an integer containing the logical OR of
transformation flags. This call is equivalent to png_read_info(), some set of transformation flags. This call is equivalent to png_read_info(),
followed the set of transformations indicated by the transform mask, followed the set of transformations indicated by the transform mask,
followed by png_update_info(), followed by a read of the image bytes then png_read_image(), and finally png_read_end().
to the info_ptr, followed by png_read_end().
(The final parameter of this call is not yet used. Someday it (The final parameter of this call is not yet used. Someday it might point
will point to transformation parameters.) to transformation parameters required by some future input transform.)
After you have called png_read_png(), you can retrieve the image data
with
row_pointers = png_get_rows(png_ptr, info_ptr);
where row_pointers is an array of pointers to the pixel data for each row:
png_bytep row_pointers[height];
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define
row_pointers[i] to point into the proper places in your block.
If you use png_set_rows(), the application is responsible for freeing
row_pointers (and row_pointers[i], if they were separately allocated).
If you don't allocate row_pointers ahead of time, png_read_png() will
do it, and it'll be free'ed when you call png_destroy_*().
.SS The low-level read interface .SS The low-level read interface
@@ -1124,8 +1174,8 @@ in until png_read_end() has read the chunk data following the image.
interlace_type - (PNG_INTERLACE_NONE or interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7) PNG_INTERLACE_ADAM7)
Any or all of interlace_type, compression_type, of Any or all of interlace_type, compression_type, of
filter_type can be filter_type can be NULL if you are not
NULL if you are not interested in their values. interested in their values.
channels = png_get_channels(png_ptr, info_ptr); channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the channels - number of channels of info for the
@@ -1872,7 +1922,7 @@ point to libpng-allocated storage with the following functions:
png_free_data(png_ptr, info_ptr, mask, n) png_free_data(png_ptr, info_ptr, mask, n)
mask - identifies data to be freed, a mask mask - identifies data to be freed, a mask
made up by the OR one or more of containing the logical OR of one or more of
PNG_FREE_PLTE, PNG_FREE_TRNS, PNG_FREE_PLTE, PNG_FREE_TRNS,
PNG_FREE_HIST, PNG_FREE_ICCP, PNG_FREE_HIST, PNG_FREE_ICCP,
PNG_FREE_SPLT, PNG_FREE_ROWS, PNG_FREE_SPLT, PNG_FREE_ROWS,
@@ -1887,12 +1937,12 @@ by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not of the selected data type, such as PLTE, is allowed. If "n" is not
-1, and multiple items are allowed for the data type identified in -1, and multiple items are allowed for the data type identified in
the mask, such as text or splt, only the n'th item is freed. the mask, such as text or sPLT, only the n'th item is freed.
The default behavior is only to free data that was allocated internally The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data, by libpng. This can be changed, so that libpng will not free the data,
or so that it will also free data that was passed in via a png_set_*() or so that it will free data that was allocated by the user with png_malloc()
function, with or png_zalloc() and passed in via a png_set_*() function, with
png_data_freer(png_ptr, info_ptr, freer, mask) png_data_freer(png_ptr, info_ptr, freer, mask)
mask - which data elements are affected mask - which data elements are affected
@@ -1907,7 +1957,14 @@ You can call this function after reading the PNG data but before calling
any png_set_*() functions, to control whether the user or the png_set_*() any png_set_*() functions, to control whether the user or the png_set_*()
function is responsible for freeing any existing data that might be present, function is responsible for freeing any existing data that might be present,
and again after the png_set_*() functions to control whether the user and again after the png_set_*() functions to control whether the user
or png_destroy_*() is supposed to free the data.. or png_destroy_*() is supposed to free the data. When the user assumes
responsibility for libpng-allocated data, the application must use
png_free() to free it.
If you allocated your row_pointers in a single block, as suggested above in
the description of the high level read interface, you must not transfer
responsibility for freeing it to the png_set_rows or png_read_destroy function,
because they would also try to free the individual row_pointers[i].
For a more compact example of reading a PNG image, see the file example.c. For a more compact example of reading a PNG image, see the file example.c.
@@ -2200,7 +2257,7 @@ types.
/* turn on or off filtering, and/or choose /* turn on or off filtering, and/or choose
specific filters. You can use either a single PNG_FILTER_VALUE_NAME specific filters. You can use either a single PNG_FILTER_VALUE_NAME
or the "OR" of one or more PNG_FILTER_NAME masks. */ or the logical OR of one or more PNG_FILTER_NAME masks. */
png_set_filter(png_ptr, 0, png_set_filter(png_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
@@ -2497,7 +2554,7 @@ Compressed pairs must have a text string, as only the text string
is compressed anyway, so the compression would be meaningless. is compressed anyway, so the compression would be meaningless.
PNG supports modification time via the png_time structure. Two PNG supports modification time via the png_time structure. Two
conversion routines are proved, png_convert_from_time_t() for conversion routines are provided, png_convert_from_time_t() for
time_t and png_convert_from_struct_tm() for struct tm. The time_t and png_convert_from_struct_tm() for struct tm. The
time_t routine uses gmtime(). You don't have to use either of time_t routine uses gmtime(). You don't have to use either of
these, but if you wish to fill in the png_time structure directly, these, but if you wish to fill in the png_time structure directly,
@@ -2553,14 +2610,13 @@ If you have valid image data in the info structure, simply do this:
png_write_png(png_ptr, info_ptr, png_transforms, NULL) png_write_png(png_ptr, info_ptr, png_transforms, NULL)
where png_transforms is an integer containing the logical-or of some set of where png_transforms is an integer containing the logical OR of some set of
transformation flags. This call is equivalent to png_write_info(), transformation flags. This call is equivalent to png_write_info(),
followed by the set of transformations indicated by the transform followed the set of transformations indicated by the transform mask,
mask, followed by followed by a write of the image bytes from the then png_write_image(), and finally png_write_end().
info_ptr, followed by png_write_end().
(The final parameter of this call is not yet used. Someday it (The final parameter of this call is not yet used. Someday it might point
may point to output transformation parameters.) to transformation parameters required by some future output transform.)
.SS The low-level write interface .SS The low-level write interface
@@ -2811,7 +2867,7 @@ point to libpng-allocated storage with the following functions:
png_free_data(png_ptr, info_ptr, mask, n) png_free_data(png_ptr, info_ptr, mask, n)
mask - identifies data to be freed, a mask mask - identifies data to be freed, a mask
made up by the OR one or more of containing the logical OR of one or more of
PNG_FREE_PLTE, PNG_FREE_TRNS, PNG_FREE_PLTE, PNG_FREE_TRNS,
PNG_FREE_HIST, PNG_FREE_ICCP, PNG_FREE_HIST, PNG_FREE_ICCP,
PNG_FREE_SPLT, PNG_FREE_ROWS, PNG_FREE_SPLT, PNG_FREE_ROWS,
@@ -2821,20 +2877,21 @@ point to libpng-allocated storage with the following functions:
(-1 for all items) (-1 for all items)
These functions may be safely called when the relevant storage has These functions may be safely called when the relevant storage has
already been freed, or has not yet been allocated, and will in that already been freed, or has not yet been allocated, or was allocated
case do nothing. The "n" parameter is ignored if only one item by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not of the selected data type, such as PLTE, is allowed. If "n" is not
-1, and multiple items are allowed for the data type identified in -1, and multiple items are allowed for the data type identified in
the mask, such as text or splt, only the n'th item is freed. the mask, such as text or sPLT, only the n'th item is freed.
If you allocated data such as a palette that you passed in to libpng with If you allocated data such as a palette that you passed
png_set_*, you must not free it until just before the call to in to libpng with png_set_*, you must not free it until just before the call to
png_destroy_write_struct(). png_destroy_write_struct().
The default behavior is only to free data that was allocated internally The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data, by libpng. This can be changed, so that libpng will not free the data,
or so that it will free data that was passed in via a png_set_*() function, or so that it will free data that was allocated by the user with png_malloc()
with or png_zalloc() and passed in via a png_set_*() function, with
png_data_freer(png_ptr, info_ptr, freer, mask) png_data_freer(png_ptr, info_ptr, freer, mask)
mask - which data elements are affected mask - which data elements are affected
@@ -2860,6 +2917,12 @@ function. Having done this, it would then be safe to destroy the read
structure and continue to use the PLTE, tRNS, and hIST data in the write structure and continue to use the PLTE, tRNS, and hIST data in the write
structure. structure.
This function only affects data that has already been allocated.
You can call this function before calling after the png_set_*() functions
to control whether the user or png_destroy_*() is supposed to free the data.
When the user assumes responsibility for libpng-allocated data, the
application must use png_free() to free it.
For a more compact example of writing a PNG image, see the file example.c. For a more compact example of writing a PNG image, see the file example.c.
.SH V. Modifying/Customizing libpng: .SH V. Modifying/Customizing libpng:
@@ -2874,20 +2937,32 @@ goes through callbacks that are user settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function. these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_malloc() and png_free(). Memory allocation is done through the functions png_malloc(), png_zalloc(),
These currently just call the standard C functions. If and png_free(). These currently just call the standard C functions. If
your pointers can't access more then 64K at a time, you will want to set your pointers can't access more then 64K at a time, you will want to set
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
memory allocation on a platform will change between applications, these memory allocation on a platform will change between applications, these
functions must be modified in the library at compile time. functions must be modified in the library at compile time. If you prefer
to use a different method of allocating and freeing data, you can use
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn)
This function also provides a void pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr);
Your replacement memory functions must have prototypes as follows:
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
void free_fn(png_structp png_ptr, png_voidp ptr);
Input/Output in libpng is done through png_read() and png_write(), Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in which currently just call fread() and fwrite(). The FILE * is stored in
png_struct and is initialized via png_init_io(). If you wish to change png_struct and is initialized via png_init_io(). If you wish to change
the method of I/O, the library supplies callbacks that you can set the method of I/O, the library supplies callbacks that you can set
through the function png_set_read_fn() and png_set_write_fn() at run through the function png_set_read_fn() and png_set_write_fn() at run
time, instead of calling the png_init_io() function. time, instead of calling the png_init_io() function. These functions
These functions
also provide a void pointer that can be retrieved via the function also provide a void pointer that can be retrieved via the function
png_get_io_ptr(). For example: png_get_io_ptr(). For example:
@@ -2901,7 +2976,7 @@ png_get_io_ptr(). For example:
voidp read_io_ptr = png_get_io_ptr(read_ptr); voidp read_io_ptr = png_get_io_ptr(read_ptr);
voidp write_io_ptr = png_get_io_ptr(write_ptr); voidp write_io_ptr = png_get_io_ptr(write_ptr);
The replacement I/O functions should have prototypes as follows: The replacement I/O functions must have prototypes as follows:
void user_read_data(png_structp png_ptr, void user_read_data(png_structp png_ptr,
png_bytep data, png_uint_32 length); png_bytep data, png_uint_32 length);
@@ -3074,8 +3149,8 @@ to turn filtering on and off, respectively.
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB, Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
ORed together '|' to specify one or more filters to use. These ORed together with '|' to specify one or more filters to use.
filters are described in more detail in the PNG specification. If These filters are described in more detail in the PNG specification. If
you intend to change the filter type during the course of writing you intend to change the filter type during the course of writing
the image, you should start with flags set for all of the filters the image, you should start with flags set for all of the filters
you intend to use so that libpng can initialize its internal you intend to use so that libpng can initialize its internal
@@ -3213,8 +3288,10 @@ still alive and well, but they have moved on to other things.
The old libpng functions png_read_init(), png_write_init(), The old libpng functions png_read_init(), png_write_init(),
png_info_init(), png_read_destroy(), and png_write_destory() have been png_info_init(), png_read_destroy(), and png_write_destory() have been
moved to PNG_INTERNAL in version 0.95 to discourage their use. The moved to PNG_INTERNAL in version 0.95 to discourage their use. These
preferred method of creating and initializing the libpng structures is functions will be removed from libpng version 2.0.0.
The preferred method of creating and initializing the libpng structures is
via the png_create_read_struct(), png_create_write_struct(), and via the png_create_read_struct(), png_create_write_struct(), and
png_create_info_struct() because they isolate the size of the structures png_create_info_struct() because they isolate the size of the structures
from the application, allow version error checking, and also allow the from the application, allow version error checking, and also allow the
@@ -3231,19 +3308,19 @@ png_read_init() as was suggested in libpng-0.88 is no longer supported
because this caused applications that do not use custom error functions because this caused applications that do not use custom error functions
to fail if the png_ptr was not initialized to zero. It is still possible to fail if the png_ptr was not initialized to zero. It is still possible
to set the error callbacks AFTER png_read_init(), or to change them with to set the error callbacks AFTER png_read_init(), or to change them with
png_set_error_fn(), which is essentially the same function, but with a png_set_error_fn(), which is essentially the same function, but with a new
new name to force compilation errors with applications that try to use name to force compilation errors with applications that try to use the old
the old method. method.
.SH VII. Y2K Compliance in libpng .SH VII. Y2K Compliance in libpng
April 24, 2000 May 6, 2000
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.6h are Y2K compliant. It is my belief that earlier upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that
@@ -3384,7 +3461,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.0.6h - April 24, 2000: Libpng version 1.0.7beta11 - May 6, 2000:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
@@ -3399,7 +3476,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996, 1997 Andreas Dilger
(libpng versions 0.89c, May 1996, through 0.96, May 1997) (libpng versions 0.89c, May 1996, through 0.96, May 1997)
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
(libpng versions 0.97, January 1998, through 1.0.6h, April 24, 2000) (libpng versions 0.97, January 1998, through 1.0.7beta11, May 6, 2000)
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:

View File

@@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.6h - April 24, 2000 libpng version 1.0.7beta11 - May 6, 2000
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<randeg@alum.rpi.edu> <randeg@alum.rpi.edu>
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -94,9 +94,20 @@ The png_info structure is designed to provide information about the
PNG file. At one time, the fields of png_info were intended to be PNG file. At one time, the fields of png_info were intended to be
directly accessible to the user. However, this tended to cause problems directly accessible to the user. However, this tended to cause problems
with applications using dynamically loaded libraries, and as a result with applications using dynamically loaded libraries, and as a result
a set of interface functions for png_info was developed. The fields a set of interface functions for png_info (the png_get_*() and png_set_*()
of png_info are still available for older applications, but it is functions) was developed. The fields of png_info are still available for
suggested that applications use the new interfaces if at all possible. older applications, but it is suggested that applications use the new
interfaces if at all possible.
Applications that do make direct access to the members of png_struct (except
for png_ptr->jmpbuf) must be recompiled whenever the library is updated,
and applications that make direct access to the members of png_info must
be recompiled if they were compiled or loaded with libpng version 1.0.6,
in which the members were in a different order. In version 1.0.7, the
members of the png_info structure reverted to the old order, as they were
in versions 0.97c through 1.0.5. Starting with version 2.0.0, both
structures are going to be hidden, and the contents of the structures will
only be accessible through the png_get/png_set functions.
The png.h header file is an invaluable reference for programming with libpng. The png.h header file is an invaluable reference for programming with libpng.
And while I'm on the topic, make sure you include the libpng header file: And while I'm on the topic, make sure you include the libpng header file:
@@ -337,14 +348,39 @@ dithering, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL) png_read_png(png_ptr, info_ptr, png_transforms, NULL)
where png_transforms is an integer containing the logical-or of some set of where png_transforms is an integer containing the logical OR of
transformation flags. This call is equivalent to png_read_info(), some set of transformation flags. This call is equivalent to png_read_info(),
followed the set of transformations indicated by the transform mask, followed the set of transformations indicated by the transform mask,
followed by png_update_info(), followed by a read of the image bytes then png_read_image(), and finally png_read_end().
to the info_ptr, followed by png_read_end().
(The final parameter of this call is not yet used. Someday it (The final parameter of this call is not yet used. Someday it might point
will point to transformation parameters.) to transformation parameters required by some future input transform.)
After you have called png_read_png(), you can retrieve the image data
with
row_pointers = png_get_rows(png_ptr, info_ptr);
where row_pointers is an array of pointers to the pixel data for each row:
png_bytep row_pointers[height];
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
row_pointers = png_malloc(png_ptr, height*sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr, width*pixel_size);
png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define
row_pointers[i] to point into the proper places in your block.
If you use png_set_rows(), the application is responsible for freeing
row_pointers (and row_pointers[i], if they were separately allocated).
If you don't allocate row_pointers ahead of time, png_read_png() will
do it, and it'll be free'ed when you call png_destroy_*().
The low-level read interface The low-level read interface
@@ -399,8 +435,8 @@ in until png_read_end() has read the chunk data following the image.
interlace_type - (PNG_INTERLACE_NONE or interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7) PNG_INTERLACE_ADAM7)
Any or all of interlace_type, compression_type, of Any or all of interlace_type, compression_type, of
filter_type can be filter_type can be NULL if you are not
NULL if you are not interested in their values. interested in their values.
channels = png_get_channels(png_ptr, info_ptr); channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the channels - number of channels of info for the
@@ -1147,7 +1183,7 @@ point to libpng-allocated storage with the following functions:
png_free_data(png_ptr, info_ptr, mask, n) png_free_data(png_ptr, info_ptr, mask, n)
mask - identifies data to be freed, a mask mask - identifies data to be freed, a mask
made up by the OR one or more of containing the logical OR of one or more of
PNG_FREE_PLTE, PNG_FREE_TRNS, PNG_FREE_PLTE, PNG_FREE_TRNS,
PNG_FREE_HIST, PNG_FREE_ICCP, PNG_FREE_HIST, PNG_FREE_ICCP,
PNG_FREE_SPLT, PNG_FREE_ROWS, PNG_FREE_SPLT, PNG_FREE_ROWS,
@@ -1162,12 +1198,12 @@ by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not of the selected data type, such as PLTE, is allowed. If "n" is not
-1, and multiple items are allowed for the data type identified in -1, and multiple items are allowed for the data type identified in
the mask, such as text or splt, only the n'th item is freed. the mask, such as text or sPLT, only the n'th item is freed.
The default behavior is only to free data that was allocated internally The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data, by libpng. This can be changed, so that libpng will not free the data,
or so that it will also free data that was passed in via a png_set_*() or so that it will free data that was allocated by the user with png_malloc()
function, with or png_zalloc() and passed in via a png_set_*() function, with
png_data_freer(png_ptr, info_ptr, freer, mask) png_data_freer(png_ptr, info_ptr, freer, mask)
mask - which data elements are affected mask - which data elements are affected
@@ -1182,7 +1218,14 @@ You can call this function after reading the PNG data but before calling
any png_set_*() functions, to control whether the user or the png_set_*() any png_set_*() functions, to control whether the user or the png_set_*()
function is responsible for freeing any existing data that might be present, function is responsible for freeing any existing data that might be present,
and again after the png_set_*() functions to control whether the user and again after the png_set_*() functions to control whether the user
or png_destroy_*() is supposed to free the data.. or png_destroy_*() is supposed to free the data. When the user assumes
responsibility for libpng-allocated data, the application must use
png_free() to free it.
If you allocated your row_pointers in a single block, as suggested above in
the description of the high level read interface, you must not transfer
responsibility for freeing it to the png_set_rows or png_read_destroy function,
because they would also try to free the individual row_pointers[i].
For a more compact example of reading a PNG image, see the file example.c. For a more compact example of reading a PNG image, see the file example.c.
@@ -1475,7 +1518,7 @@ types.
/* turn on or off filtering, and/or choose /* turn on or off filtering, and/or choose
specific filters. You can use either a single PNG_FILTER_VALUE_NAME specific filters. You can use either a single PNG_FILTER_VALUE_NAME
or the "OR" of one or more PNG_FILTER_NAME masks. */ or the logical OR of one or more PNG_FILTER_NAME masks. */
png_set_filter(png_ptr, 0, png_set_filter(png_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
@@ -1772,7 +1815,7 @@ Compressed pairs must have a text string, as only the text string
is compressed anyway, so the compression would be meaningless. is compressed anyway, so the compression would be meaningless.
PNG supports modification time via the png_time structure. Two PNG supports modification time via the png_time structure. Two
conversion routines are proved, png_convert_from_time_t() for conversion routines are provided, png_convert_from_time_t() for
time_t and png_convert_from_struct_tm() for struct tm. The time_t and png_convert_from_struct_tm() for struct tm. The
time_t routine uses gmtime(). You don't have to use either of time_t routine uses gmtime(). You don't have to use either of
these, but if you wish to fill in the png_time structure directly, these, but if you wish to fill in the png_time structure directly,
@@ -1828,14 +1871,13 @@ If you have valid image data in the info structure, simply do this:
png_write_png(png_ptr, info_ptr, png_transforms, NULL) png_write_png(png_ptr, info_ptr, png_transforms, NULL)
where png_transforms is an integer containing the logical-or of some set of where png_transforms is an integer containing the logical OR of some set of
transformation flags. This call is equivalent to png_write_info(), transformation flags. This call is equivalent to png_write_info(),
followed by the set of transformations indicated by the transform followed the set of transformations indicated by the transform mask,
mask, followed by followed by a write of the image bytes from the then png_write_image(), and finally png_write_end().
info_ptr, followed by png_write_end().
(The final parameter of this call is not yet used. Someday it (The final parameter of this call is not yet used. Someday it might point
may point to output transformation parameters.) to transformation parameters required by some future output transform.)
The low-level write interface The low-level write interface
@@ -2086,7 +2128,7 @@ point to libpng-allocated storage with the following functions:
png_free_data(png_ptr, info_ptr, mask, n) png_free_data(png_ptr, info_ptr, mask, n)
mask - identifies data to be freed, a mask mask - identifies data to be freed, a mask
made up by the OR one or more of containing the logical OR of one or more of
PNG_FREE_PLTE, PNG_FREE_TRNS, PNG_FREE_PLTE, PNG_FREE_TRNS,
PNG_FREE_HIST, PNG_FREE_ICCP, PNG_FREE_HIST, PNG_FREE_ICCP,
PNG_FREE_SPLT, PNG_FREE_ROWS, PNG_FREE_SPLT, PNG_FREE_ROWS,
@@ -2096,20 +2138,21 @@ point to libpng-allocated storage with the following functions:
(-1 for all items) (-1 for all items)
These functions may be safely called when the relevant storage has These functions may be safely called when the relevant storage has
already been freed, or has not yet been allocated, and will in that already been freed, or has not yet been allocated, or was allocated
case do nothing. The "n" parameter is ignored if only one item by the user and not by libpng, and will in those
cases do nothing. The "n" parameter is ignored if only one item
of the selected data type, such as PLTE, is allowed. If "n" is not of the selected data type, such as PLTE, is allowed. If "n" is not
-1, and multiple items are allowed for the data type identified in -1, and multiple items are allowed for the data type identified in
the mask, such as text or splt, only the n'th item is freed. the mask, such as text or sPLT, only the n'th item is freed.
If you allocated data such as a palette that you passed in to libpng with If you allocated data such as a palette that you passed
png_set_*, you must not free it until just before the call to in to libpng with png_set_*, you must not free it until just before the call to
png_destroy_write_struct(). png_destroy_write_struct().
The default behavior is only to free data that was allocated internally The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data, by libpng. This can be changed, so that libpng will not free the data,
or so that it will free data that was passed in via a png_set_*() function, or so that it will free data that was allocated by the user with png_malloc()
with or png_zalloc() and passed in via a png_set_*() function, with
png_data_freer(png_ptr, info_ptr, freer, mask) png_data_freer(png_ptr, info_ptr, freer, mask)
mask - which data elements are affected mask - which data elements are affected
@@ -2135,6 +2178,12 @@ function. Having done this, it would then be safe to destroy the read
structure and continue to use the PLTE, tRNS, and hIST data in the write structure and continue to use the PLTE, tRNS, and hIST data in the write
structure. structure.
This function only affects data that has already been allocated.
You can call this function before calling after the png_set_*() functions
to control whether the user or png_destroy_*() is supposed to free the data.
When the user assumes responsibility for libpng-allocated data, the
application must use png_free() to free it.
For a more compact example of writing a PNG image, see the file example.c. For a more compact example of writing a PNG image, see the file example.c.
V. Modifying/Customizing libpng: V. Modifying/Customizing libpng:
@@ -2149,20 +2198,32 @@ goes through callbacks that are user settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function. these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_malloc() and png_free(). Memory allocation is done through the functions png_malloc(), png_zalloc(),
These currently just call the standard C functions. If and png_free(). These currently just call the standard C functions. If
your pointers can't access more then 64K at a time, you will want to set your pointers can't access more then 64K at a time, you will want to set
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
memory allocation on a platform will change between applications, these memory allocation on a platform will change between applications, these
functions must be modified in the library at compile time. functions must be modified in the library at compile time. If you prefer
to use a different method of allocating and freeing data, you can use
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn)
This function also provides a void pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr);
Your replacement memory functions must have prototypes as follows:
png_voidp malloc_fn(png_structp png_ptr, png_uint_32 size);
void free_fn(png_structp png_ptr, png_voidp ptr);
Input/Output in libpng is done through png_read() and png_write(), Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in which currently just call fread() and fwrite(). The FILE * is stored in
png_struct and is initialized via png_init_io(). If you wish to change png_struct and is initialized via png_init_io(). If you wish to change
the method of I/O, the library supplies callbacks that you can set the method of I/O, the library supplies callbacks that you can set
through the function png_set_read_fn() and png_set_write_fn() at run through the function png_set_read_fn() and png_set_write_fn() at run
time, instead of calling the png_init_io() function. time, instead of calling the png_init_io() function. These functions
These functions
also provide a void pointer that can be retrieved via the function also provide a void pointer that can be retrieved via the function
png_get_io_ptr(). For example: png_get_io_ptr(). For example:
@@ -2176,7 +2237,7 @@ png_get_io_ptr(). For example:
voidp read_io_ptr = png_get_io_ptr(read_ptr); voidp read_io_ptr = png_get_io_ptr(read_ptr);
voidp write_io_ptr = png_get_io_ptr(write_ptr); voidp write_io_ptr = png_get_io_ptr(write_ptr);
The replacement I/O functions should have prototypes as follows: The replacement I/O functions must have prototypes as follows:
void user_read_data(png_structp png_ptr, void user_read_data(png_structp png_ptr,
png_bytep data, png_uint_32 length); png_bytep data, png_uint_32 length);
@@ -2349,8 +2410,8 @@ to turn filtering on and off, respectively.
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB, Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
ORed together '|' to specify one or more filters to use. These ORed together with '|' to specify one or more filters to use.
filters are described in more detail in the PNG specification. If These filters are described in more detail in the PNG specification. If
you intend to change the filter type during the course of writing you intend to change the filter type during the course of writing
the image, you should start with flags set for all of the filters the image, you should start with flags set for all of the filters
you intend to use so that libpng can initialize its internal you intend to use so that libpng can initialize its internal
@@ -2488,8 +2549,10 @@ still alive and well, but they have moved on to other things.
The old libpng functions png_read_init(), png_write_init(), The old libpng functions png_read_init(), png_write_init(),
png_info_init(), png_read_destroy(), and png_write_destory() have been png_info_init(), png_read_destroy(), and png_write_destory() have been
moved to PNG_INTERNAL in version 0.95 to discourage their use. The moved to PNG_INTERNAL in version 0.95 to discourage their use. These
preferred method of creating and initializing the libpng structures is functions will be removed from libpng version 2.0.0.
The preferred method of creating and initializing the libpng structures is
via the png_create_read_struct(), png_create_write_struct(), and via the png_create_read_struct(), png_create_write_struct(), and
png_create_info_struct() because they isolate the size of the structures png_create_info_struct() because they isolate the size of the structures
from the application, allow version error checking, and also allow the from the application, allow version error checking, and also allow the
@@ -2506,19 +2569,19 @@ png_read_init() as was suggested in libpng-0.88 is no longer supported
because this caused applications that do not use custom error functions because this caused applications that do not use custom error functions
to fail if the png_ptr was not initialized to zero. It is still possible to fail if the png_ptr was not initialized to zero. It is still possible
to set the error callbacks AFTER png_read_init(), or to change them with to set the error callbacks AFTER png_read_init(), or to change them with
png_set_error_fn(), which is essentially the same function, but with a png_set_error_fn(), which is essentially the same function, but with a new
new name to force compilation errors with applications that try to use name to force compilation errors with applications that try to use the old
the old method. method.
VII. Y2K Compliance in libpng VII. Y2K Compliance in libpng
April 24, 2000 May 6, 2000
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.0.6h are Y2K compliant. It is my belief that earlier upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that

View File

@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "April 24, 2000" .TH LIBPNGPF 3 "May 6, 2000"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta11
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP
@@ -383,10 +383,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h
\fI\fB \fI\fB
\fBvoid png_read_init (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB \fI\fB
@@ -469,10 +465,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h
\fI\fB \fI\fB
\fBvoid png_write_init (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext)\fP\fB);\fP \fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext)\fP\fB);\fP
\fI\fB \fI\fB

2
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "April 24, 2000" .TH PNG 5 "May 6, 2000"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

84
png.c
View File

@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* libpng version 1.0.6h - April 24, 2000 * libpng version 1.0.7beta11 - May 6, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -14,14 +14,14 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_6h Your_png_h_is_not_version_1_0_6h; typedef version_1_0_7beta11 Your_png_h_is_not_version_1_0_7beta11;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. */ * string defined in png.h. */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */ /* png_libpng_ver was changed to a function in version 1.0.5c */
char png_libpng_ver[12] = "1.0.6h"; char png_libpng_ver[12] = "1.0.7beta11";
/* png_sig was changed to a function in version 1.0.5c */ /* png_sig was changed to a function in version 1.0.5c */
/* Place to hold the signature string for a PNG file. */ /* Place to hold the signature string for a PNG file. */
@@ -88,7 +88,7 @@ int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
* or write any of the magic bytes before it starts on the IHDR. * or write any of the magic bytes before it starts on the IHDR.
*/ */
void void PNGAPI
png_set_sig_bytes(png_structp png_ptr, int num_bytes) png_set_sig_bytes(png_structp png_ptr, int num_bytes)
{ {
png_debug(1, "in png_set_sig_bytes\n"); png_debug(1, "in png_set_sig_bytes\n");
@@ -106,7 +106,7 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes)
* respectively, to be less than, to match, or be greater than the correct * respectively, to be less than, to match, or be greater than the correct
* PNG signature (this is the same behaviour as strcmp, memcmp, etc). * PNG signature (this is the same behaviour as strcmp, memcmp, etc).
*/ */
int int PNGAPI
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
{ {
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@@ -128,14 +128,14 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
* to check a partial signature. This function might be removed in the * to check a partial signature. This function might be removed in the
* future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG. * future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG.
*/ */
int int PNGAPI
png_check_sig(png_bytep sig, int num) png_check_sig(png_bytep sig, int num)
{ {
return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num)); return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num));
} }
/* Function to allocate memory for zlib. */ /* Function to allocate memory for zlib and clear it to 0. */
voidpf voidpf PNGAPI
png_zalloc(voidpf png_ptr, uInt items, uInt size) png_zalloc(voidpf png_ptr, uInt items, uInt size)
{ {
png_uint_32 num_bytes = (png_uint_32)items * size; png_uint_32 num_bytes = (png_uint_32)items * size;
@@ -155,7 +155,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
} }
/* function to free memory for zlib */ /* function to free memory for zlib */
void void PNGAPI
png_zfree(voidpf png_ptr, voidpf ptr) png_zfree(voidpf png_ptr, voidpf ptr)
{ {
png_free((png_structp)png_ptr, (png_voidp)ptr); png_free((png_structp)png_ptr, (png_voidp)ptr);
@@ -164,7 +164,7 @@ png_zfree(voidpf png_ptr, voidpf ptr)
/* Reset the CRC variable to 32 bits of 1's. Care must be taken /* Reset the CRC variable to 32 bits of 1's. Care must be taken
* in case CRC is > 32 bits to leave the top bits 0. * in case CRC is > 32 bits to leave the top bits 0.
*/ */
void void /* PRIVATE */
png_reset_crc(png_structp png_ptr) png_reset_crc(png_structp png_ptr)
{ {
png_ptr->crc = crc32(0, Z_NULL, 0); png_ptr->crc = crc32(0, Z_NULL, 0);
@@ -175,7 +175,7 @@ png_reset_crc(png_structp png_ptr)
* also check that this data will actually be used before going to the * also check that this data will actually be used before going to the
* trouble of calculating it. * trouble of calculating it.
*/ */
void void /* PRIVATE */
png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length) png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
{ {
int need_crc = 1; int need_crc = 1;
@@ -202,7 +202,7 @@ png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
* and png_info_init() so that applications that want to use a shared * and png_info_init() so that applications that want to use a shared
* libpng don't have to be recompiled if png_info changes size. * libpng don't have to be recompiled if png_info changes size.
*/ */
png_infop png_infop PNGAPI
png_create_info_struct(png_structp png_ptr) png_create_info_struct(png_structp png_ptr)
{ {
png_infop info_ptr; png_infop info_ptr;
@@ -227,7 +227,7 @@ png_create_info_struct(png_structp png_ptr)
* png_destroy_write_struct() to free an info struct, but this may be * png_destroy_write_struct() to free an info struct, but this may be
* useful for some applications. * useful for some applications.
*/ */
void void PNGAPI
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
{ {
png_infop info_ptr = NULL; png_infop info_ptr = NULL;
@@ -253,7 +253,7 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
* and applications using it are urged to use png_create_info_struct() * and applications using it are urged to use png_create_info_struct()
* instead. * instead.
*/ */
void void PNGAPI
png_info_init(png_infop info_ptr) png_info_init(png_infop info_ptr)
{ {
png_debug(1, "in png_info_init\n"); png_debug(1, "in png_info_init\n");
@@ -261,7 +261,8 @@ png_info_init(png_infop info_ptr)
png_memset(info_ptr, 0, sizeof (png_info)); png_memset(info_ptr, 0, sizeof (png_info));
} }
void #ifdef PNG_FREE_ME_SUPPORTED
void PNGAPI
png_data_freer(png_structp png_ptr, png_infop info_ptr, png_data_freer(png_structp png_ptr, png_infop info_ptr,
int freer, png_uint_32 mask) int freer, png_uint_32 mask)
{ {
@@ -276,8 +277,9 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
png_warning(png_ptr, png_warning(png_ptr,
"Unknown freer parameter in png_data_freer."); "Unknown freer parameter in png_data_freer.");
} }
#endif
void void PNGAPI
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num) png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num)
{ {
png_debug(1, "in png_free_data\n"); png_debug(1, "in png_free_data\n");
@@ -286,7 +288,9 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num
#if defined(PNG_TEXT_SUPPORTED) #if defined(PNG_TEXT_SUPPORTED)
/* free text item num or (if num == -1) all text items */ /* free text item num or (if num == -1) all text items */
#ifdef PNG_FREE_ME_SUPPORTED
if (mask & info_ptr->free_me & PNG_FREE_TEXT) if (mask & info_ptr->free_me & PNG_FREE_TEXT)
#endif
{ {
if (num != -1) if (num != -1)
{ {
@@ -314,7 +318,11 @@ if (mask & PNG_FREE_TRNS)
{ {
if (info_ptr->valid & PNG_INFO_tRNS) if (info_ptr->valid & PNG_INFO_tRNS)
{ {
#ifdef PNG_FREE_ME_SUPPORTED
if (info_ptr->free_me & PNG_FREE_TRNS) if (info_ptr->free_me & PNG_FREE_TRNS)
#else
if (png_ptr->flags & PNG_FLAG_FREE_TRNS)
#endif
png_free(png_ptr, info_ptr->trans); png_free(png_ptr, info_ptr->trans);
info_ptr->valid &= ~PNG_INFO_tRNS; info_ptr->valid &= ~PNG_INFO_tRNS;
} }
@@ -362,7 +370,9 @@ if (mask & PNG_FREE_ICCP)
{ {
if (info_ptr->valid & PNG_INFO_iCCP) if (info_ptr->valid & PNG_INFO_iCCP)
{ {
#ifdef PNG_FREE_ME_SUPPORTED
if (info_ptr->free_me & PNG_FREE_ICCP) if (info_ptr->free_me & PNG_FREE_ICCP)
#endif
{ {
png_free(png_ptr, info_ptr->iccp_name); png_free(png_ptr, info_ptr->iccp_name);
png_free(png_ptr, info_ptr->iccp_profile); png_free(png_ptr, info_ptr->iccp_profile);
@@ -427,7 +437,11 @@ if (mask & PNG_FREE_HIST)
{ {
if (info_ptr->valid & PNG_INFO_hIST) if (info_ptr->valid & PNG_INFO_hIST)
{ {
#ifdef PNG_FREE_ME_SUPPORTED
if (info_ptr->free_me & PNG_FREE_HIST) if (info_ptr->free_me & PNG_FREE_HIST)
#else
if (png_ptr->flags & PNG_FLAG_FREE_HIST)
#endif
png_free(png_ptr, info_ptr->hist); png_free(png_ptr, info_ptr->hist);
info_ptr->valid &= ~PNG_INFO_hIST; info_ptr->valid &= ~PNG_INFO_hIST;
} }
@@ -439,7 +453,11 @@ if (mask & PNG_FREE_PLTE)
{ {
if (info_ptr->valid & PNG_INFO_PLTE) if (info_ptr->valid & PNG_INFO_PLTE)
{ {
#ifdef PNG_FREE_ME_SUPPORTED
if (info_ptr->free_me & PNG_FREE_PLTE) if (info_ptr->free_me & PNG_FREE_PLTE)
#else
if (png_ptr->flags & PNG_FLAG_FREE_PLTE)
#endif
png_zfree(png_ptr, info_ptr->palette); png_zfree(png_ptr, info_ptr->palette);
info_ptr->valid &= ~(PNG_INFO_PLTE); info_ptr->valid &= ~(PNG_INFO_PLTE);
info_ptr->num_palette = 0; info_ptr->num_palette = 0;
@@ -450,7 +468,9 @@ if (mask & PNG_FREE_PLTE)
/* free any image bits attached to the info structure */ /* free any image bits attached to the info structure */
if (mask & PNG_FREE_ROWS) if (mask & PNG_FREE_ROWS)
{ {
#ifdef PNG_FREE_ME_SUPPORTED
if (info_ptr->free_me & PNG_FREE_ROWS) if (info_ptr->free_me & PNG_FREE_ROWS)
#endif
{ {
int row; int row;
@@ -460,22 +480,24 @@ if (mask & PNG_FREE_ROWS)
} }
} }
#endif #endif
#ifdef PNG_FREE_ME_SUPPORTED
if(num == -1) if(num == -1)
info_ptr->free_me &= ~mask; info_ptr->free_me &= ~mask;
#endif
} }
/* This is an internal routine to free any memory that the info struct is /* This is an internal routine to free any memory that the info struct is
* pointing to before re-using it or freeing the struct itself. Recall * pointing to before re-using it or freeing the struct itself. Recall
* that png_free() checks for NULL pointers for us. * that png_free() checks for NULL pointers for us.
*/ */
void void /* PRIVATE */
png_info_destroy(png_structp png_ptr, png_infop info_ptr) png_info_destroy(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_info_destroy\n"); png_debug(1, "in png_info_destroy\n");
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
if (png_ptr->num_chunk_list) if (png_ptr->num_chunk_list)
{ {
png_free(png_ptr, png_ptr->chunk_list); png_free(png_ptr, png_ptr->chunk_list);
@@ -490,7 +512,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
* functions. The application should free any memory associated with this * functions. The application should free any memory associated with this
* pointer before png_write_destroy() or png_read_destroy() are called. * pointer before png_write_destroy() or png_read_destroy() are called.
*/ */
png_voidp png_voidp PNGAPI
png_get_io_ptr(png_structp png_ptr) png_get_io_ptr(png_structp png_ptr)
{ {
return (png_ptr->io_ptr); return (png_ptr->io_ptr);
@@ -503,7 +525,7 @@ png_get_io_ptr(png_structp png_ptr)
* PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't * PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
* necessarily available. * necessarily available.
*/ */
void void PNGAPI
png_init_io(png_structp png_ptr, FILE *fp) png_init_io(png_structp png_ptr, FILE *fp)
{ {
png_debug(1, "in png_init_io\n"); png_debug(1, "in png_init_io\n");
@@ -515,7 +537,7 @@ png_init_io(png_structp png_ptr, FILE *fp)
/* Convert the supplied time into an RFC 1123 string suitable for use in /* Convert the supplied time into an RFC 1123 string suitable for use in
* a "Creation Time" or other text-based time string. * a "Creation Time" or other text-based time string.
*/ */
png_charp png_charp PNGAPI
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime) png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
{ {
static PNG_CONST char short_months[12][4] = static PNG_CONST char short_months[12][4] =
@@ -550,18 +572,18 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
#if 0 #if 0
/* Signature string for a PNG file. */ /* Signature string for a PNG file. */
png_bytep png_bytep PNGAPI
png_sig_bytes(void) png_sig_bytes(void)
{ {
return ((png_bytep)"\211\120\116\107\015\012\032\012"); return ((png_bytep)"\211\120\116\107\015\012\032\012");
} }
#endif #endif
png_charp png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
return ("\n libpng version 1.0.6h - April 24, 2000\n\ return ("\n libpng version 1.0.7beta11 - May 6, 2000\n\
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\
Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n"); Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n");
@@ -574,16 +596,16 @@ png_get_copyright(png_structp png_ptr)
* in png.h. * in png.h.
*/ */
png_charp png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr) png_get_libpng_ver(png_structp png_ptr)
{ {
/* Version of *.c files used when building libpng */ /* Version of *.c files used when building libpng */
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
return("1.0.6h"); return("1.0.7beta11");
return("1.0.6h"); return("1.0.7beta11");
} }
png_charp png_charp PNGAPI
png_get_header_ver(png_structp png_ptr) png_get_header_ver(png_structp png_ptr)
{ {
/* Version of *.h files used when building libpng */ /* Version of *.h files used when building libpng */
@@ -592,7 +614,7 @@ png_get_header_ver(png_structp png_ptr)
return(PNG_LIBPNG_VER_STRING); return(PNG_LIBPNG_VER_STRING);
} }
png_charp png_charp PNGAPI
png_get_header_version(png_structp png_ptr) png_get_header_version(png_structp png_ptr)
{ {
/* Returns longer string containing both version and date */ /* Returns longer string containing both version and date */
@@ -602,7 +624,7 @@ png_get_header_version(png_structp png_ptr)
} }
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int int PNGAPI
png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name) png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
{ {
/* check chunk_name and return "keep" value if it's on the list, else 0 */ /* check chunk_name and return "keep" value if it's on the list, else 0 */
@@ -619,7 +641,7 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
#endif #endif
/* This function, added to libpng-1.0.6g, is untested. */ /* This function, added to libpng-1.0.6g, is untested. */
int int PNGAPI
png_reset_zstream(png_structp png_ptr) png_reset_zstream(png_structp png_ptr)
{ {
return (inflateReset(&png_ptr->zstream)); return (inflateReset(&png_ptr->zstream));

237
png.h
View File

@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.0.6h - April 24, 2000 * libpng version 1.0.7beta11 - May 6, 2000
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -9,7 +9,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.0.6h - April 24, 2000: Glenn * libpng versions 0.97, January 1998, through 1.0.7beta11 - May 6, 2000: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@@ -20,37 +20,43 @@
* The following table summarizes matters since version 0.89c, which was * The following table summarizes matters since version 0.89c, which was
* the first widely used release: * the first widely used release:
* *
* source png.h png.h shared-lib * source png.h png.h shared-lib
* version string int version * version string int version
* ------- ------ ----- ---------- * ------- ------ ----- ----------
* 0.89c ("1.0 beta 3") 0.89 89 1.0.89 * 0.89c "1.0 beta 3" 0.89 89 1.0.89
* 0.90 ("1.0 beta 4") 0.90 90 0.90 [should have been 2.0.90] * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
* 0.95 ("1.0 beta 5") 0.95 95 0.95 [should have been 2.0.95] * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
* 0.96 ("1.0 beta 6") 0.96 96 0.96 [should have been 2.0.96] * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
* 0.97b ("1.00.97 beta 7") 1.00.97 97 1.0.1 [should have been 2.0.97] * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
* 0.97c 0.97 97 2.0.97 * 0.97c 0.97 97 2.0.97
* 0.98 0.98 98 2.0.98 * 0.98 0.98 98 2.0.98
* 0.99 0.99 98 2.0.99 * 0.99 0.99 98 2.0.99
* 0.99a-m 0.99 99 2.0.99 * 0.99a-m 0.99 99 2.0.99
* 1.00 1.00 100 2.1.0 [100 should be 10000] * 1.00 1.00 100 2.1.0 [100 should be 10000]
* 1.0.0 1.0.0 100 2.1.0 [100 should be 10000] * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
* 1.0.1 1.0.1 10001 2.1.0 * 1.0.1 png.h string is 10001 2.1.0
* 1.0.1a-e 1.0.1a-e 10002 2.1.0.1a-e * 1.0.1a-e identical to the 10002 from here on, the shared library
* 1.0.2 1.0.2 10002 2.1.0.2 * 1.0.2 source version) 10002 is 2.V where V is the source code
* 1.0.2a-b 1.0.2a-b 10003 2.1.0.2a-b * 1.0.2a-b 10003 version, except as noted.
* 1.0.3 1.0.3 10003 2.1.0.3 * 1.0.3 10003
* 1.0.3a-d 1.0.3a-d 10004 2.1.0.3a-d * 1.0.3a-d 10004
* 1.0.4 1.0.4 10004 2.1.0.4 * 1.0.4 10004
* 1.0.4a-f 1.0.4a-f 10005 2.1.0.4a-f * 1.0.4a-f 10005
* 1.0.5 (+ 2 patches) 1.0.5 10005 2.1.0.5 * 1.0.5 (+ 2 patches) 10005
* 1.0.5a-d 1.0.5a-d 10006 2.1.0.5a-d * 1.0.5a-d 10006
* 1.0.5e-r 1.0.5e-r 10100 2.1.0.5e-r (not source compatible) * 1.0.5e-r 10100 (not source compatible)
* 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (not binary compatible) * 1.0.5s-v 10006 (not binary compatible)
* 1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6 (still binary incompat) * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
* 1.0.6d-f 1.0.6d-f 10007 2.1.0.6d-f (still binary incompat) * 1.0.6d-f 10007 (still binary incompatible)
* 1.0.6g 1.0.6g 10007 2.1.0.6g (compatible with 1.0.5) * 1.0.6g 10007
* 1.0.6h 1.0.6h 10007 10.6h (compatible with 1.0.5) * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
* 1.0.7 1.0.7 10007 10.7 (still compatible) * 1.0.6i 10007 10.6i
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
* 1.0.7beta11 10007 2.1.0.7beta11 (still compatible)
* planned:
* 1.0.7prep00 10007 2.1.0.7prep00 (still compatible)
* 1.0.6ptch04 (w/4 patches) 10006 2.1.0.6 (binary compatible)
* 1.0.7 10007 (still compatible)
* *
* 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
@@ -58,7 +64,9 @@
* PNG_PNGLIB_VER macro, which is not used within libpng but is available * PNG_PNGLIB_VER macro, which is not used within libpng but is available
* for applications, is an unsigned integer of the form xyyzz corresponding * for applications, is an unsigned integer of the form xyyzz corresponding
* to the source version x.y.z (leading zeros in y and z). Beta versions * to the source version x.y.z (leading zeros in y and z). Beta versions
* are given the previous public release number plus a letter or two. * were given the previous public release number plus a letter, until
* version 1.0.6j; from then on they were given the upcoming public
* release number plus "-beta-nn" or "-pre-nn".
* *
* Binary incompatibility exists only when applications make direct access * Binary incompatibility exists only when applications make direct access
* to the info_ptr or png_ptr members through png.h, and the compiled * to the info_ptr or png_ptr members through png.h, and the compiled
@@ -79,7 +87,7 @@
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
* (libpng versions 0.89c, June 1996, through 0.96, May 1997) * (libpng versions 0.89c, June 1996, through 0.96, May 1997)
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* (libpng versions 0.97, January 1998, through 1.0.6h, April 24, 2000) * (libpng versions 0.97, January 1998, through 1.0.7beta11, May 6, 2000)
* *
* For the purposes of this copyright and license, "Contributing Authors" * For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals: * is defined as the following set of individuals:
@@ -154,13 +162,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* April 24, 2000 * May 6, 2000
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.0.6h are Y2K compliant. It is my belief that earlier * upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant. * versions were also Y2K compliant.
* *
* Libpng only has three year fields. One is a 2-byte unsigned integer * Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -238,7 +246,7 @@ extern "C" {
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.0.6h" #define PNG_LIBPNG_VER_STRING "1.0.7beta11"
/* Careful here. At one time, Guy wanted to use 082, but that would be octal. /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros. * We must not include leading zeros.
@@ -255,7 +263,8 @@ extern "C" {
* the version above. * the version above.
*/ */
#ifdef PNG_USE_GLOBAL_ARRAYS #ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (char) png_libpng_ver[12]; /* need room for 99.99.99aa */ PNG_EXPORT_VAR (char) png_libpng_ver[12]; /* need room for 99.99.99-patch-aa0*/
/* Note to maintainer: increase to 18 at the next opportunity */
#else #else
#define png_libpng_ver png_get_header_ver(NULL) #define png_libpng_ver png_get_header_ver(NULL)
#endif #endif
@@ -364,11 +373,13 @@ typedef struct png_text_struct
png_charp text; /* comment, may be an empty string (ie "") png_charp text; /* comment, may be an empty string (ie "")
or a NULL pointer */ or a NULL pointer */
png_size_t text_length; /* length of the text string */ png_size_t text_length; /* length of the text string */
#ifdef PNG_iTXt_SUPPORTED
png_size_t itxt_length; /* length of the itxt string */ png_size_t itxt_length; /* length of the itxt string */
png_charp lang; /* language code, 0-79 characters png_charp lang; /* language code, 0-79 characters
or a NULL pointer */ or a NULL pointer */
png_charp lang_key; /* keyword translated UTF-8 string, 0 or more png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
chars or a NULL pointer */ chars or a NULL pointer */
#endif
} png_text; } png_text;
typedef png_text FAR * png_textp; typedef png_text FAR * png_textp;
typedef png_text FAR * FAR * png_textpp; typedef png_text FAR * FAR * png_textpp;
@@ -489,15 +500,13 @@ typedef struct png_info_struct
* and initialize the appropriate fields below. * and initialize the appropriate fields below.
*/ */
#if defined(PNG_gAMA_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED) #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
/* The gAMA chunk describes the gamma characteristics of the system /* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5]. * on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero. * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/ */
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */ float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif #endif
#endif
#if defined(PNG_sRGB_SUPPORTED) #if defined(PNG_sRGB_SUPPORTED)
/* GR-P, 0.96a */ /* GR-P, 0.96a */
@@ -517,9 +526,6 @@ typedef struct png_info_struct
int num_text; /* number of comments read/to write */ int num_text; /* number of comments read/to write */
int max_text; /* current size of text array */ int max_text; /* current size of text array */
png_textp text; /* array of comments read/to write */ png_textp text; /* array of comments read/to write */
int num_text_old; /* number of comments read/to write */
png_textp text_old; /* array of comments read/to write, backward
compatible with libpng-1.0.5 and earlier */
#endif /* PNG_TEXT_SUPPORTED */ #endif /* PNG_TEXT_SUPPORTED */
#if defined(PNG_tIME_SUPPORTED) #if defined(PNG_tIME_SUPPORTED)
@@ -595,7 +601,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_uint_16p hist; png_uint_16p hist;
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
/* The cHRM chunk describes the CIE color characteristics of the monitor /* The cHRM chunk describes the CIE color characteristics of the monitor
* on which the PNG was created. This data allows the viewer to do gamut * on which the PNG was created. This data allows the viewer to do gamut
* mapping of the input image to ensure that the viewer sees the same * mapping of the input image to ensure that the viewer sees the same
@@ -636,6 +642,16 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_byte pcal_nparams; /* number of parameters given in pcal_params */ png_byte pcal_nparams; /* number of parameters given in pcal_params */
#endif #endif
#ifdef PNG_FREE_ME_SUPPORTED
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
png_size_t unknown_chunks_num;
#endif
#if defined(PNG_iCCP_SUPPORTED) #if defined(PNG_iCCP_SUPPORTED)
/* iCCP chunk data. */ /* iCCP chunk data. */
png_charp iccp_name; /* profile name */ png_charp iccp_name; /* profile name */
@@ -669,19 +685,13 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
#endif #endif
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
png_size_t unknown_chunks_num;
#endif
#if defined(PNG_INFO_IMAGE_SUPPORTED) #if defined(PNG_INFO_IMAGE_SUPPORTED)
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */ /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */ /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
png_bytepp row_pointers; /* the image bits */ png_bytepp row_pointers; /* the image bits */
#endif #endif
#if defined(PNG_gAMA_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED) #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */ png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif #endif
@@ -696,8 +706,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_y_blue; png_fixed_point int_y_blue;
#endif #endif
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
} png_info; } png_info;
typedef png_info FAR * png_infop; typedef png_info FAR * png_infop;
@@ -814,30 +822,33 @@ typedef png_row_info FAR * FAR * png_row_infopp;
typedef struct png_struct_def png_struct; typedef struct png_struct_def png_struct;
typedef png_struct FAR * png_structp; typedef png_struct FAR * png_structp;
typedef void (*png_error_ptr) PNGARG((png_structp, png_const_charp)); typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
typedef void (*png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
typedef void (*png_flush_ptr) PNGARG((png_structp)); typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
typedef void (*png_read_status_ptr) PNGARG((png_structp, png_uint_32, int)); typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
typedef void (*png_write_status_ptr) PNGARG((png_structp, png_uint_32, int)); int));
typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
int));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
typedef void (*png_progressive_info_ptr) PNGARG((png_structp, png_infop)); typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
typedef void (*png_progressive_end_ptr) PNGARG((png_structp, png_infop)); typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep, typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
png_uint_32, int)); png_uint_32, int));
#endif #endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
typedef void (*png_user_transform_ptr) PNGARG((png_structp, defined(PNG_LEGACY_SUPPORTED)
typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
png_row_infop, png_bytep)); png_row_infop, png_bytep));
#endif #endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
typedef int (*png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
#endif #endif
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
typedef void (*png_unknown_chunk_ptr) PNGARG((png_structp)); typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#endif #endif
/* Transform masks for the high-level interface */ /* Transform masks for the high-level interface */
@@ -885,11 +896,14 @@ struct png_struct_def
png_user_transform_ptr write_user_transform_fn; /* user write transform */ png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif #endif
/* These were added in libpng-1.0.2 */
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr; /* user supplied struct for user transform */ png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */ png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */ png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#endif #endif
png_uint_32 mode; /* tells us where we are in the PNG file */ png_uint_32 mode; /* tells us where we are in the PNG file */
@@ -941,14 +955,18 @@ struct png_struct_def
png_byte sig_bytes; /* magic bytes read/written from start of file */ png_byte sig_bytes; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
#ifdef PNG_LEGACY_SUPPORTED
png_byte filler; /* filler byte for pixel expansion */
#else
png_uint_16 filler; /* filler bytes for pixel expansion */ png_uint_16 filler; /* filler bytes for pixel expansion */
#endif #endif
#endif
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
png_byte background_gamma_type; png_byte background_gamma_type;
#ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma; float background_gamma;
#endif # endif
png_color_16 background; /* background color in screen gamma space */ png_color_16 background; /* background color in screen gamma space */
# if defined(PNG_READ_GAMMA_SUPPORTED) # if defined(PNG_READ_GAMMA_SUPPORTED)
png_color_16 background_1; /* background normalized to gamma 1.0 */ png_color_16 background_1; /* background normalized to gamma 1.0 */
@@ -978,7 +996,7 @@ struct png_struct_def
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif #endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */ png_color_8 sig_bit; /* significant bits in each available channel */
#endif #endif
@@ -1058,6 +1076,22 @@ struct png_struct_def
png_free_ptr free_fn; /* function for freeing memory */ png_free_ptr free_fn; /* function for freeing memory */
#endif #endif
/* New members added in libpng-1.0.6 */
#ifdef PNG_FREE_ME_SUPPORTED
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
int num_chunk_list;
png_bytep chunk_list;
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_byte rgb_to_gray_status; png_byte rgb_to_gray_status;
png_uint_16 rgb_to_gray_red_coeff; png_uint_16 rgb_to_gray_red_coeff;
@@ -1070,27 +1104,16 @@ struct png_struct_def
png_byte empty_plte_permitted; png_byte empty_plte_permitted;
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
int num_chunk_list;
png_bytep chunk_list;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma; png_fixed_point int_gamma;
#endif #endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
}; };
/* This prevents a compiler error in png_get_copyright() in png.c if png.c /* This prevents a compiler error in png_get_copyright() in png.c if png.c
and png.h are both at * version 1.0.6h and png.h are both at * version 1.0.7beta11
*/ */
typedef png_structp version_1_0_6h; typedef png_structp version_1_0_7beta11;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@@ -1574,18 +1597,21 @@ extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
#endif #endif
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
png_ptr, png_user_transform_ptr read_user_transform_fn)); png_ptr, png_user_transform_ptr read_user_transform_fn));
#endif #endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
png_ptr, png_user_transform_ptr write_user_transform_fn)); png_ptr, png_user_transform_ptr write_user_transform_fn));
#endif #endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
png_ptr, png_voidp user_transform_ptr, int user_transform_depth, png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
int user_transform_channels)); int user_transform_channels));
@@ -1634,18 +1660,17 @@ extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
/* Free data that was allocated internally */ /* Free data that was allocated internally */
extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 free_me, int num)); png_infop info_ptr, png_uint_32 free_me, int num));
#ifdef PNG_FREE_ME_SUPPORTED
/* Reassign responsibility for freeing existing data, whether allocated /* Reassign responsibility for freeing existing data, whether allocated
* by libpng or by the application */ * by libpng or by the application */
extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
png_infop info_ptr, int freer, png_uint_32 mask)); png_infop info_ptr, int freer, png_uint_32 mask));
#endif
/* assignments for png_data_freer */ /* assignments for png_data_freer */
#define PNG_DESTROY_WILL_FREE_DATA 1 #define PNG_DESTROY_WILL_FREE_DATA 1
#define PNG_SET_WILL_FREE_DATA 1 #define PNG_SET_WILL_FREE_DATA 1
#define PNG_USER_WILL_FREE_DATA 2 #define PNG_USER_WILL_FREE_DATA 2
/* Flags for png_ptr->free_me and info_ptr->free_me */ /* Flags for png_ptr->free_me and info_ptr->free_me */
#define PNG_FREE_PLTE 0x0001
#define PNG_FREE_TRNS 0x0002
#define PNG_FREE_TEXT 0x0004
#define PNG_FREE_HIST 0x0008 #define PNG_FREE_HIST 0x0008
#define PNG_FREE_ICCP 0x0010 #define PNG_FREE_ICCP 0x0010
#define PNG_FREE_SPLT 0x0020 #define PNG_FREE_SPLT 0x0020
@@ -1654,7 +1679,10 @@ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
#define PNG_FREE_SCAL 0x0100 /* not used any more */ #define PNG_FREE_SCAL 0x0100 /* not used any more */
#define PNG_FREE_UNKN 0x0200 #define PNG_FREE_UNKN 0x0200
#define PNG_FREE_LIST 0x0400 #define PNG_FREE_LIST 0x0400
#define PNG_FREE_ALL 0x07ff #define PNG_FREE_PLTE 0x1000
#define PNG_FREE_TRNS 0x2000
#define PNG_FREE_TEXT 0x4000
#define PNG_FREE_ALL 0x3fff
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
@@ -2034,6 +2062,7 @@ extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
#endif #endif
#if defined(PNG_INFO_IMAGE_SUPPORTED) #if defined(PNG_INFO_IMAGE_SUPPORTED)
/* The "params" pointer is currently not used and is for future expansion. */
extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_infop info_ptr,
int transforms, int transforms,
@@ -2084,7 +2113,7 @@ extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.0.6h - April 24, 2000 (header)\n" " libpng version 1.0.7beta11 - May 6, 2000 (header)\n"
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on /* With these routines we avoid an integer divide, which will be slower on
@@ -2200,8 +2229,12 @@ extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 #define PNG_FLAG_CRC_CRITICAL_USE 0x0400
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x1000 #define PNG_FLAG_FREE_PLTE 0x1000
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x2000 #define PNG_FLAG_FREE_TRNS 0x2000
#define PNG_FLAG_FREE_HIST 0x4000
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
/* For use in png_set_keep_unknown, png_handle_as_unknown */ /* For use in png_set_keep_unknown, png_handle_as_unknown */
#define HANDLE_CHUNK_AS_DEFAULT 0 #define HANDLE_CHUNK_AS_DEFAULT 0
@@ -2307,14 +2340,24 @@ PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
/* Initialize png_ptr struct for reading, and allocate any other memory. /* Initialize png_ptr struct for reading, and allocate any other memory.
* (old interface - NOT DLL EXPORTED). * (old interface - DEPRECATED).
*/ */
extern void png_read_init PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
#define png_read_init(png_ptr) png_read_init_2(png_ptr, \
PNG_LIBPNG_VER_STRING, sizeof(png_struct), sizeof(png_info));
extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
png_info_size));
/* Initialize png_ptr struct for writing, and allocate any other memory. /* Initialize png_ptr struct for writing, and allocate any other memory.
* (old interface - NOT DLL EXPORTED). * (old interface - DEPRECATED).
*/ */
extern void png_write_init PNGARG((png_structp png_ptr)); extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
#define png_write_init(png_ptr) png_write_init_2(png_ptr, \
PNG_LIBPNG_VER_STRING, sizeof(png_struct), sizeof(png_info));
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
png_info_size));
/* Allocate memory for an internal libpng struct */ /* Allocate memory for an internal libpng struct */
PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); PNG_EXTERN png_voidp png_create_struct PNGARG((int type));

221
png_ptr.h
View File

@@ -1,221 +0,0 @@
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmpbuf; /* used in png_error */
#endif
png_error_ptr error_fn; /* function for printing errors and aborting */
png_error_ptr warning_fn; /* function for printing warnings */
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions*/
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr read_user_transform_fn; /* user read transform */
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
z_stream zstream; /* pointer to decompression structure (below) */
png_bytep zbuf; /* buffer for zlib */
png_size_t zbuf_size; /* size of zbuf */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */
png_uint_32 rowbytes; /* size of row in bytes */
png_uint_32 irowbytes; /* size of current interlaced row in bytes */
png_uint_32 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */
png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
png_colorp palette; /* palette from the input file */
png_uint_16 num_palette; /* number of color entries in palette */
png_uint_16 num_trans; /* number of transparency values */
png_byte chunk_name[5]; /* null-terminated name of current chunk */
png_byte compression; /* file compression type (always 0) */
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row */
png_byte pixel_depth; /* number of bits per pixel */
png_byte channels; /* number of channels in file */
png_byte usr_channels; /* channels at start of write */
png_byte sig_bytes; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
#if defined(PNG_READ_bKGD_SUPPORTED)
png_byte background_gamma_type;
#ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma;
#endif
png_color_16 background; /* background color in screen gamma space */
# if defined(PNG_READ_GAMMA_SUPPORTED)
png_color_16 background_1; /* background normalized to gamma 1.0 */
# endif /* PNG_READ_GAMMA && PNG_READ_bKGD_SUPPORTED */
#endif /* PNG_READ_bKGD_SUPPORTED */
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
png_flush_ptr output_flush_fn;/* Function for flushing output */
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma; /* file gamma value */
float screen_gamma; /* screen gamma value (display_exponent) */
#endif
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
#if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans; /* transparency values for paletted files */
png_color_16 trans_values; /* transparency values for non-paletted files */
#endif
png_read_status_ptr read_row_fn; /* called after each row is decoded */
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
png_bytep current_buffer_ptr; /* current location in current_buffer */
png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */
png_size_t current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
# if defined(PNG_READ_TEXT_SUPPORTED)
png_size_t current_text_size; /* current size of text input data */
png_size_t current_text_left; /* how much text left to read in input */
png_charp current_text; /* current text chunk buffer */
png_charp current_text_ptr; /* current location in current_text */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_READ_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
#if defined(PNG_READ_DITHER_SUPPORTED)
png_bytep palette_lookup; /* lookup table for dithering */
png_bytep dither_index; /* index translation for palette files */
#endif
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_READ_hIST_SUPPORTED)
png_uint_16p hist; /* histogram */
#endif
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED)
png_charp time_buffer; /* String to hold RFC 1123 time text */
#endif
#ifdef PNG_USER_MEM_SUPPORTED
png_voidp mem_ptr; /* user supplied struct for mem functions */
png_malloc_ptr malloc_fn; /* function for allocating memory */
png_free_ptr free_fn; /* function for freeing memory */
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_byte rgb_to_gray_status;
png_uint_16 rgb_to_gray_red_coeff;
png_uint_16 rgb_to_gray_green_coeff;
png_uint_16 rgb_to_gray_blue_coeff;
#endif
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
png_byte empty_plte_permitted;
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
int num_chunk_list;
png_bytep chunk_list;
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma;
#endif
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
};

View File

@@ -1,6 +1,6 @@
/* pngasmrd.h - assembler version of utilities to read a PNG file /* pngasmrd.h - assembler version of utilities to read a PNG file
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1999, 2000 Glenn Randers-Pehrson
* *

204
pngconf.h
View File

@@ -1,7 +1,6 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -258,23 +257,74 @@
/* Any features you will not be using can be undef'ed here */ /* Any features you will not be using can be undef'ed here */
/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
on the compile line, then pick and choose which ones to define without * on the compile line, then pick and choose which ones to define without
having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
if you only want to have a png-compliant reader/writer but don't need * if you only want to have a png-compliant reader/writer but don't need
any of the extra transformations. This saves about 80 kbytes in a * any of the extra transformations. This saves about 80 kbytes in a
typical installation of the library. (PNG_NO_* form added in version * typical installation of the library. (PNG_NO_* form added in version
1.0.1c, for consistency) * 1.0.1c, for consistency)
*/ */
#ifndef PNG_NO_FLOATING_POINT_SUPPORTED /* The size of the png_text structure changed in libpng-1.0.6 when
* iTXt is supported. It is turned off by default, to support old apps
* that malloc the png_text structure instead of calling png_set_text()
* and letting libpng malloc it. It will be turned on by default in
* libpng-2.0.0.
*/
#ifndef PNG_iTXt_SUPPORTED
# ifndef PNG_READ_iTXt_SUPPORTED
# define PNG_NO_READ_iTXt
# endif
# ifndef PNG_WRITE_iTXt_SUPPORTED
# define PNG_NO_WRITE_iTXt
# endif
#endif
/* The following support, added after version 1.0.0, can be turned off here en
* masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
* with old applications that require the length of png_struct and png_info
* to remain unchanged.
*/
#ifdef PNG_LEGACY_SUPPORTED
#define PNG_NO_FREE_ME
#define PNG_NO_READ_UNKNOWN_CHUNKS
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
#define PNG_NO_READ_USER_CHUNKS
#define PNG_NO_READ_iCCP
#define PNG_NO_WRITE_iCCP
#define PNG_NO_READ_iTXt
#define PNG_NO_WRITE_iTXt
#define PNG_NO_READ_sCAL
#define PNG_NO_WRITE_sCAL
#define PNG_NO_READ_sPLT
#define PNG_NO_WRITE_sPLT
#define PNG_NO_INFO_IMAGE
#define PNG_NO_READ_RGB_TO_GRAY
#define PNG_NO_READ_USER_TRANSFORM
#define PNG_NO_WRITE_USER_TRANSFORM
#define PNG_NO_USER_MEM
#define PNG_NO_READ_EMPTY_PLTE
#define PNG_NO_FIXED_POINT_SUPPORTED
#endif
#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
#define PNG_FLOATING_POINT_SUPPORTED #define PNG_FLOATING_POINT_SUPPORTED
#endif #endif
#ifndef PNG_NO_FIXED_POINT_SUPPORTED /* Ignore attempt to turn off both floating and fixed point support */
#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
!defined(PNG_NO_FIXED_POINT_SUPPORTED)
#define PNG_FIXED_POINT_SUPPORTED #define PNG_FIXED_POINT_SUPPORTED
#endif #endif
#ifndef PNG_NO_FREE_ME
#define PNG_FREE_ME_SUPPORTED
#endif
#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS) !defined(PNG_NO_READ_TRANSFORMS)
#define PNG_READ_TRANSFORMS_SUPPORTED #define PNG_READ_TRANSFORMS_SUPPORTED
@@ -348,9 +398,11 @@
/* still have interlacing unless you change the following line: */ /* still have interlacing unless you change the following line: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
#ifndef PNG_NO_READ_COMPOSITED_NODIV #ifndef PNG_NO_READ_COMPOSITE_NODIV
#ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */ #define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
#endif #endif
#endif
#ifndef PNG_NO_READ_EMPTY_PLTE #ifndef PNG_NO_READ_EMPTY_PLTE
#define PNG_READ_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */ #define PNG_READ_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */
@@ -389,6 +441,13 @@
#endif #endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
#ifndef PNG_NO_USER_TRANSFORM_PTR
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
#endif
#endif
#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant #define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
encoders, but can cause trouble encoders, but can cause trouble
if left undefined */ if left undefined */
@@ -455,7 +514,9 @@
/* very little testing */ /* very little testing */
/* /*
#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
#ifndef PNG_NO_USER_MEM
#define PNG_USER_MEM_SUPPORTED #define PNG_USER_MEM_SUPPORTED
#endif
*/ */
/* This is only for PowerPC big-endian and 680x0 systems */ /* This is only for PowerPC big-endian and 680x0 systems */
@@ -560,7 +621,17 @@
# define PNG_READ_zTXt_SUPPORTED # define PNG_READ_zTXt_SUPPORTED
# define PNG_zTXt_SUPPORTED # define PNG_zTXt_SUPPORTED
#endif #endif
#ifndef PNG_NO_READ_USER_CHUNKS #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
#endif
#if !defined (PNG_NO_READ_USER_CHUNKS) && \
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
# define PNG_READ_USER_CHUNKS_SUPPORTED # define PNG_READ_USER_CHUNKS_SUPPORTED
# define PNG_USER_CHUNKS_SUPPORTED # define PNG_USER_CHUNKS_SUPPORTED
# ifdef PNG_NO_READ_UNKNOWN_CHUNKS # ifdef PNG_NO_READ_UNKNOWN_CHUNKS
@@ -570,13 +641,6 @@
# undef PNG_NO_HANDLE_AS_UNKNOWN # undef PNG_NO_HANDLE_AS_UNKNOWN
# endif # endif
#endif #endif
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
#endif
#ifndef PNG_NO_READ_OPT_PLTE #ifndef PNG_NO_READ_OPT_PLTE
# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
#endif /* optional PLTE chunk in RGB and RGBA images */ #endif /* optional PLTE chunk in RGB and RGBA images */
@@ -850,32 +914,77 @@ typedef charf * png_zcharp;
typedef charf * FAR * png_zcharpp; typedef charf * FAR * png_zcharpp;
typedef z_stream FAR * png_zstreamp; typedef z_stream FAR * png_zstreamp;
/*
* Define PNG_BUILD_DLL if the module being built is a Windows
* LIBPNG DLL.
*
* Define PNG_DLL if you want to *link* to the Windows LIBPNG DLL.
* It is equivalent to Microsoft predefined macro _DLL which is
* automatically defined when you compile using the share
* version of the CRT (C Run-Time library)
*/
#if !defined(PNG_DLL) && defined(PNG_BUILD_DLL)
# define PNG_DLL
#endif
#if defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
# define PNG_IMPEXP
#endif
#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
defined(_Windows) || defined(_WINDOWS) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define PNGAPI _cdecl
# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
# define PNG_IMPEXP
# endif
# if !defined(PNG_IMPEXP)
# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
/* Borland/Microsoft */
# if defined(_MSC_VER) || defined(__BORLANDC__)
# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
# define PNG_EXPORT PNG_EXPORT_TYPE1
# else
# define PNG_EXPORT PNG_EXPORT_TYPE2
# if defined(PNG_BUILD_DLL)
# define PNG_IMPEXP __export
# else
# define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in
VC++*/
# endif /* Exists in Borland C++ for
C++ classes (== huge) */
# endif
# endif
# if !defined(PNG_IMPEXP)
# if defined(PNG_BUILD_DLL)
# define PNG_IMPEXP __declspec(dllexport)
# else
# define PNG_IMPEXP __declspec(dllimport)
# endif
# endif
# endif /* PNG_IMPEXP */
#else
# if 0 /* ... other platforms, with other meanings */
# else
# define PNGAPI
# endif
#endif
#ifndef PNG_EXPORT #ifndef PNG_EXPORT
/* GRR 20000206: based on zconf.h and MSVC 5.0 docs */ # define PNG_EXPORT(type,symbol) type PNGAPI symbol
# if defined(_MSC_VER) && defined(_DLL) #endif
# define PNG_EXPORT(type,symbol) type __declspec(dllexport) symbol
# endif
/* allow for compilation as a DLL under MS Windows */ #if defined(__MINGW32__) || defined(__CYGWIN32__)
# ifdef __WIN32DLL__ /* Borland? */ # define PNG_ATTR_DLLIMP
# define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol
# endif
/* this variant is used in Mozilla; may correspond to MSVC++ 6.0 changes */
# ifdef ALT_WIN32_DLL
# define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol
# endif
/* allow for compilation as a DLL with Borland C++ 5.0 */
# if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__)
# define PNG_EXPORT(type,symbol) type _export symbol
# endif
/* allow for compilation as shared lib under BeOS */
# ifdef __BEOSDLL__
# define PNG_EXPORT(type,symbol) __declspec(export) type symbol
# endif
#endif #endif
#ifndef PNG_EXPORT #ifndef PNG_EXPORT
@@ -886,8 +995,9 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_ATTR_DLLIMP # define PNG_ATTR_DLLIMP
#endif #endif
#ifdef PNG_USE_GLOBAL_ARRAYS
#ifndef PNG_EXPORT_VAR #ifndef PNG_EXPORT_VAR
# if defined(_MSC_VER) && defined(_DLL) /* GRR 20000206 */ # if defined(_MSC_VER) && defined(_DLL) /* GRR 20000206 */
# define PNG_EXPORT_VAR(type) extern type __declspec(dllexport) # define PNG_EXPORT_VAR(type) extern type __declspec(dllexport)
# endif # endif
# ifdef PNG_DECL_DLLEXP # ifdef PNG_DECL_DLLEXP
@@ -903,13 +1013,13 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_EXPORT_VAR(type) extern type __attribute__((dllimport)) # define PNG_EXPORT_VAR(type) extern type __attribute__((dllimport))
# endif # endif
#endif #endif
#ifndef PNG_EXPORT_VAR #ifndef PNG_EXPORT_VAR
# define PNG_EXPORT_VAR(type) extern type # define PNG_EXPORT_VAR(type) extern type
#endif #endif
#endif
/* User may want to use these so not in PNG_INTERNAL. Any library functions /* User may want to use these so they are not in PNG_INTERNAL. Any library
* that are passed far data must be model independent. * functions that are passed far data must be model independent.
*/ */
#ifndef PNG_ABORT #ifndef PNG_ABORT

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
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -16,9 +16,11 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
static void png_default_error PNGARG((png_structp png_ptr, static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr,
png_const_charp message)); png_const_charp message));
static void png_default_warning PNGARG((png_structp png_ptr, static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr,
png_const_charp message)); png_const_charp message));
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
@@ -26,7 +28,7 @@ static void png_default_warning PNGARG((png_structp png_ptr,
* you should supply a replacement error function and use png_set_error_fn() * you should supply a replacement error function and use png_set_error_fn()
* to replace the error function at run-time. * to replace the error function at run-time.
*/ */
void void PNGAPI
png_error(png_structp png_ptr, png_const_charp message) png_error(png_structp png_ptr, png_const_charp message)
{ {
if (png_ptr->error_fn != NULL) if (png_ptr->error_fn != NULL)
@@ -42,7 +44,7 @@ png_error(png_structp png_ptr, png_const_charp message)
* you should supply a replacement warning function and use * you should supply a replacement warning function and use
* png_set_error_fn() to replace the warning function at run-time. * png_set_error_fn() to replace the warning function at run-time.
*/ */
void void PNGAPI
png_warning(png_structp png_ptr, png_const_charp message) png_warning(png_structp png_ptr, png_const_charp message)
{ {
if (png_ptr->warning_fn != NULL) if (png_ptr->warning_fn != NULL)
@@ -62,7 +64,7 @@ static PNG_CONST char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
}; };
static void static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message) png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message)
{ {
int iout = 0, iin = 0; int iout = 0, iin = 0;
@@ -94,7 +96,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp message
} }
} }
void void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp message) png_chunk_error(png_structp png_ptr, png_const_charp message)
{ {
char msg[16+64]; char msg[16+64];
@@ -102,7 +104,7 @@ png_chunk_error(png_structp png_ptr, png_const_charp message)
png_error(png_ptr, msg); png_error(png_ptr, msg);
} }
void void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp message) png_chunk_warning(png_structp png_ptr, png_const_charp message)
{ {
char msg[16+64]; char msg[16+64];
@@ -115,7 +117,7 @@ png_chunk_warning(png_structp png_ptr, png_const_charp message)
* function is used by default, or if the program supplies NULL for the * function is used by default, or if the program supplies NULL for the
* error function pointer in png_set_error_fn(). * error function pointer in png_set_error_fn().
*/ */
static void static void /* PRIVATE */
png_default_error(png_structp png_ptr, png_const_charp message) png_default_error(png_structp png_ptr, png_const_charp message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifndef PNG_NO_CONSOLE_IO
@@ -144,7 +146,7 @@ png_default_error(png_structp png_ptr, png_const_charp message)
* here if you don't want them to. In the default configuration, png_ptr is * here if you don't want them to. In the default configuration, png_ptr is
* not used, but it is passed in case it may be useful. * not used, but it is passed in case it may be useful.
*/ */
static void static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp message) png_default_warning(png_structp png_ptr, png_const_charp message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifndef PNG_NO_CONSOLE_IO
@@ -159,7 +161,7 @@ png_default_warning(png_structp png_ptr, png_const_charp message)
* return to the calling routine or serious problems will occur. The return * return to the calling routine or serious problems will occur. The return
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1) * method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
*/ */
void void PNGAPI
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warning_fn) png_error_ptr error_fn, png_error_ptr warning_fn)
{ {
@@ -173,7 +175,7 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
* functions. The application should free any memory associated with this * functions. The application should free any memory associated with this
* pointer before png_write_destroy and png_read_destroy are called. * pointer before png_write_destroy and png_read_destroy are called.
*/ */
png_voidp png_voidp PNGAPI
png_get_error_ptr(png_structp png_ptr) png_get_error_ptr(png_structp png_ptr)
{ {
return ((png_voidp)png_ptr->error_ptr); return ((png_voidp)png_ptr->error_ptr);

View File

@@ -6,7 +6,7 @@
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
* for Intel's performance analysis of the MMX vs. non-MMX code. * for Intel's performance analysis of the MMX vs. non-MMX code.
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -209,7 +209,7 @@ static png_uint_32 _MMXLength;
static int _dif; static int _dif;
void void /* PRIVATE */
png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info, png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info,
png_bytep row, png_bytep prev_row, int filter); png_bytep row, png_bytep prev_row, int filter);
@@ -230,7 +230,7 @@ png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info,
/* Use this routine for the x86 platform - it uses a faster MMX routine /* Use this routine for the x86 platform - it uses a faster MMX routine
if the machine supports MMX. */ if the machine supports MMX. */
void void PNGAPI
png_combine_row(png_structp png_ptr, png_bytep row, int mask) png_combine_row(png_structp png_ptr, png_bytep row, int mask)
{ {
png_debug(1,"in png_combine_row_asm\n"); png_debug(1,"in png_combine_row_asm\n");
@@ -1210,7 +1210,7 @@ fflush(stderr);
* has taken place. [GRR: what other steps come before and/or after?] * has taken place. [GRR: what other steps come before and/or after?]
*/ */
void void /* PRIVATE */
png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
png_uint_32 transformations) png_uint_32 transformations)
{ {
@@ -2401,7 +2401,7 @@ union uAll {
// Optimized code for PNG Average filter decoder // Optimized code for PNG Average filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row, png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
png_bytep prev_row) png_bytep prev_row)
{ {
@@ -2901,7 +2901,7 @@ png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row,
} }
// Optimized code for PNG Paeth filter decoder // Optimized code for PNG Paeth filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row, png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
png_bytep prev_row) png_bytep prev_row)
{ {
@@ -3833,7 +3833,7 @@ png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
} }
// Optimized code for PNG Sub filter decoder // Optimized code for PNG Sub filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row) png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
{ {
#ifdef GRR_GCC_MMX_CONVERTED #ifdef GRR_GCC_MMX_CONVERTED
@@ -4183,7 +4183,7 @@ png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
} }
// Optimized code for PNG Up filter decoder // Optimized code for PNG Up filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
png_bytep prev_row) png_bytep prev_row)
{ {
@@ -4310,7 +4310,7 @@ png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
// Optimized png_read_filter_row routines // Optimized png_read_filter_row routines
void void PNGAPI
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
row, png_bytep prev_row, int filter) row, png_bytep prev_row, int filter)
{ {

104
pngget.c
View File

@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -11,7 +11,7 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
png_uint_32 png_uint_32 PNGAPI
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -20,7 +20,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
return(0); return(0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_rowbytes(png_structp png_ptr, png_infop info_ptr) png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -30,7 +30,7 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
} }
#if defined(PNG_INFO_IMAGE_SUPPORTED) #if defined(PNG_INFO_IMAGE_SUPPORTED)
png_bytepp png_bytepp PNGAPI
png_get_rows(png_structp png_ptr, png_infop info_ptr) png_get_rows(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -42,7 +42,7 @@ png_get_rows(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_EASY_ACCESS_SUPPORTED #ifdef PNG_EASY_ACCESS_SUPPORTED
/* easy access to info, added in libpng-0.99 */ /* easy access to info, added in libpng-0.99 */
png_uint_32 png_uint_32 PNGAPI
png_get_image_width(png_structp png_ptr, png_infop info_ptr) png_get_image_width(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -52,7 +52,7 @@ png_get_image_width(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_image_height(png_structp png_ptr, png_infop info_ptr) png_get_image_height(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -62,7 +62,7 @@ png_get_image_height(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_byte png_byte PNGAPI
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -72,7 +72,7 @@ png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_byte png_byte PNGAPI
png_get_color_type(png_structp png_ptr, png_infop info_ptr) png_get_color_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -82,7 +82,7 @@ png_get_color_type(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_byte png_byte PNGAPI
png_get_filter_type(png_structp png_ptr, png_infop info_ptr) png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -92,7 +92,7 @@ png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_byte png_byte PNGAPI
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -102,7 +102,7 @@ png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_byte png_byte PNGAPI
png_get_compression_type(png_structp png_ptr, png_infop info_ptr) png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -112,7 +112,7 @@ png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
@@ -128,7 +128,7 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
@@ -144,7 +144,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
@@ -162,7 +162,7 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
} }
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
@@ -181,7 +181,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
} }
#endif #endif
png_uint_32 png_uint_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
@@ -197,7 +197,7 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
@@ -213,7 +213,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
@@ -229,7 +229,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
@@ -246,35 +246,35 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
} }
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{ {
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr) return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5); *.0254 +.5);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{ {
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr) return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5); *.0254 +.5);
} }
png_uint_32 png_uint_32 PNGAPI
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{ {
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr) return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5); *.0254 +.5);
} }
float float PNGAPI
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
{ {
return ((float)png_get_x_offset_microns(png_ptr, info_ptr) return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
*.00003937); *.00003937);
} }
float float PNGAPI
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
{ {
return ((float)png_get_y_offset_microns(png_ptr, info_ptr) return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
@@ -282,7 +282,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
} }
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
@@ -321,7 +321,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
#endif /* PNG_EASY_ACCESS_SUPPORTED */ #endif /* PNG_EASY_ACCESS_SUPPORTED */
png_byte png_byte PNGAPI
png_get_channels(png_structp png_ptr, png_infop info_ptr) png_get_channels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -330,7 +330,7 @@ png_get_channels(png_structp png_ptr, png_infop info_ptr)
return (0); return (0);
} }
png_bytep png_bytep PNGAPI
png_get_signature(png_structp png_ptr, png_infop info_ptr) png_get_signature(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -340,7 +340,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
} }
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background) png_color_16p *background)
{ {
@@ -357,7 +357,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr, png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
double *white_x, double *white_y, double *red_x, double *red_y, double *white_x, double *white_y, double *red_x, double *red_y,
double *green_x, double *green_y, double *blue_x, double *blue_y) double *green_x, double *green_y, double *blue_x, double *blue_y)
@@ -387,7 +387,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 png_uint_32 PNGAPI
png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
@@ -421,7 +421,7 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
@@ -434,7 +434,8 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
return (0); return (0);
} }
#endif #endif
png_uint_32 #ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *int_file_gamma) png_fixed_point *int_file_gamma)
{ {
@@ -448,9 +449,10 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
return (0); return (0);
} }
#endif #endif
#endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
@@ -465,7 +467,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr, png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen) png_charpp profile, png_uint_32 *proflen)
@@ -487,7 +489,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes) png_sPLT_tpp spalettes)
{ {
@@ -498,7 +500,7 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
@@ -512,7 +514,7 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
} }
#endif #endif
png_uint_32 png_uint_32 PNGAPI
png_get_IHDR(png_structp png_ptr, png_infop info_ptr, png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *width, png_uint_32 *height, int *bit_depth, png_uint_32 *width, png_uint_32 *height, int *bit_depth,
int *color_type, int *interlace_type, int *compression_type, int *color_type, int *interlace_type, int *compression_type,
@@ -559,7 +561,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
} }
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr, png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{ {
@@ -577,7 +579,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr, png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params) png_charp *units, png_charpp *params)
@@ -602,7 +604,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr, png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
int *unit, double *width, double *height) int *unit, double *width, double *height)
{ {
@@ -618,7 +620,7 @@ png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 png_uint_32 PNGAPI
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr, png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height) int *unit, png_charpp width, png_charpp height)
{ {
@@ -637,7 +639,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr, png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
@@ -667,7 +669,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
png_uint_32 png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
int *num_palette) int *num_palette)
{ {
@@ -684,7 +686,7 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
} }
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
@@ -699,7 +701,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
#endif #endif
#if defined(PNG_READ_TEXT_SUPPORTED) #if defined(PNG_READ_TEXT_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text) int *num_text)
{ {
@@ -721,7 +723,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
@@ -736,7 +738,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans, int *num_trans, png_color_16p *trans_values) png_bytep *trans, int *num_trans, png_color_16p *trans_values)
{ {
@@ -775,7 +777,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
png_uint_32 png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns) png_unknown_chunkpp unknowns)
{ {
@@ -786,7 +788,7 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_byte png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr) png_get_rgb_to_gray_status (png_structp png_ptr)
{ {
return png_ptr->rgb_to_gray_status; return png_ptr->rgb_to_gray_status;
@@ -794,7 +796,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
#endif #endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
png_voidp png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr) png_get_user_chunk_ptr(png_structp png_ptr)
{ {
return (png_ptr->user_chunk_ptr); return (png_ptr->user_chunk_ptr);
@@ -802,7 +804,7 @@ png_get_user_chunk_ptr(png_structp png_ptr)
#endif #endif
png_uint_32 png_uint_32 PNGAPI
png_get_compression_buffer_size(png_structp png_ptr) png_get_compression_buffer_size(png_structp png_ptr)
{ {
return(png_ptr->zbuf_size); return(png_ptr->zbuf_size);

View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -23,7 +23,7 @@
/* Allocate memory for a png_struct. The malloc and memset can be replaced /* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */ by a single call to calloc() if this is thought to improve performance. */
png_voidp png_voidp /* PRIVATE */
png_create_struct(int type) png_create_struct(int type)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
@@ -31,7 +31,7 @@ png_create_struct(int type)
} }
/* Alternate version of png_create_struct, for use with user-defined malloc. */ /* Alternate version of png_create_struct, for use with user-defined malloc. */
png_voidp png_voidp /* PRIVATE */
png_create_struct_2(int type, png_malloc_ptr malloc_fn) png_create_struct_2(int type, png_malloc_ptr malloc_fn)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
@@ -62,7 +62,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn)
/* Free memory allocated by a png_create_struct() call */ /* Free memory allocated by a png_create_struct() call */
void void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr) png_destroy_struct(png_voidp struct_ptr)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
@@ -70,7 +70,7 @@ png_destroy_struct(png_voidp struct_ptr)
} }
/* Free memory allocated by a png_create_struct() call */ /* Free memory allocated by a png_create_struct() call */
void void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn) png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
{ {
#endif #endif
@@ -108,7 +108,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
@@ -124,7 +124,7 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
return png_malloc_default(png_ptr, size); return png_malloc_default(png_ptr, size);
} }
png_voidp png_voidp PNGAPI
png_malloc_default(png_structp png_ptr, png_uint_32 size) png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
png_voidp ret; png_voidp ret;
@@ -224,7 +224,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
/* free a pointer allocated by png_malloc(). In the default /* free a pointer allocated by png_malloc(). In the default
configuration, png_ptr is not used, but is passed in case it configuration, png_ptr is not used, but is passed in case it
is needed. If ptr is NULL, return without taking any action. */ is needed. If ptr is NULL, return without taking any action. */
void void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr) png_free(png_structp png_ptr, png_voidp ptr)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
@@ -239,7 +239,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
else png_free_default(png_ptr, ptr); else png_free_default(png_ptr, ptr);
} }
void void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
@@ -277,7 +277,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably.*/ to improve performance noticably.*/
png_voidp png_voidp /* PRIVATE */
png_create_struct(int type) png_create_struct(int type)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
@@ -287,7 +287,7 @@ png_create_struct(int type)
/* Allocate memory for a png_struct or a png_info. The malloc and /* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably.*/ to improve performance noticably.*/
png_voidp png_voidp /* PRIVATE */
png_create_struct_2(int type, png_malloc_ptr malloc_fn) png_create_struct_2(int type, png_malloc_ptr malloc_fn)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
@@ -328,7 +328,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn)
/* Free memory allocated by a png_create_struct() call */ /* Free memory allocated by a png_create_struct() call */
void void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr) png_destroy_struct(png_voidp struct_ptr)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
@@ -336,7 +336,7 @@ png_destroy_struct(png_voidp struct_ptr)
} }
/* Free memory allocated by a png_create_struct() call */ /* Free memory allocated by a png_create_struct() call */
void void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn) png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
@@ -370,7 +370,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn)
need to allocate exactly 64K, so whatever you call here must need to allocate exactly 64K, so whatever you call here must
have the ability to do that. */ have the ability to do that. */
png_voidp png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
@@ -385,7 +385,7 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
else else
return (png_malloc_default(png_ptr, size)); return (png_malloc_default(png_ptr, size));
} }
png_voidp png_voidp /* PRIVATE */
png_malloc_default(png_structp png_ptr, png_uint_32 size) png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
png_voidp ret; png_voidp ret;
@@ -416,7 +416,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return /* Free a pointer allocated by png_malloc(). If ptr is NULL, return
without taking any action. */ without taking any action. */
void void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr) png_free(png_structp png_ptr, png_voidp ptr)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
@@ -430,7 +430,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
} }
else png_free_default(png_ptr, ptr); else png_free_default(png_ptr, ptr);
} }
void void /* PRIVATE */
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
@@ -451,7 +451,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
#endif /* Not Borland DOS special memory handler */ #endif /* Not Borland DOS special memory handler */
png_voidp png_voidp /* PRIVATE */
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2, png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
png_uint_32 length) png_uint_32 length)
{ {
@@ -464,7 +464,7 @@ png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
return(png_memcpy (s1, s2, size)); return(png_memcpy (s1, s2, size));
} }
png_voidp png_voidp /* PRIVATE */
png_memset_check (png_structp png_ptr, png_voidp s1, int value, png_memset_check (png_structp png_ptr, png_voidp s1, int value,
png_uint_32 length) png_uint_32 length)
{ {
@@ -482,7 +482,7 @@ png_memset_check (png_structp png_ptr, png_voidp s1, int value,
/* This function is called when the application wants to use another method /* This function is called when the application wants to use another method
* of allocating and freeing memory. * of allocating and freeing memory.
*/ */
void void PNGAPI
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn) malloc_fn, png_free_ptr free_fn)
{ {
@@ -495,7 +495,7 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
* functions. The application should free any memory associated with this * functions. The application should free any memory associated with this
* pointer before png_write_destroy and png_read_destroy are called. * pointer before png_write_destroy and png_read_destroy are called.
*/ */
png_voidp png_voidp PNGAPI
png_get_mem_ptr(png_structp png_ptr) png_get_mem_ptr(png_structp png_ptr)
{ {
return ((png_voidp)png_ptr->mem_ptr); return ((png_voidp)png_ptr->mem_ptr);

View File

@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -24,7 +24,7 @@
#define PNG_READ_iTXt_MODE 7 #define PNG_READ_iTXt_MODE 7
#define PNG_ERROR_MODE 8 #define PNG_ERROR_MODE 8
void void PNGAPI
png_process_data(png_structp png_ptr, png_infop info_ptr, png_process_data(png_structp png_ptr, png_infop info_ptr,
png_bytep buffer, png_size_t buffer_size) png_bytep buffer, png_size_t buffer_size)
{ {
@@ -39,7 +39,7 @@ png_process_data(png_structp png_ptr, png_infop info_ptr,
/* What we do with the incoming data depends on what we were previously /* What we do with the incoming data depends on what we were previously
* doing before we ran out of data... * doing before we ran out of data...
*/ */
void void /* PRIVATE */
png_process_some_data(png_structp png_ptr, png_infop info_ptr) png_process_some_data(png_structp png_ptr, png_infop info_ptr)
{ {
switch (png_ptr->process_mode) switch (png_ptr->process_mode)
@@ -99,7 +99,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
* checked by the calling application, or because of multiple calls to this * checked by the calling application, or because of multiple calls to this
* routine. * routine.
*/ */
void void /* PRIVATE */
png_push_read_sig(png_structp png_ptr, png_infop info_ptr) png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
{ {
png_size_t num_checked = png_ptr->sig_bytes, png_size_t num_checked = png_ptr->sig_bytes,
@@ -131,7 +131,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
} }
} }
void void /* PRIVATE */
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -463,14 +463,14 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
} }
void void /* PRIVATE */
png_push_crc_skip(png_structp png_ptr, png_uint_32 skip) png_push_crc_skip(png_structp png_ptr, png_uint_32 skip)
{ {
png_ptr->process_mode = PNG_SKIP_MODE; png_ptr->process_mode = PNG_SKIP_MODE;
png_ptr->skip_length = skip; png_ptr->skip_length = skip;
} }
void void /* PRIVATE */
png_push_crc_finish(png_structp png_ptr) png_push_crc_finish(png_structp png_ptr)
{ {
if (png_ptr->skip_length && png_ptr->save_buffer_size) if (png_ptr->skip_length && png_ptr->save_buffer_size)
@@ -518,7 +518,7 @@ png_push_crc_finish(png_structp png_ptr)
} }
} }
void void /* PRIVATE */
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
{ {
png_bytep ptr; png_bytep ptr;
@@ -556,7 +556,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
} }
} }
void void /* PRIVATE */
png_push_save_buffer(png_structp png_ptr) png_push_save_buffer(png_structp png_ptr)
{ {
if (png_ptr->save_buffer_size) if (png_ptr->save_buffer_size)
@@ -600,7 +600,7 @@ png_push_save_buffer(png_structp png_ptr)
png_ptr->buffer_size = 0; png_ptr->buffer_size = 0;
} }
void void /* PRIVATE */
png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
png_size_t buffer_length) png_size_t buffer_length)
{ {
@@ -610,7 +610,7 @@ png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
png_ptr->current_buffer_ptr = png_ptr->current_buffer; png_ptr->current_buffer_ptr = png_ptr->current_buffer;
} }
void void /* PRIVATE */
png_push_read_IDAT(png_structp png_ptr) png_push_read_IDAT(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -700,7 +700,7 @@ png_push_read_IDAT(png_structp png_ptr)
} }
} }
void void /* PRIVATE */
png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
png_size_t buffer_length) png_size_t buffer_length)
{ {
@@ -742,7 +742,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
} }
} }
void void /* PRIVATE */
png_push_process_row(png_structp png_ptr) png_push_process_row(png_structp png_ptr)
{ {
png_ptr->row_info.color_type = png_ptr->color_type; png_ptr->row_info.color_type = png_ptr->color_type;
@@ -884,7 +884,7 @@ png_push_process_row(png_structp png_ptr)
} }
} }
void void /* PRIVATE */
png_read_push_finish_row(png_structp png_ptr) png_read_push_finish_row(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -949,7 +949,7 @@ png_read_push_finish_row(png_structp png_ptr)
} }
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
void void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
@@ -979,7 +979,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
png_ptr->process_mode = PNG_READ_tEXt_MODE; png_ptr->process_mode = PNG_READ_tEXt_MODE;
} }
void void /* PRIVATE */
png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr) png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr->buffer_size && png_ptr->current_text_left) if (png_ptr->buffer_size && png_ptr->current_text_left)
@@ -1024,9 +1024,11 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr->lang = (char *)NULL;
text_ptr->key = key; text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->lang = (char *)NULL;
text_ptr->lang_key = (char *)NULL; text_ptr->lang_key = (char *)NULL;
#endif
text_ptr->text = text; text_ptr->text = text;
png_set_text(png_ptr, info_ptr, text_ptr, 1); png_set_text(png_ptr, info_ptr, text_ptr, 1);
@@ -1037,7 +1039,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
void void /* PRIVATE */
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
@@ -1069,7 +1071,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
png_ptr->process_mode = PNG_READ_zTXt_MODE; png_ptr->process_mode = PNG_READ_zTXt_MODE;
} }
void void /* PRIVATE */
png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr) png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr->buffer_size && png_ptr->current_text_left) if (png_ptr->buffer_size && png_ptr->current_text_left)
@@ -1206,8 +1208,10 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt; text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr->key = key; text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->lang = (char *)NULL; text_ptr->lang = (char *)NULL;
text_ptr->lang_key = (char *)NULL; text_ptr->lang_key = (char *)NULL;
#endif
text_ptr->text = text; text_ptr->text = text;
png_set_text(png_ptr, info_ptr, text_ptr, 1); png_set_text(png_ptr, info_ptr, text_ptr, 1);
@@ -1218,7 +1222,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
void void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
@@ -1248,7 +1252,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
png_ptr->process_mode = PNG_READ_iTXt_MODE; png_ptr->process_mode = PNG_READ_iTXt_MODE;
} }
void void /* PRIVATE */
png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr) png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
{ {
@@ -1328,7 +1332,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
* chunk. If there isn't a problem with the chunk itself (ie a bad chunk * chunk. If there isn't a problem with the chunk itself (ie a bad chunk
* name or a critical chunk), the chunk is (currently) silently ignored. * name or a critical chunk), the chunk is (currently) silently ignored.
*/ */
void void /* PRIVATE */
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_uint_32 skip=0; png_uint_32 skip=0;
@@ -1336,12 +1340,14 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
if (!(png_ptr->chunk_name[0] & 0x20)) if (!(png_ptr->chunk_name[0] & 0x20))
{ {
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
HANDLE_CHUNK_ALWAYS HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL && png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
#endif #endif
) )
#endif
png_chunk_error(png_ptr, "unknown critical chunk"); png_chunk_error(png_ptr, "unknown critical chunk");
/* to quiet compiler warnings about unused info_ptr */ /* to quiet compiler warnings about unused info_ptr */
@@ -1391,21 +1397,21 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
png_push_crc_skip(png_ptr, skip); png_push_crc_skip(png_ptr, skip);
} }
void void /* PRIVATE */
png_push_have_info(png_structp png_ptr, png_infop info_ptr) png_push_have_info(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr->info_fn != NULL) if (png_ptr->info_fn != NULL)
(*(png_ptr->info_fn))(png_ptr, info_ptr); (*(png_ptr->info_fn))(png_ptr, info_ptr);
} }
void void /* PRIVATE */
png_push_have_end(png_structp png_ptr, png_infop info_ptr) png_push_have_end(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr->end_fn != NULL) if (png_ptr->end_fn != NULL)
(*(png_ptr->end_fn))(png_ptr, info_ptr); (*(png_ptr->end_fn))(png_ptr, info_ptr);
} }
void void /* PRIVATE */
png_push_have_row(png_structp png_ptr, png_bytep row) png_push_have_row(png_structp png_ptr, png_bytep row)
{ {
if (png_ptr->row_fn != NULL) if (png_ptr->row_fn != NULL)
@@ -1413,7 +1419,7 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
(int)png_ptr->pass); (int)png_ptr->pass);
} }
void void PNGAPI
png_progressive_combine_row (png_structp png_ptr, png_progressive_combine_row (png_structp png_ptr,
png_bytep old_row, png_bytep new_row) png_bytep old_row, png_bytep new_row)
{ {
@@ -1424,7 +1430,7 @@ png_progressive_combine_row (png_structp png_ptr,
png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
} }
void void PNGAPI
png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn) png_progressive_end_ptr end_fn)
@@ -1436,7 +1442,7 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
} }
png_voidp png_voidp PNGAPI
png_get_progressive_ptr(png_structp png_ptr) png_get_progressive_ptr(png_structp png_ptr)
{ {
return png_ptr->io_ptr; return png_ptr->io_ptr;

149
pngread.c
View File

@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -15,7 +15,7 @@
#include "png.h" #include "png.h"
/* Create a PNG structure for reading, and allocate any memory needed. */ /* Create a PNG structure for reading, and allocate any memory needed. */
png_structp png_structp PNGAPI
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn) png_error_ptr error_fn, png_error_ptr warn_fn)
{ {
@@ -26,7 +26,7 @@ png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
} }
/* Alternate create PNG structure for reading, and allocate any memory needed. */ /* Alternate create PNG structure for reading, and allocate any memory needed. */
png_structp png_structp PNGAPI
png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn) png_malloc_ptr malloc_fn, png_free_ptr free_fn)
@@ -41,6 +41,8 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif #endif
#endif #endif
int i;
png_debug(1, "in png_create_read_struct\n"); png_debug(1, "in png_create_read_struct\n");
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
@@ -74,16 +76,38 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so i=0;
* we must recompile any applications that use any older library version. do
* For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit.
*/
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{ {
png_error(png_ptr, if(user_png_ver[i] != png_libpng_ver[i])
"Incompatible libpng version in application and library"); png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
} while (png_libpng_ver[i++]);
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
* we must recompile any applications that use any older library version.
* For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit.
*/
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
png_error(png_ptr,
"Incompatible libpng version in application and library");
}
/* Libpng 1.0.6 was not binary compatible, due to insertion of the
info_ptr->free_me member. Note to maintainer: this test can be
removed from version 2.0.0 and beyond because the previous test
would have already rejected it. */
if (user_png_ver[4] == '6' && user_png_ver[2] == '0' &&
user_png_ver[0] == '1' && user_png_ver[5] == '\0')
{
png_error(png_ptr,
"Application must be recompiled; version 1.0.6 was incompatible");
}
} }
/* initialize zbuf - compression buffer */ /* initialize zbuf - compression buffer */
@@ -114,14 +138,46 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
/* Initialize PNG structure for reading, and allocate any memory needed. /* Initialize PNG structure for reading, and allocate any memory needed.
This interface is deprecated in favour of the png_create_read_struct(), This interface is deprecated in favour of the png_create_read_struct(),
and it will eventually disappear. */ and it will eventually disappear. */
void #undef png_read_init
void PNGAPI
png_read_init(png_structp png_ptr) png_read_init(png_structp png_ptr)
{
/* We only come here via pre-1.0.7-compiled applications */
png_read_init_2(png_ptr, "1.0.0", 10000, 10000);
}
void PNGAPI
png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_size_t png_struct_size, png_size_t png_info_size)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
jmp_buf tmp_jmp; /* to save current jump buffer */ jmp_buf tmp_jmp; /* to save current jump buffer */
#endif #endif
png_debug(1, "in png_read_init\n"); int i=0;
do
{
if(user_png_ver[i] != png_libpng_ver[i])
{
#ifdef PNG_LEGACY_SUPPORTED
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
#else
png_ptr->error_fn=(png_error_ptr)NULL;
png_error(png_ptr,
"Application uses deprecated png_read_init() and must be recompiled.");
#endif
}
} while (png_libpng_ver[i++]);
if(sizeof(png_struct) > png_struct_size ||
sizeof(png_info) > png_info_size)
{
png_ptr->error_fn=(png_error_ptr)NULL;
png_error(png_ptr,
"Application and library have different sized structs. Please recompile.");
}
png_debug(1, "in png_read_init_2\n");
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */ /* save jump buffer and error functions */
@@ -167,7 +223,7 @@ png_read_init(png_structp png_ptr)
* here. The application can then have access to the signature bytes we * here. The application can then have access to the signature bytes we
* read if it is determined that this isn't a valid PNG file. * read if it is determined that this isn't a valid PNG file.
*/ */
void void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr) png_read_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_info\n"); png_debug(1, "in png_read_info\n");
@@ -376,7 +432,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
} }
/* optional call to update the users info_ptr structure */ /* optional call to update the users info_ptr structure */
void void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr) png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_update_info\n"); png_debug(1, "in png_read_update_info\n");
@@ -391,7 +447,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
* the user to obtain a gamma-corrected palette, for example. * the user to obtain a gamma-corrected palette, for example.
* If the user doesn't call this, we will do it ourselves. * If the user doesn't call this, we will do it ourselves.
*/ */
void void PNGAPI
png_start_read_image(png_structp png_ptr) png_start_read_image(png_structp png_ptr)
{ {
png_debug(1, "in png_start_read_image\n"); png_debug(1, "in png_start_read_image\n");
@@ -400,7 +456,7 @@ png_start_read_image(png_structp png_ptr)
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
} }
void void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -641,10 +697,10 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
* not called png_set_interlace_handling(), the display_row buffer will * not called png_set_interlace_handling(), the display_row buffer will
* be ignored, so pass NULL to it. * be ignored, so pass NULL to it.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6h. * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta11
*/ */
void void PNGAPI
png_read_rows(png_structp png_ptr, png_bytepp row, png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp display_row, png_uint_32 num_rows) png_bytepp display_row, png_uint_32 num_rows)
{ {
@@ -690,9 +746,9 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
* only call this function once. If you desire to have an image for * only call this function once. If you desire to have an image for
* each pass of a interlaced image, use png_read_rows() instead. * each pass of a interlaced image, use png_read_rows() instead.
* *
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6h. * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta11
*/ */
void void PNGAPI
png_read_image(png_structp png_ptr, png_bytepp image) png_read_image(png_structp png_ptr, png_bytepp image)
{ {
png_uint_32 i,image_height; png_uint_32 i,image_height;
@@ -730,7 +786,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
* file, will verify the end is accurate, and will read any comments * file, will verify the end is accurate, and will read any comments
* or time information at the end of the file, if info is not NULL. * or time information at the end of the file, if info is not NULL.
*/ */
void void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr) png_read_end(png_structp png_ptr, png_infop info_ptr)
{ {
png_byte chunk_length[4]; png_byte chunk_length[4];
@@ -912,7 +968,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
} }
/* free all memory used by the read */ /* free all memory used by the read */
void void PNGAPI
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_infopp end_info_ptr_ptr) png_infopp end_info_ptr_ptr)
{ {
@@ -978,7 +1034,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
} }
/* free all memory used by the read (old method) */ /* free all memory used by the read (old method) */
void void PNGAPI
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
@@ -1013,19 +1069,37 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->gamma_from_1); png_free(png_ptr, png_ptr->gamma_from_1);
png_free(png_ptr, png_ptr->gamma_to_1); png_free(png_ptr, png_ptr->gamma_to_1);
#endif #endif
#ifdef PNG_FREE_ME_SUPPORTED
if (png_ptr->free_me & PNG_FREE_PLTE) if (png_ptr->free_me & PNG_FREE_PLTE)
png_zfree(png_ptr, png_ptr->palette); png_zfree(png_ptr, png_ptr->palette);
png_ptr->free_me &= ~PNG_FREE_PLTE; png_ptr->free_me &= ~PNG_FREE_PLTE;
#else
if (png_ptr->flags & PNG_FLAG_FREE_PLTE)
png_zfree(png_ptr, png_ptr->palette);
png_ptr->flags &= ~PNG_FLAG_FREE_PLTE;
#endif
#if defined(PNG_tRNS_SUPPORTED) || \ #if defined(PNG_tRNS_SUPPORTED) || \
defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
#ifdef PNG_FREE_ME_SUPPORTED
if (png_ptr->free_me & PNG_FREE_TRNS) if (png_ptr->free_me & PNG_FREE_TRNS)
png_free(png_ptr, png_ptr->trans); png_free(png_ptr, png_ptr->trans);
png_ptr->free_me &= ~PNG_FREE_TRNS; png_ptr->free_me &= ~PNG_FREE_TRNS;
#else
if (png_ptr->flags & PNG_FLAG_FREE_TRNS)
png_free(png_ptr, png_ptr->trans);
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
#endif
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
#ifdef PNG_FREE_ME_SUPPORTED
if (png_ptr->free_me & PNG_FREE_HIST) if (png_ptr->free_me & PNG_FREE_HIST)
png_free(png_ptr, png_ptr->hist); png_free(png_ptr, png_ptr->hist);
png_ptr->free_me &= ~PNG_FREE_HIST; png_ptr->free_me &= ~PNG_FREE_HIST;
#else
if (png_ptr->flags & PNG_FLAG_FREE_HIST)
png_free(png_ptr, png_ptr->hist);
png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
#endif
#endif #endif
#if defined(PNG_READ_GAMMA_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED)
if (png_ptr->gamma_16_table != NULL) if (png_ptr->gamma_16_table != NULL)
@@ -1099,14 +1173,15 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
} }
void void PNGAPI
png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
{ {
png_ptr->read_row_fn = read_row_fn; png_ptr->read_row_fn = read_row_fn;
} }
#if defined(PNG_INFO_IMAGE_SUPPORTED) #if defined(PNG_INFO_IMAGE_SUPPORTED)
void png_read_png(png_structp png_ptr, png_infop info_ptr, void PNGAPI
png_read_png(png_structp png_ptr, png_infop info_ptr,
int transforms, int transforms,
voidp params) voidp params)
{ {
@@ -1218,15 +1293,29 @@ void png_read_png(png_structp png_ptr, png_infop info_ptr,
/* -------------- image transformations end here ------------------- */ /* -------------- image transformations end here ------------------- */
if(info_ptr->row_pointers)
{
#ifdef PNG_FREE_ME_SUPPORTED
if(info_ptr->free_me & PNG_FREE_ROWS)
{
for (row = 0; row < (int)info_ptr->height; row++)
png_free(png_ptr, info_ptr->row_pointers[row]);
png_free(png_ptr, info_ptr->row_pointers);
info_ptr->row_pointers = NULL;
}
#endif
}
if(info_ptr->row_pointers == NULL) if(info_ptr->row_pointers == NULL)
{ {
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
info_ptr->height * sizeof(png_bytep)); info_ptr->height * sizeof(png_bytep));
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_ROWS; info_ptr->free_me |= PNG_FREE_ROWS;
#endif
for (row = 0; row < (int)info_ptr->height; row++)
info_ptr->row_pointers[row] = png_malloc(png_ptr,
png_get_rowbytes(png_ptr, info_ptr));
} }
for (row = 0; row < (int)info_ptr->height; row++)
info_ptr->row_pointers[row] = png_malloc(png_ptr,
png_get_rowbytes(png_ptr, info_ptr));
png_read_image(png_ptr, info_ptr->row_pointers); png_read_image(png_ptr, info_ptr->row_pointers);
info_ptr->valid |= PNG_INFO_IDAT; info_ptr->valid |= PNG_INFO_IDAT;

View File

@@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -23,7 +23,7 @@
with very small lengths, so you should implement some kind of simple with very small lengths, so you should implement some kind of simple
buffering if you are using unbuffered reads. This should never be asked buffering if you are using unbuffered reads. This should never be asked
to read more then 64K on a 16 bit machine. */ to read more then 64K on a 16 bit machine. */
void void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_debug1(4,"reading %d bytes\n", length); png_debug1(4,"reading %d bytes\n", length);
@@ -39,7 +39,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
read_data function and use it at run time with png_set_read_fn(), rather read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */ than changing the library. */
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
static void static void /* PRIVATE */
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_size_t check; png_size_t check;
@@ -64,7 +64,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024 #define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b) #define MIN(a,b) (a <= b ? a : b)
static void static void /* PRIVATE */
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
int check; int check;
@@ -119,7 +119,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
unsigned int that is the number of bytes to be read. unsigned int that is the number of bytes to be read.
To exit and output any fatal error messages the new write To exit and output any fatal error messages the new write
function should call png_error(png_ptr, "Error msg"). */ function should call png_error(png_ptr, "Error msg"). */
void void PNGAPI
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn) png_rw_ptr read_data_fn)
{ {

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
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -17,7 +17,7 @@
#include "png.h" #include "png.h"
/* Set the action on getting a CRC error for an ancillary or critical chunk. */ /* Set the action on getting a CRC error for an ancillary or critical chunk. */
void void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
{ {
png_debug(1, "in png_set_crc_action\n"); png_debug(1, "in png_set_crc_action\n");
@@ -72,7 +72,7 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_FLOATING_POINT_SUPPORTED) defined(PNG_FLOATING_POINT_SUPPORTED)
/* handle alpha and tRNS via a background color */ /* handle alpha and tRNS via a background color */
void void PNGAPI
png_set_background(png_structp png_ptr, png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code, png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma) int need_expand, double background_gamma)
@@ -105,7 +105,7 @@ png_set_background(png_structp png_ptr,
#if defined(PNG_READ_16_TO_8_SUPPORTED) #if defined(PNG_READ_16_TO_8_SUPPORTED)
/* strip 16 bit depth files to 8 bit depth */ /* strip 16 bit depth files to 8 bit depth */
void void PNGAPI
png_set_strip_16(png_structp png_ptr) png_set_strip_16(png_structp png_ptr)
{ {
png_debug(1, "in png_set_strip_16\n"); png_debug(1, "in png_set_strip_16\n");
@@ -114,7 +114,7 @@ png_set_strip_16(png_structp png_ptr)
#endif #endif
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
void void PNGAPI
png_set_strip_alpha(png_structp png_ptr) png_set_strip_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_strip_alpha\n"); png_debug(1, "in png_set_strip_alpha\n");
@@ -141,7 +141,7 @@ typedef struct png_dsort_struct
typedef png_dsort FAR * png_dsortp; typedef png_dsort FAR * png_dsortp;
typedef png_dsort FAR * FAR * png_dsortpp; typedef png_dsort FAR * FAR * png_dsortpp;
void void PNGAPI
png_set_dither(png_structp png_ptr, png_colorp palette, png_set_dither(png_structp png_ptr, png_colorp palette,
int num_palette, int maximum_colors, png_uint_16p histogram, int num_palette, int maximum_colors, png_uint_16p histogram,
int full_dither) int full_dither)
@@ -511,7 +511,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
* are not close reciprocals, otherwise it slows things down slightly, and * are not close reciprocals, otherwise it slows things down slightly, and
* also needlessly introduces small errors. * also needlessly introduces small errors.
*/ */
void void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
{ {
png_debug(1, "in png_set_gamma\n"); png_debug(1, "in png_set_gamma\n");
@@ -527,7 +527,7 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks * less than 8-bit depth to 8-bit depth, and expand tRNS chunks
* to alpha channels. * to alpha channels.
*/ */
void void PNGAPI
png_set_expand(png_structp png_ptr) png_set_expand(png_structp png_ptr)
{ {
png_debug(1, "in png_set_expand\n"); png_debug(1, "in png_set_expand\n");
@@ -549,7 +549,7 @@ png_set_expand(png_structp png_ptr)
*/ */
/* Expand paletted images to RGB. */ /* Expand paletted images to RGB. */
void void PNGAPI
png_set_palette_to_rgb(png_structp png_ptr) png_set_palette_to_rgb(png_structp png_ptr)
{ {
png_debug(1, "in png_set_expand\n"); png_debug(1, "in png_set_expand\n");
@@ -557,7 +557,7 @@ png_set_palette_to_rgb(png_structp png_ptr)
} }
/* Expand grayscale images of less than 8-bit depth to 8 bits. */ /* Expand grayscale images of less than 8-bit depth to 8 bits. */
void void PNGAPI
png_set_gray_1_2_4_to_8(png_structp png_ptr) png_set_gray_1_2_4_to_8(png_structp png_ptr)
{ {
png_debug(1, "in png_set_expand\n"); png_debug(1, "in png_set_expand\n");
@@ -565,7 +565,7 @@ png_set_gray_1_2_4_to_8(png_structp png_ptr)
} }
/* Expand tRNS chunks to alpha channels. */ /* Expand tRNS chunks to alpha channels. */
void void PNGAPI
png_set_tRNS_to_alpha(png_structp png_ptr) png_set_tRNS_to_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_expand\n"); png_debug(1, "in png_set_expand\n");
@@ -574,7 +574,7 @@ png_set_tRNS_to_alpha(png_structp png_ptr)
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ #endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
void void PNGAPI
png_set_gray_to_rgb(png_structp png_ptr) png_set_gray_to_rgb(png_structp png_ptr)
{ {
png_debug(1, "in png_set_gray_to_rgb\n"); png_debug(1, "in png_set_gray_to_rgb\n");
@@ -588,7 +588,7 @@ png_set_gray_to_rgb(png_structp png_ptr)
* for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image. * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
*/ */
void void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
double green) double green)
{ {
@@ -598,7 +598,7 @@ png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
} }
#endif #endif
void void PNGAPI
png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green) png_fixed_point red, png_fixed_point green)
{ {
@@ -645,21 +645,30 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
} }
#endif #endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
void defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
void PNGAPI
png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
read_user_transform_fn) read_user_transform_fn)
{ {
png_debug(1, "in png_set_read_user_transform_fn\n"); png_debug(1, "in png_set_read_user_transform_fn\n");
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_ptr->transformations |= PNG_USER_TRANSFORM; png_ptr->transformations |= PNG_USER_TRANSFORM;
png_ptr->read_user_transform_fn = read_user_transform_fn; png_ptr->read_user_transform_fn = read_user_transform_fn;
#endif
#ifdef PNG_LEGACY_SUPPORTED
if(read_user_transform_fn)
png_warning(png_ptr,
"This version of libpng does not support user transforms");
#endif
} }
#endif #endif
/* Initialize everything needed for the read. This includes modifying /* Initialize everything needed for the read. This includes modifying
* the palette. * the palette.
*/ */
void void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr) png_init_read_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_init_read_transformations\n"); png_debug(1, "in png_init_read_transformations\n");
@@ -976,7 +985,7 @@ png_init_read_transformations(png_structp png_ptr)
* info should be updated so a PNG file could be written with it, * info should be updated so a PNG file could be written with it,
* assuming the transformations result in valid PNG data. * assuming the transformations result in valid PNG data.
*/ */
void void /* PRIVATE */
png_read_transform_info(png_structp png_ptr, png_infop info_ptr) png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_transform_info\n"); png_debug(1, "in png_read_transform_info\n");
@@ -1079,7 +1088,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
info_ptr->channels++; info_ptr->channels++;
#endif #endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
if(png_ptr->transformations & PNG_USER_TRANSFORM) if(png_ptr->transformations & PNG_USER_TRANSFORM)
{ {
if(info_ptr->bit_depth < png_ptr->user_transform_depth) if(info_ptr->bit_depth < png_ptr->user_transform_depth)
@@ -1099,7 +1109,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
* and is very touchy. If you add a transformation, take care to * and is very touchy. If you add a transformation, take care to
* decide how it fits in with the other transformations here. * decide how it fits in with the other transformations here.
*/ */
void void /* PRIVATE */
png_do_read_transformations(png_structp png_ptr) png_do_read_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_do_read_transformations\n"); png_debug(1, "in png_do_read_transformations\n");
@@ -1307,10 +1317,12 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
/* png_byte channels; number of channels (1-4) */ /* png_byte channels; number of channels (1-4) */
/* png_byte pixel_depth; bits per pixel (depth*channels) */ /* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */ png_ptr->row_buf + 1); /* start of pixel data for row */
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if(png_ptr->user_transform_depth) if(png_ptr->user_transform_depth)
png_ptr->row_info.bit_depth = png_ptr->user_transform_depth; png_ptr->row_info.bit_depth = png_ptr->user_transform_depth;
if(png_ptr->user_transform_channels) if(png_ptr->user_transform_channels)
png_ptr->row_info.channels = png_ptr->user_transform_channels; png_ptr->row_info.channels = png_ptr->user_transform_channels;
#endif
png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
png_ptr->row_info.channels); png_ptr->row_info.channels);
png_ptr->row_info.rowbytes = (png_ptr->row_info.width * png_ptr->row_info.rowbytes = (png_ptr->row_info.width *
@@ -1327,7 +1339,7 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
* the numbers 0 or 1. If you would rather they contain 0 and 255, use * the numbers 0 or 1. If you would rather they contain 0 and 255, use
* png_do_shift() after this. * png_do_shift() after this.
*/ */
void void /* PRIVATE */
png_do_unpack(png_row_infop row_info, png_bytep row) png_do_unpack(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_unpack\n"); png_debug(1, "in png_do_unpack\n");
@@ -1417,7 +1429,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
* a row of bit depth 8, but only 5 are significant, this will shift * a row of bit depth 8, but only 5 are significant, this will shift
* the values back to 0 through 31. * the values back to 0 through 31.
*/ */
void void /* PRIVATE */
png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits) png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
{ {
png_debug(1, "in png_do_unshift\n"); png_debug(1, "in png_do_unshift\n");
@@ -1523,7 +1535,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
#if defined(PNG_READ_16_TO_8_SUPPORTED) #if defined(PNG_READ_16_TO_8_SUPPORTED)
/* chop rows of bit depth 16 down to 8 */ /* chop rows of bit depth 16 down to 8 */
void void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row) png_do_chop(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_chop\n"); png_debug(1, "in png_do_chop\n");
@@ -1577,7 +1589,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
#endif #endif
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
void void /* PRIVATE */
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_read_swap_alpha\n"); png_debug(1, "in png_do_read_swap_alpha\n");
@@ -1669,7 +1681,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
#endif #endif
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
void void /* PRIVATE */
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_read_invert_alpha\n"); png_debug(1, "in png_do_read_invert_alpha\n");
@@ -1768,7 +1780,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
#if defined(PNG_READ_FILLER_SUPPORTED) #if defined(PNG_READ_FILLER_SUPPORTED)
/* Add filler channel if we have RGB color */ /* Add filler channel if we have RGB color */
void void /* PRIVATE */
png_do_read_filler(png_row_infop row_info, png_bytep row, png_do_read_filler(png_row_infop row_info, png_bytep row,
png_uint_32 filler, png_uint_32 flags) png_uint_32 filler, png_uint_32 flags)
{ {
@@ -1944,7 +1956,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
/* expand grayscale files to RGB, with or without alpha */ /* expand grayscale files to RGB, with or without alpha */
void void /* PRIVATE */
png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
{ {
png_uint_32 i; png_uint_32 i;
@@ -2046,7 +2058,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
* *
* Other integer coefficents can be used via png_set_rgb_to_gray(). * Other integer coefficents can be used via png_set_rgb_to_gray().
*/ */
int int /* PRIVATE */
png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
{ {
@@ -2286,7 +2298,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
* paletted. Most useful for gamma correction and simplification * paletted. Most useful for gamma correction and simplification
* of code. * of code.
*/ */
void void /* PRIVATE */
png_build_grayscale_palette(int bit_depth, png_colorp palette) png_build_grayscale_palette(int bit_depth, png_colorp palette)
{ {
int num_palette; int num_palette;
@@ -2332,7 +2344,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
/* This function is currently unused. Do we really need it? */ /* This function is currently unused. Do we really need it? */
#if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED) #if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED)
void void /* PRIVATE */
png_correct_palette(png_structp png_ptr, png_colorp palette, png_correct_palette(png_structp png_ptr, png_colorp palette,
int num_palette) int num_palette)
{ {
@@ -2517,7 +2529,7 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
* "background" is already in the screen gamma, while "background_1" is * "background" is already in the screen gamma, while "background_1" is
* at a gamma of 1.0. Paletted files have already been taken care of. * at a gamma of 1.0. Paletted files have already been taken care of.
*/ */
void void /* PRIVATE */
png_do_background(png_row_infop row_info, png_bytep row, png_do_background(png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background, png_color_16p trans_values, png_color_16p background,
png_color_16p background_1, png_color_16p background_1,
@@ -3188,7 +3200,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
* is 16, use gamma_16_table and gamma_shift. Build these with * is 16, use gamma_16_table and gamma_shift. Build these with
* build_gamma_table(). * build_gamma_table().
*/ */
void void /* PRIVATE */
png_do_gamma(png_row_infop row_info, png_bytep row, png_do_gamma(png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table, png_bytep gamma_table, png_uint_16pp gamma_16_table,
int gamma_shift) int gamma_shift)
@@ -3370,7 +3382,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
/* Expands a palette row to an RGB or RGBA row depending /* Expands a palette row to an RGB or RGBA row depending
* upon whether you supply trans and num_trans. * upon whether you supply trans and num_trans.
*/ */
void void /* PRIVATE */
png_do_expand_palette(png_row_infop row_info, png_bytep row, png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_colorp palette, png_bytep trans, int num_trans) png_colorp palette, png_bytep trans, int num_trans)
{ {
@@ -3513,7 +3525,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
/* If the bit depth < 8, it is expanded to 8. Also, if the /* If the bit depth < 8, it is expanded to 8. Also, if the
* transparency value is supplied, an alpha channel is built. * transparency value is supplied, an alpha channel is built.
*/ */
void void /* PRIVATE */
png_do_expand(png_row_infop row_info, png_bytep row, png_do_expand(png_row_infop row_info, png_bytep row,
png_color_16p trans_value) png_color_16p trans_value)
{ {
@@ -3712,7 +3724,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
#endif #endif
#if defined(PNG_READ_DITHER_SUPPORTED) #if defined(PNG_READ_DITHER_SUPPORTED)
void void /* PRIVATE */
png_do_dither(png_row_infop row_info, png_bytep row, png_do_dither(png_row_infop row_info, png_bytep row,
png_bytep palette_lookup, png_bytep dither_lookup) png_bytep palette_lookup, png_bytep dither_lookup)
{ {
@@ -3814,7 +3826,7 @@ static int png_gamma_shift[] =
* the future. Note also how the gamma_16 tables are segmented so that * the future. Note also how the gamma_16 tables are segmented so that
* we don't need to allocate > 64K chunks for a full 16-bit table. * we don't need to allocate > 64K chunks for a full 16-bit table.
*/ */
void void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr) png_build_gamma_table(png_structp png_ptr)
{ {
png_debug(1, "in png_build_gamma_table\n"); png_debug(1, "in png_build_gamma_table\n");

View File

@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -16,7 +16,7 @@
#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ /* Grab an unsigned 32-bit integer from a buffer in big-endian format. */
png_uint_32 png_uint_32 /* PRIVATE */
png_get_uint_32(png_bytep buf) png_get_uint_32(png_bytep buf)
{ {
png_uint_32 i = ((png_uint_32)(*buf) << 24) + png_uint_32 i = ((png_uint_32)(*buf) << 24) +
@@ -31,7 +31,7 @@ png_get_uint_32(png_bytep buf)
/* Grab a signed 32-bit integer from a buffer in big-endian format. The /* Grab a signed 32-bit integer from a buffer in big-endian format. The
* data is stored in the PNG file in two's complement format, and it is * data is stored in the PNG file in two's complement format, and it is
* assumed that the machine format for signed integers is the same. */ * assumed that the machine format for signed integers is the same. */
png_int_32 png_int_32 /* PRIVATE */
png_get_int_32(png_bytep buf) png_get_int_32(png_bytep buf)
{ {
png_int_32 i = ((png_int_32)(*buf) << 24) + png_int_32 i = ((png_int_32)(*buf) << 24) +
@@ -44,7 +44,7 @@ png_get_int_32(png_bytep buf)
#endif /* PNG_READ_pCAL_SUPPORTED */ #endif /* PNG_READ_pCAL_SUPPORTED */
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ /* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
png_uint_16 png_uint_16 /* PRIVATE */
png_get_uint_16(png_bytep buf) png_get_uint_16(png_bytep buf)
{ {
png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) +
@@ -55,7 +55,7 @@ png_get_uint_16(png_bytep buf)
#endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */ #endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */
/* Read data, and (optionally) run it through the CRC. */ /* Read data, and (optionally) run it through the CRC. */
void void /* PRIVATE */
png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
{ {
png_read_data(png_ptr, buf, length); png_read_data(png_ptr, buf, length);
@@ -66,7 +66,7 @@ png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
are reading a ancillary or critical chunk, and how the program has set are reading a ancillary or critical chunk, and how the program has set
things up, we may calculate the CRC on the data and print a message. things up, we may calculate the CRC on the data and print a message.
Returns '1' if there was a CRC error, '0' otherwise. */ Returns '1' if there was a CRC error, '0' otherwise. */
int int /* PRIVATE */
png_crc_finish(png_structp png_ptr, png_uint_32 skip) png_crc_finish(png_structp png_ptr, png_uint_32 skip)
{ {
png_size_t i; png_size_t i;
@@ -102,7 +102,7 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
/* Compare the CRC stored in the PNG file with that calculated by libpng from /* Compare the CRC stored in the PNG file with that calculated by libpng from
the data it has read thus far. */ the data it has read thus far. */
int int /* PRIVATE */
png_crc_error(png_structp png_ptr) png_crc_error(png_structp png_ptr)
{ {
png_byte crc_bytes[4]; png_byte crc_bytes[4];
@@ -141,7 +141,8 @@ png_crc_error(png_structp png_ptr)
* holding the original prefix part and an uncompressed version of the * holding the original prefix part and an uncompressed version of the
* trailing part (the malloc area passed in is freed). * trailing part (the malloc area passed in is freed).
*/ */
png_charp png_decompress_chunk(png_structp png_ptr, int comp_type, png_charp /* PRIVATE */
png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp chunkdata, png_size_t chunklength, png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength) png_size_t prefix_size, png_size_t *newlength)
{ {
@@ -251,7 +252,7 @@ png_charp png_decompress_chunk(png_structp png_ptr, int comp_type,
#endif #endif
/* read and check the IDHR chunk */ /* read and check the IDHR chunk */
void void /* PRIVATE */
png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_byte buf[13]; png_byte buf[13];
@@ -348,7 +349,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
/* read and check the palette */ /* read and check the palette */
void void /* PRIVATE */
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_colorp palette; png_colorp palette;
@@ -446,11 +447,15 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->palette = palette; png_ptr->palette = palette;
png_ptr->num_palette = (png_uint_16)num; png_ptr->num_palette = (png_uint_16)num;
#ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
png_ptr->free_me |= PNG_FREE_PLTE; png_ptr->free_me |= PNG_FREE_PLTE;
#else
png_ptr->flags |= PNG_FLAG_FREE_PLTE;
#endif
png_set_PLTE(png_ptr, info_ptr, palette, num); png_set_PLTE(png_ptr, info_ptr, palette, num);
#if defined (PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
@@ -471,7 +476,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
void void /* PRIVATE */
png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_debug(1, "in png_handle_IEND\n"); png_debug(1, "in png_handle_IEND\n");
@@ -495,7 +500,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
void void /* PRIVATE */
png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_fixed_point igamma; png_fixed_point igamma;
@@ -572,7 +577,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
void void /* PRIVATE */
png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_size_t truelen; png_size_t truelen;
@@ -638,7 +643,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
void void /* PRIVATE */
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_byte buf[4]; png_byte buf[4];
@@ -795,7 +800,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
void void /* PRIVATE */
png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
int intent; int intent;
@@ -849,8 +854,19 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
igamma=(int)info_ptr->int_gamma; igamma=(int)info_ptr->int_gamma;
#else #else
# ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
igamma=info_ptr->gamma * 100000.; igamma=(int)(info_ptr->gamma * 100000.);
# endif # endif
#endif
#if 0 && defined(PNG_cHRM_SUPPORTED) && !defined(PNG_FIXED_POINT_SUPPORTED)
/* We need to define these here because they aren't in png.h */
png_fixed_point int_x_white;
png_fixed_point int_y_white;
png_fixed_point int_x_red;
png_fixed_point int_y_red;
png_fixed_point int_x_green;
png_fixed_point int_y_green;
png_fixed_point int_x_blue;
png_fixed_point int_y_blue;
#endif #endif
if(igamma < 45000L || igamma > 46000L) if(igamma < 45000L || igamma > 46000L)
{ {
@@ -870,6 +886,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif /* PNG_READ_gAMA_SUPPORTED */ #endif /* PNG_READ_gAMA_SUPPORTED */
#ifdef PNG_READ_cHRM_SUPPORTED #ifdef PNG_READ_cHRM_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
if (info_ptr->valid & PNG_INFO_cHRM) if (info_ptr->valid & PNG_INFO_cHRM)
if (abs(info_ptr->int_x_white - 31270L) > 1000 || if (abs(info_ptr->int_x_white - 31270L) > 1000 ||
abs(info_ptr->int_y_white - 32900L) > 1000 || abs(info_ptr->int_y_white - 32900L) > 1000 ||
@@ -883,6 +900,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, png_warning(png_ptr,
"Ignoring incorrect cHRM value when sRGB is also present"); "Ignoring incorrect cHRM value when sRGB is also present");
} }
#endif /* PNG_FIXED_POINT_SUPPORTED */
#endif /* PNG_READ_cHRM_SUPPORTED */ #endif /* PNG_READ_cHRM_SUPPORTED */
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent); png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent);
@@ -890,7 +908,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif /* PNG_READ_sRGB_SUPPORTED */ #endif /* PNG_READ_sRGB_SUPPORTED */
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
void void /* PRIVATE */
png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */ /* Note: this does not properly handle chunks that are > 64K under DOS */
{ {
@@ -969,7 +987,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif /* PNG_READ_iCCP_SUPPORTED */ #endif /* PNG_READ_iCCP_SUPPORTED */
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
void void /* PRIVATE */
png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */ /* Note: this does not properly handle chunks that are > 64K under DOS */
{ {
@@ -1071,7 +1089,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif /* PNG_READ_sPLT_SUPPORTED */ #endif /* PNG_READ_sPLT_SUPPORTED */
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
void void /* PRIVATE */
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_debug(1, "in png_handle_tRNS\n"); png_debug(1, "in png_handle_tRNS\n");
@@ -1157,15 +1175,19 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (png_crc_finish(png_ptr, 0)) if (png_crc_finish(png_ptr, 0))
return; return;
#ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
png_ptr->free_me |= PNG_FREE_TRNS; png_ptr->free_me |= PNG_FREE_TRNS;
#else
png_ptr->flags |= PNG_FLAG_FREE_TRNS;
#endif
png_set_tRNS(png_ptr, info_ptr, png_ptr->trans, png_ptr->num_trans, png_set_tRNS(png_ptr, info_ptr, png_ptr->trans, png_ptr->num_trans,
&(png_ptr->trans_values)); &(png_ptr->trans_values));
} }
#endif #endif
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
void void /* PRIVATE */
png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_size_t truelen; png_size_t truelen;
@@ -1255,7 +1277,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
void void /* PRIVATE */
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
int num, i; int num, i;
@@ -1304,14 +1326,18 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (png_crc_finish(png_ptr, 0)) if (png_crc_finish(png_ptr, 0))
return; return;
#ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
png_ptr->free_me |= PNG_FREE_HIST; png_ptr->free_me |= PNG_FREE_HIST;
#else
png_ptr->flags |= PNG_FLAG_FREE_HIST;
#endif
png_set_hIST(png_ptr, info_ptr, png_ptr->hist); png_set_hIST(png_ptr, info_ptr, png_ptr->hist);
} }
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
void void /* PRIVATE */
png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_byte buf[9]; png_byte buf[9];
@@ -1354,7 +1380,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
void void /* PRIVATE */
png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_byte buf[9]; png_byte buf[9];
@@ -1398,7 +1424,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
/* read the pCAL chunk (png-scivis-19970203) */ /* read the pCAL chunk (png-scivis-19970203) */
void void /* PRIVATE */
png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_charp purpose; png_charp purpose;
@@ -1515,7 +1541,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
/* read the sCAL chunk */ /* read the sCAL chunk */
void void /* PRIVATE */
png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_charp buffer, ep; png_charp buffer, ep;
@@ -1627,7 +1653,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
void void /* PRIVATE */
png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_byte buf[7]; png_byte buf[7];
@@ -1671,7 +1697,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
/* Note: this does not properly handle chunks that are > 64K under DOS */ /* Note: this does not properly handle chunks that are > 64K under DOS */
void void /* PRIVATE */
png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_textp text_ptr; png_textp text_ptr;
@@ -1718,11 +1744,13 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr->key = key; text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->lang = NULL; text_ptr->lang = NULL;
text_ptr->lang_key = NULL; text_ptr->lang_key = NULL;
text_ptr->itxt_length = 0;
#endif
text_ptr->text = text; text_ptr->text = text;
text_ptr->text_length = png_strlen(text); text_ptr->text_length = png_strlen(text);
text_ptr->itxt_length = 0;
png_set_text(png_ptr, info_ptr, text_ptr, 1); png_set_text(png_ptr, info_ptr, text_ptr, 1);
@@ -1733,7 +1761,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
/* note: this does not correctly handle chunks that are > 64K under DOS */ /* note: this does not correctly handle chunks that are > 64K under DOS */
void void /* PRIVATE */
png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_textp text_ptr; png_textp text_ptr;
@@ -1792,12 +1820,14 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text)); text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
text_ptr->compression = comp_type; text_ptr->compression = comp_type;
text_ptr->lang = NULL;
text_ptr->key = chunkdata; text_ptr->key = chunkdata;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->lang = NULL;
text_ptr->lang_key = NULL; text_ptr->lang_key = NULL;
text_ptr->itxt_length = 0;
#endif
text_ptr->text = chunkdata + prefix_len; text_ptr->text = chunkdata + prefix_len;
text_ptr->text_length = data_len; text_ptr->text_length = data_len;
text_ptr->itxt_length = 0;
png_set_text(png_ptr, info_ptr, text_ptr, 1); png_set_text(png_ptr, info_ptr, text_ptr, 1);
@@ -1808,7 +1838,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
/* note: this does not correctly handle chunks that are > 64K under DOS */ /* note: this does not correctly handle chunks that are > 64K under DOS */
void void /* PRIVATE */
png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_textp text_ptr; png_textp text_ptr;
@@ -1887,10 +1917,10 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
text_ptr->compression = (int)comp_flag + 1; text_ptr->compression = (int)comp_flag + 1;
text_ptr->lang_key = chunkdata+(lang_key-key); text_ptr->lang_key = chunkdata+(lang_key-key);
text_ptr->lang = chunkdata+(lang-key); text_ptr->lang = chunkdata+(lang-key);
text_ptr->itxt_length = data_len;
text_ptr->text_length = 0;
text_ptr->key = chunkdata; text_ptr->key = chunkdata;
text_ptr->text = chunkdata + prefix_len; text_ptr->text = chunkdata + prefix_len;
text_ptr->text_length = 0;
text_ptr->itxt_length = data_len;
png_set_text(png_ptr, info_ptr, text_ptr, 1); png_set_text(png_ptr, info_ptr, text_ptr, 1);
@@ -1904,7 +1934,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
chunk name, CRC, or a critical chunk), the chunk is silently ignored chunk name, CRC, or a critical chunk), the chunk is silently ignored
-- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which -- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which
case it will be saved away to be written out later. */ case it will be saved away to be written out later. */
void void /* PRIVATE */
png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_uint_32 skip = 0; png_uint_32 skip = 0;
@@ -1924,12 +1954,14 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (!(png_ptr->chunk_name[0] & 0x20)) if (!(png_ptr->chunk_name[0] & 0x20))
{ {
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
HANDLE_CHUNK_ALWAYS HANDLE_CHUNK_ALWAYS
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
&& png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL && png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL
#endif #endif
) )
#endif
png_chunk_error(png_ptr, "unknown critical chunk"); png_chunk_error(png_ptr, "unknown critical chunk");
} }
@@ -1988,7 +2020,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97)) #define isnonalpha(c) ((c) < 41 || (c) > 122 || ((c) > 90 && (c) < 97))
void void /* PRIVATE */
png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
{ {
png_debug(1, "in png_check_chunk_name\n"); png_debug(1, "in png_check_chunk_name\n");
@@ -2009,11 +2041,11 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
a zero indicates the pixel is to be skipped. This is in addition a zero indicates the pixel is to be skipped. This is in addition
to any alpha or transparency value associated with the pixel. If to any alpha or transparency value associated with the pixel. If
you want all pixels to be combined, pass 0xff (255) in mask. */ you want all pixels to be combined, pass 0xff (255) in mask. */
void void /* PRIVATE */
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW #ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
png_combine_row_c png_combine_row_c /* PRIVATE */
#else #else
png_combine_row png_combine_row /* PRIVATE */
#endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */ #endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */
(png_structp png_ptr, png_bytep row, int mask) (png_structp png_ptr, png_bytep row, int mask)
{ {
@@ -2217,7 +2249,7 @@ png_combine_row
} }
#if defined(PNG_READ_INTERLACING_SUPPORTED) #if defined(PNG_READ_INTERLACING_SUPPORTED)
void void /* PRIVATE */
#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE #ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
png_do_read_interlace_c png_do_read_interlace_c
#else #else
@@ -2440,7 +2472,7 @@ png_do_read_interlace
} }
#endif #endif
void void /* PRIVATE */
#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW #ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
png_read_filter_row_c png_read_filter_row_c
#else #else
@@ -2568,7 +2600,7 @@ png_read_filter_row
} }
} }
void void /* PRIVATE */
png_read_finish_row(png_structp png_ptr) png_read_finish_row(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -2690,7 +2722,7 @@ png_read_finish_row(png_structp png_ptr)
png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->mode |= PNG_AFTER_IDAT;
} }
void void /* PRIVATE */
png_read_start_row(png_structp png_ptr) png_read_start_row(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -2831,7 +2863,8 @@ png_read_start_row(png_structp png_ptr)
} }
#endif #endif
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \
defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if(png_ptr->transformations & PNG_USER_TRANSFORM) if(png_ptr->transformations & PNG_USER_TRANSFORM)
{ {
int user_pixel_depth=png_ptr->user_transform_depth* int user_pixel_depth=png_ptr->user_transform_depth*

108
pngset.c
View File

@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -17,7 +17,7 @@
#include "png.h" #include "png.h"
#if defined(PNG_bKGD_SUPPORTED) #if defined(PNG_bKGD_SUPPORTED)
void void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
{ {
png_debug1(1, "in %s storage function\n", "bKGD"); png_debug1(1, "in %s storage function\n", "bKGD");
@@ -31,7 +31,7 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
#if defined(PNG_cHRM_SUPPORTED) #if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr, png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double white_x, double white_y, double red_x, double red_y, double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y) double green_x, double green_y, double blue_x, double blue_y)
@@ -62,7 +62,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void void PNGAPI
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
@@ -97,7 +97,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_gAMA_SUPPORTED) #if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{ {
png_debug1(1, "in %s storage function\n", "gAMA"); png_debug1(1, "in %s storage function\n", "gAMA");
@@ -112,7 +112,7 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
} }
#endif #endif
#endif #endif
void void PNGAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
int_gamma) int_gamma)
{ {
@@ -123,12 +123,14 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
info_ptr->gamma = (float)(int_gamma/100000.); info_ptr->gamma = (float)(int_gamma/100000.);
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_gamma = int_gamma; info_ptr->int_gamma = int_gamma;
#endif
info_ptr->valid |= PNG_INFO_gAMA; info_ptr->valid |= PNG_INFO_gAMA;
} }
#if defined(PNG_hIST_SUPPORTED) #if defined(PNG_hIST_SUPPORTED)
void void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{ {
png_debug1(1, "in %s storage function\n", "hIST"); png_debug1(1, "in %s storage function\n", "hIST");
@@ -140,7 +142,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
} }
#endif #endif
void void PNGAPI
png_set_IHDR(png_structp png_ptr, png_infop info_ptr, png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
@@ -181,7 +183,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
} }
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
void void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type) png_int_32 offset_x, png_int_32 offset_y, int unit_type)
{ {
@@ -197,7 +199,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_pCAL_SUPPORTED) #if defined(PNG_pCAL_SUPPORTED)
void void PNGAPI
png_set_pCAL(png_structp png_ptr, png_infop info_ptr, png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params) png_charp units, png_charpp params)
@@ -243,7 +245,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr, png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height) int unit, double width, double height)
{ {
@@ -259,7 +261,7 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void void PNGAPI
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int unit, png_charp swidth, png_charp sheight) int unit, png_charp swidth, png_charp sheight)
{ {
@@ -288,7 +290,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
void void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr, png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type) png_uint_32 res_x, png_uint_32 res_y, int unit_type)
{ {
@@ -303,7 +305,7 @@ png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
void void PNGAPI
png_set_PLTE(png_structp png_ptr, png_infop info_ptr, png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
png_colorp palette, int num_palette) png_colorp palette, int num_palette)
{ {
@@ -319,7 +321,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
} }
#if defined(PNG_sBIT_SUPPORTED) #if defined(PNG_sBIT_SUPPORTED)
void void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr, png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit) png_color_8p sig_bit)
{ {
@@ -333,7 +335,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_sRGB_SUPPORTED) #if defined(PNG_sRGB_SUPPORTED)
void void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{ {
png_debug1(1, "in %s storage function\n", "sRGB"); png_debug1(1, "in %s storage function\n", "sRGB");
@@ -344,7 +346,7 @@ png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
info_ptr->valid |= PNG_INFO_sRGB; info_ptr->valid |= PNG_INFO_sRGB;
} }
void void PNGAPI
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int intent) int intent)
{ {
@@ -416,7 +418,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_iCCP_SUPPORTED) #if defined(PNG_iCCP_SUPPORTED)
void void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type, png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen) png_charp profile, png_uint_32 proflen)
@@ -441,13 +443,15 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
/* Compression is always zero but is here so the API and info structure /* Compression is always zero but is here so the API and info structure
* does not have to change if we introduce multiple compression types */ * does not have to change if we introduce multiple compression types */
info_ptr->iccp_compression = (png_byte)compression_type; info_ptr->iccp_compression = (png_byte)compression_type;
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_ICCP; info_ptr->free_me |= PNG_FREE_ICCP;
#endif
info_ptr->valid |= PNG_INFO_iCCP; info_ptr->valid |= PNG_INFO_iCCP;
} }
#endif #endif
#if defined(PNG_TEXT_SUPPORTED) #if defined(PNG_TEXT_SUPPORTED)
void void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text) int num_text)
{ {
@@ -488,10 +492,12 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
png_debug1(3, "allocated %d entries for info_ptr->text\n", png_debug1(3, "allocated %d entries for info_ptr->text\n",
info_ptr->max_text); info_ptr->max_text);
} }
for (i = 0; i < num_text; i++) for (i = 0; i < num_text; i++)
{ {
png_size_t text_length,key_len,lang_len,lang_key_len; png_size_t text_length,key_len;
#ifdef PNG_iTXt_SUPPORTED
png_size_t lang_len,lang_key_len;
#endif
png_textp textp = &(info_ptr->text[info_ptr->num_text]); png_textp textp = &(info_ptr->text[info_ptr->num_text]);
if (text_ptr[i].key == (png_charp)NULL) if (text_ptr[i].key == (png_charp)NULL)
@@ -500,6 +506,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
key_len = png_strlen(text_ptr[i].key); key_len = png_strlen(text_ptr[i].key);
if(text_ptr[i].compression > 0) if(text_ptr[i].compression > 0)
#ifdef PNG_iTXt_SUPPORTED
{ {
/* set iTXt data */ /* set iTXt data */
if (text_ptr[i].key != (png_charp)NULL) if (text_ptr[i].key != (png_charp)NULL)
@@ -516,13 +523,21 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
lang_len = 0; lang_len = 0;
lang_key_len = 0; lang_key_len = 0;
} }
#else
{
png_warning(png_ptr, "iTXt chunk not supported.");
continue;
}
#endif
if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0') if (text_ptr[i].text == (png_charp)NULL || text_ptr[i].text[0] == '\0')
{ {
text_length = 0; text_length = 0;
#ifdef PNG_iTXt_SUPPORTED
if(text_ptr[i].compression > 0) if(text_ptr[i].compression > 0)
textp->compression = PNG_ITXT_COMPRESSION_NONE; textp->compression = PNG_ITXT_COMPRESSION_NONE;
else else
#endif
textp->compression = PNG_TEXT_COMPRESSION_NONE; textp->compression = PNG_TEXT_COMPRESSION_NONE;
} }
else else
@@ -532,13 +547,22 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
} }
textp->key = (png_charp)png_malloc(png_ptr, textp->key = (png_charp)png_malloc(png_ptr,
(png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4)); (png_uint_32)(key_len +
#ifdef PNG_iTXt_SUPPORTED
lang_len + lang_key_len +
#endif
text_length + 4));
png_debug2(2, "Allocated %d bytes at %x in png_set_text\n", png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
key_len + lang_len + lang_key_len + text_length + 4, textp->key); key_len +
#ifdef PNG_iTXt_SUPPORTED
lang_len + lang_key_len +
#endif
text_length + 4, textp->key);
png_memcpy(textp->key, text_ptr[i].key, png_memcpy(textp->key, text_ptr[i].key,
(png_size_t)(key_len)); (png_size_t)(key_len));
*(textp->key+key_len) = '\0'; *(textp->key+key_len) = '\0';
#ifdef PNG_iTXt_SUPPORTED
if (text_ptr[i].compression > 0) if (text_ptr[i].compression > 0)
{ {
textp->lang=textp->key + key_len + 1; textp->lang=textp->key + key_len + 1;
@@ -550,38 +574,45 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
textp->text=textp->lang_key + lang_key_len + 1; textp->text=textp->lang_key + lang_key_len + 1;
} }
else else
#endif
{ {
#ifdef PNG_iTXt_SUPPORTED
textp->lang=(png_charp)NULL; textp->lang=(png_charp)NULL;
textp->lang_key=(png_charp)NULL; textp->lang_key=(png_charp)NULL;
#endif
textp->text=textp->key + key_len + 1; textp->text=textp->key + key_len + 1;
} }
if(text_length) if(text_length)
png_memcpy(textp->text, text_ptr[i].text, png_memcpy(textp->text, text_ptr[i].text,
(png_size_t)(text_length)); (png_size_t)(text_length));
*(textp->text+text_length) = '\0'; *(textp->text+text_length) = '\0';
#ifdef PNG_iTXt_SUPPORTED
if(textp->compression > 0) if(textp->compression > 0)
{ {
textp->text_length = 0; textp->text_length = 0;
textp->itxt_length = text_length; textp->itxt_length = text_length;
} }
else else
#endif
{ {
textp->text_length = text_length; textp->text_length = text_length;
#ifdef PNG_iTXt_SUPPORTED
textp->itxt_length = 0; textp->itxt_length = 0;
#endif
} }
info_ptr->text[info_ptr->num_text]= *textp; info_ptr->text[info_ptr->num_text]= *textp;
info_ptr->num_text++; info_ptr->num_text++;
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_TEXT; info_ptr->free_me |= PNG_FREE_TEXT;
#endif
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
} }
} }
#endif #endif
#if defined(PNG_tIME_SUPPORTED) #if defined(PNG_tIME_SUPPORTED)
void void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{ {
png_debug1(1, "in %s storage function\n", "tIME"); png_debug1(1, "in %s storage function\n", "tIME");
@@ -595,7 +626,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
#endif #endif
#if defined(PNG_tRNS_SUPPORTED) #if defined(PNG_tRNS_SUPPORTED)
void void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr, png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans, int num_trans, png_color_16p trans_values) png_bytep trans, int num_trans, png_color_16p trans_values)
{ {
@@ -619,7 +650,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_sPLT_SUPPORTED) #if defined(PNG_sPLT_SUPPORTED)
void void PNGAPI
png_set_sPLT(png_structp png_ptr, png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries) png_infop info_ptr, png_sPLT_tp entries, int nentries)
{ {
@@ -652,12 +683,14 @@ png_set_sPLT(png_structp png_ptr,
info_ptr->splt_palettes = np; info_ptr->splt_palettes = np;
info_ptr->splt_palettes_num += nentries; info_ptr->splt_palettes_num += nentries;
info_ptr->valid |= PNG_INFO_sPLT; info_ptr->valid |= PNG_INFO_sPLT;
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_SPLT; info_ptr->free_me |= PNG_FREE_SPLT;
#endif
} }
#endif /* PNG_sPLT_SUPPORTED */ #endif /* PNG_sPLT_SUPPORTED */
#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) #if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
void void PNGAPI
png_set_unknown_chunks(png_structp png_ptr, png_set_unknown_chunks(png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns) png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
{ {
@@ -691,9 +724,11 @@ png_set_unknown_chunks(png_structp png_ptr,
info_ptr->unknown_chunks = np; info_ptr->unknown_chunks = np;
info_ptr->unknown_chunks_num += num_unknowns; info_ptr->unknown_chunks_num += num_unknowns;
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_UNKN; info_ptr->free_me |= PNG_FREE_UNKN;
#endif
} }
void void PNGAPI
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
int chunk, int location) int chunk, int location)
{ {
@@ -705,7 +740,7 @@ png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
void void PNGAPI
png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted) png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
{ {
png_debug1(1, "in png_permit_empty_plte\n", ""); png_debug1(1, "in png_permit_empty_plte\n", "");
@@ -716,7 +751,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
void void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
chunk_list, int num_chunks) chunk_list, int num_chunks)
{ {
@@ -749,12 +784,14 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
*p=(png_byte)keep; *p=(png_byte)keep;
png_ptr->num_chunk_list=old_num_chunks+num_chunks; png_ptr->num_chunk_list=old_num_chunks+num_chunks;
png_ptr->chunk_list=new_list; png_ptr->chunk_list=new_list;
#ifdef PNG_FREE_ME_SUPPORTED
png_ptr->free_me |= PNG_FREE_LIST; png_ptr->free_me |= PNG_FREE_LIST;
#endif
} }
#endif #endif
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
void void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn) png_user_chunk_ptr read_user_chunk_fn)
{ {
@@ -765,7 +802,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
#endif #endif
#if defined(PNG_INFO_IMAGE_SUPPORTED) #if defined(PNG_INFO_IMAGE_SUPPORTED)
void void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
{ {
png_debug1(1, "in %s storage function\n", "rows"); png_debug1(1, "in %s storage function\n", "rows");
@@ -780,8 +817,7 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
} }
#endif #endif
void PNGAPI
void
png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
{ {
if(png_ptr->zbuf) if(png_ptr->zbuf)

View File

@@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -687,11 +687,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
} }
} }
#if defined(PNG_FIXED_POINT_SUPPORTED)
#if defined(PNG_cHRM_SUPPORTED) #if defined(PNG_cHRM_SUPPORTED)
{ {
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x, png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y; blue_y;
if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, &red_x, if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
&red_y, &green_x, &green_y, &blue_x, &blue_y)) &red_y, &green_x, &green_y, &blue_x, &blue_y))
{ {
@@ -710,6 +710,32 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
} }
} }
#endif #endif
#else /* Use floating point versions */
#if defined(PNG_FLOATING_POINT_SUPPORTED)
#if defined(PNG_cHRM_SUPPORTED)
{
double white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
&red_y, &green_x, &green_y, &blue_x, &blue_y))
{
png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x,
red_y, green_x, green_y, blue_x, blue_y);
}
}
#endif
#if defined(PNG_gAMA_SUPPORTED)
{
double gamma;
if (png_get_gAMA(read_ptr, read_info_ptr, &gamma))
{
png_set_gAMA(write_ptr, write_info_ptr, gamma);
}
}
#endif
#endif /* floating point */
#endif /* fixed point */
#if defined(PNG_iCCP_SUPPORTED) #if defined(PNG_iCCP_SUPPORTED)
{ {
png_charp name; png_charp name;
@@ -1129,6 +1155,8 @@ main(int argc, char *argv[])
fprintf(STDERR," library:%s",png_get_header_version(NULL)); fprintf(STDERR," library:%s",png_get_header_version(NULL));
/* Show the version of libpng used in building the application */ /* Show the version of libpng used in building the application */
fprintf(STDERR," pngtest:%s",PNG_HEADER_VERSION_STRING); fprintf(STDERR," pngtest:%s",PNG_HEADER_VERSION_STRING);
fprintf(STDERR," sizeof(png_struct)=%d, sizeof(png_info)=%d\n",
sizeof(png_struct), sizeof(png_info));
/* Do some consistency checking on the memory allocation settings, I'm /* Do some consistency checking on the memory allocation settings, I'm
not sure this matters, but it is nice to know, the first of these not sure this matters, but it is nice to know, the first of these
@@ -1201,7 +1229,10 @@ main(int argc, char *argv[])
#endif #endif
for (i=2; i<argc; ++i) for (i=2; i<argc; ++i)
{ {
int k, kerror; #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
int k;
#endif
int kerror;
fprintf(STDERR, "Testing %s:",argv[i]); fprintf(STDERR, "Testing %s:",argv[i]);
kerror = test_one_file(argv[i], outname); kerror = test_one_file(argv[i], outname);
if (kerror == 0) if (kerror == 0)
@@ -1271,7 +1302,9 @@ main(int argc, char *argv[])
{ {
if(verbose == 1 || i == 2) if(verbose == 1 || i == 2)
{ {
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
int k; int k;
#endif
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
fprintf(STDERR, "\n PASS (%lu zero samples)\n",zero_samples); fprintf(STDERR, "\n PASS (%lu zero samples)\n",zero_samples);
#else #else
@@ -1345,4 +1378,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_0_6h your_png_h_is_not_version_1_0_6h; typedef version_1_0_7beta11 your_png_h_is_not_version_1_0_7beta11;

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)
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -13,7 +13,7 @@
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* turn on BGR-to-RGB mapping */ /* turn on BGR-to-RGB mapping */
void void PNGAPI
png_set_bgr(png_structp png_ptr) png_set_bgr(png_structp png_ptr)
{ {
png_debug(1, "in png_set_bgr\n"); png_debug(1, "in png_set_bgr\n");
@@ -23,7 +23,7 @@ png_set_bgr(png_structp png_ptr)
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* turn on 16 bit byte swapping */ /* turn on 16 bit byte swapping */
void void PNGAPI
png_set_swap(png_structp png_ptr) png_set_swap(png_structp png_ptr)
{ {
png_debug(1, "in png_set_swap\n"); png_debug(1, "in png_set_swap\n");
@@ -34,7 +34,7 @@ png_set_swap(png_structp png_ptr)
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
/* turn on pixel packing */ /* turn on pixel packing */
void void PNGAPI
png_set_packing(png_structp png_ptr) png_set_packing(png_structp png_ptr)
{ {
png_debug(1, "in png_set_packing\n"); png_debug(1, "in png_set_packing\n");
@@ -48,7 +48,7 @@ png_set_packing(png_structp png_ptr)
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
/* turn on packed pixel swapping */ /* turn on packed pixel swapping */
void void PNGAPI
png_set_packswap(png_structp png_ptr) png_set_packswap(png_structp png_ptr)
{ {
png_debug(1, "in png_set_packswap\n"); png_debug(1, "in png_set_packswap\n");
@@ -58,7 +58,7 @@ png_set_packswap(png_structp png_ptr)
#endif #endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
void void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits) png_set_shift(png_structp png_ptr, png_color_8p true_bits)
{ {
png_debug(1, "in png_set_shift\n"); png_debug(1, "in png_set_shift\n");
@@ -69,7 +69,7 @@ png_set_shift(png_structp png_ptr, png_color_8p true_bits)
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED) defined(PNG_WRITE_INTERLACING_SUPPORTED)
int int PNGAPI
png_set_interlace_handling(png_structp png_ptr) png_set_interlace_handling(png_structp png_ptr)
{ {
png_debug(1, "in png_set_interlace handling\n"); png_debug(1, "in png_set_interlace handling\n");
@@ -89,7 +89,7 @@ png_set_interlace_handling(png_structp png_ptr)
* for 48-bit input data, as well as to avoid problems with some compilers * for 48-bit input data, as well as to avoid problems with some compilers
* that don't like bytes as parameters. * that don't like bytes as parameters.
*/ */
void void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_filler\n"); png_debug(1, "in png_set_filler\n");
@@ -122,7 +122,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
void void PNGAPI
png_set_swap_alpha(png_structp png_ptr) png_set_swap_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_swap_alpha\n"); png_debug(1, "in png_set_swap_alpha\n");
@@ -132,7 +132,7 @@ png_set_swap_alpha(png_structp png_ptr)
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
void void PNGAPI
png_set_invert_alpha(png_structp png_ptr) png_set_invert_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_invert_alpha\n"); png_debug(1, "in png_set_invert_alpha\n");
@@ -141,7 +141,7 @@ png_set_invert_alpha(png_structp png_ptr)
#endif #endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
void void PNGAPI
png_set_invert_mono(png_structp png_ptr) png_set_invert_mono(png_structp png_ptr)
{ {
png_debug(1, "in png_set_invert_mono\n"); png_debug(1, "in png_set_invert_mono\n");
@@ -149,7 +149,7 @@ png_set_invert_mono(png_structp png_ptr)
} }
/* invert monochrome grayscale data */ /* invert monochrome grayscale data */
void void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row) png_do_invert(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_invert\n"); png_debug(1, "in png_do_invert\n");
@@ -174,7 +174,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* swaps byte order on 16 bit depth images */ /* swaps byte order on 16 bit depth images */
void void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row) png_do_swap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_swap\n"); png_debug(1, "in png_do_swap\n");
@@ -305,7 +305,7 @@ static png_byte fourbppswaptable[256] = {
}; };
/* swaps pixel packing order within bytes */ /* swaps pixel packing order within bytes */
void void /* PRIVATE */
png_do_packswap(png_row_infop row_info, png_bytep row) png_do_packswap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_packswap\n"); png_debug(1, "in png_do_packswap\n");
@@ -337,7 +337,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED) defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
/* remove filler or alpha byte(s) */ /* remove filler or alpha byte(s) */
void void /* PRIVATE */
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{ {
png_debug(1, "in png_do_strip_filler\n"); png_debug(1, "in png_do_strip_filler\n");
@@ -495,7 +495,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* swaps red and blue bytes within a pixel */ /* swaps red and blue bytes within a pixel */
void void /* PRIVATE */
png_do_bgr(png_row_infop row_info, png_bytep row) png_do_bgr(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_bgr\n"); png_debug(1, "in png_do_bgr\n");
@@ -571,25 +571,38 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */ #endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
void defined(PNG_LEGACY_SUPPORTED)
void PNGAPI
png_set_user_transform_info(png_structp png_ptr, png_voidp png_set_user_transform_info(png_structp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels) user_transform_ptr, int user_transform_depth, int user_transform_channels)
{ {
png_debug(1, "in png_set_user_transform_info\n"); png_debug(1, "in png_set_user_transform_info\n");
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_ptr = user_transform_ptr;
png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_depth = (png_byte)user_transform_depth;
png_ptr->user_transform_channels = (png_byte)user_transform_channels; png_ptr->user_transform_channels = (png_byte)user_transform_channels;
#else
if(user_transform_ptr || user_transform_depth || user_transform_channels)
png_warning(png_ptr,
"This version of libpng does not support user transform info");
#endif
} }
#endif
/* This function returns a pointer to the user_transform_ptr associated with /* This function returns a pointer to the user_transform_ptr associated with
* the user transform functions. The application should free any memory * the user transform functions. The application should free any memory
* associated with this pointer before png_write_destroy and png_read_destroy * associated with this pointer before png_write_destroy and png_read_destroy
* are called. * are called.
*/ */
png_voidp png_voidp PNGAPI
png_get_user_transform_ptr(png_structp png_ptr) png_get_user_transform_ptr(png_structp png_ptr)
{ {
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
return ((png_voidp)png_ptr->user_transform_ptr); return ((png_voidp)png_ptr->user_transform_ptr);
} #else
if(png_ptr)
return (NULL);
return (NULL);
#endif #endif
}

View File

@@ -2,7 +2,7 @@
* *
* For Intel x86 CPU and Microsoft Visual C++ compiler * For Intel x86 CPU and Microsoft Visual C++ compiler
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, Intel Corporation
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -25,7 +25,7 @@
static int mmx_supported=2; static int mmx_supported=2;
void void /* PRIVATE */
png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info, png_read_filter_row_c(png_structp png_ptr, png_row_infop row_info,
png_bytep row, png_bytep prev_row, int filter); png_bytep row, png_bytep prev_row, int filter);
@@ -98,7 +98,7 @@ NOT_SUPPORTED:
/* Use this routine for x86 platform - uses faster MMX routine if machine /* Use this routine for x86 platform - uses faster MMX routine if machine
supports MMX */ supports MMX */
void void /* PRIVATE */
png_combine_row(png_structp png_ptr, png_bytep row, int mask) png_combine_row(png_structp png_ptr, png_bytep row, int mask)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -970,7 +970,7 @@ end48:
#if defined(PNG_READ_INTERLACING_SUPPORTED) #if defined(PNG_READ_INTERLACING_SUPPORTED)
void void /* PRIVATE */
png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
png_uint_32 transformations) png_uint_32 transformations)
{ {
@@ -1903,7 +1903,7 @@ union uAll {
// Optimized code for PNG Average filter decoder // Optimized code for PNG Average filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row
, png_bytep prev_row) , png_bytep prev_row)
{ {
@@ -2336,7 +2336,7 @@ davgend:
} }
// Optimized code for PNG Paeth filter decoder // Optimized code for PNG Paeth filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row, png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row,
png_bytep prev_row) png_bytep prev_row)
{ {
@@ -3232,7 +3232,7 @@ dpthend:
} }
// Optimized code for PNG Sub filter decoder // Optimized code for PNG Sub filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row) png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row)
{ {
//int test; //int test;
@@ -3536,7 +3536,7 @@ dsubend:
} }
// Optimized code for PNG Up filter decoder // Optimized code for PNG Up filter decoder
void void /* PRIVATE */
png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row,
png_bytep prev_row) png_bytep prev_row)
{ {
@@ -3651,7 +3651,7 @@ dupend:
// Optimized png_read_filter_row routines // Optimized png_read_filter_row routines
void void /* PRIVATE */
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep
row, png_bytep prev_row, int filter) row, png_bytep prev_row, int filter)
{ {

View File

@@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -24,7 +24,7 @@
buffering if you are using unbuffered writes. This should never be asked buffering if you are using unbuffered writes. This should never be asked
to write more than 64K on a 16 bit machine. */ to write more than 64K on a 16 bit machine. */
void void /* PRIVATE */
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
if (png_ptr->write_data_fn != NULL ) if (png_ptr->write_data_fn != NULL )
@@ -39,7 +39,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
write_data function and use it at run time with png_set_write_fn(), rather write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */ than changing the library. */
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
static void static void /* PRIVATE */
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
@@ -59,7 +59,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024 #define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b) #define MIN(a,b) (a <= b ? a : b)
static void static void /* PRIVATE */
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
@@ -106,7 +106,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
to disk). After png_flush is called, there should be no data pending to disk). After png_flush is called, there should be no data pending
writing in any buffers. */ writing in any buffers. */
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #if defined(PNG_WRITE_FLUSH_SUPPORTED)
void void /* PRIVATE */
png_flush(png_structp png_ptr) png_flush(png_structp png_ptr)
{ {
if (png_ptr->output_flush_fn != NULL) if (png_ptr->output_flush_fn != NULL)
@@ -114,7 +114,7 @@ png_flush(png_structp png_ptr)
} }
#if !defined(PNG_NO_STDIO) #if !defined(PNG_NO_STDIO)
static void static void /* PRIVATE */
png_default_flush(png_structp png_ptr) png_default_flush(png_structp png_ptr)
{ {
FILE *io_ptr; FILE *io_ptr;
@@ -147,7 +147,7 @@ png_default_flush(png_structp png_ptr)
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
time, output_flush_fn will be ignored, although it must be time, output_flush_fn will be ignored, although it must be
supplied for compatibility. */ supplied for compatibility. */
void void PNGAPI
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
{ {

View File

@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -21,7 +21,7 @@
* write a plain PNG file. If you have long comments, I suggest writing * write a plain PNG file. If you have long comments, I suggest writing
* them in png_write_end(), and compressing them. * them in png_write_end(), and compressing them.
*/ */
void void PNGAPI
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_write_info_before_PLTE\n"); png_debug(1, "in png_write_info_before_PLTE\n");
@@ -110,7 +110,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
} }
} }
void void PNGAPI
png_write_info(png_structp png_ptr, png_infop info_ptr) png_write_info(png_structp png_ptr, png_infop info_ptr)
{ {
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
@@ -277,7 +277,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
* in png_write_info(), do not write them again here. If you have long * in png_write_info(), do not write them again here. If you have long
* comments, I suggest writing them here, and compressing them. * comments, I suggest writing them here, and compressing them.
*/ */
void void PNGAPI
png_write_end(png_structp png_ptr, png_infop info_ptr) png_write_end(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_write_end\n"); png_debug(1, "in png_write_end\n");
@@ -378,7 +378,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
} }
#if defined(PNG_WRITE_tIME_SUPPORTED) #if defined(PNG_WRITE_tIME_SUPPORTED)
void void PNGAPI
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime) png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
{ {
png_debug(1, "in png_convert_from_struct_tm\n"); png_debug(1, "in png_convert_from_struct_tm\n");
@@ -390,7 +390,7 @@ png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
ptime->second = (png_byte)ttime->tm_sec; ptime->second = (png_byte)ttime->tm_sec;
} }
void void PNGAPI
png_convert_from_time_t(png_timep ptime, time_t ttime) png_convert_from_time_t(png_timep ptime, time_t ttime)
{ {
struct tm *tbuf; struct tm *tbuf;
@@ -402,7 +402,7 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
#endif #endif
/* Initialize png_ptr structure, and allocate any memory needed */ /* Initialize png_ptr structure, and allocate any memory needed */
png_structp png_structp PNGAPI
png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn) png_error_ptr error_fn, png_error_ptr warn_fn)
{ {
@@ -412,7 +412,7 @@ png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
} }
/* Alternate initialize png_ptr structure, and allocate any memory needed */ /* Alternate initialize png_ptr structure, and allocate any memory needed */
png_structp png_structp PNGAPI
png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn) png_malloc_ptr malloc_fn, png_free_ptr free_fn)
@@ -424,6 +424,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
jmp_buf jmpbuf; jmp_buf jmpbuf;
#endif #endif
#endif #endif
int i;
png_debug(1, "in png_create_write_struct\n"); png_debug(1, "in png_create_write_struct\n");
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, if ((png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
@@ -456,16 +457,38 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so i=0;
* we must recompile any applications that use any older library version. do
* For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit.
*/
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(png_libpng_ver[0] == '0' && user_png_ver[2] < '9'))
{ {
png_error(png_ptr, if(user_png_ver[i] != png_libpng_ver[i])
"Incompatible libpng version in application and library"); png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
} while (png_libpng_ver[i++]);
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{
/* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
* we must recompile any applications that use any older library version.
* For versions after libpng 1.0, we will be compatible, so we need
* only check the first digit.
*/
if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
png_error(png_ptr,
"Incompatible libpng version in application and library");
}
/* Libpng 1.0.6 was not binary compatible, due to insertion of the
info_ptr->free_me member. Note to maintainer: this test can be
removed from version 2.0.0 and beyond because the previous test
would have already rejected it. */
if (user_png_ver[4] == '6' && user_png_ver[2] == '0' &&
user_png_ver[0] == '1' && user_png_ver[5] == '\0')
{
png_error(png_ptr,
"Application must be recompiled; version 1.0.6 was incompatible");
}
} }
/* initialize zbuf - compression buffer */ /* initialize zbuf - compression buffer */
@@ -484,14 +507,46 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
} }
/* Initialize png_ptr structure, and allocate any memory needed */ /* Initialize png_ptr structure, and allocate any memory needed */
void #undef png_write_init
void PNGAPI
png_write_init(png_structp png_ptr) png_write_init(png_structp png_ptr)
{
/* We only come here via pre-1.0.7-compiled applications */
png_write_init_2(png_ptr, "1.0.0", 10000, 10000);
}
void PNGAPI
png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_size_t png_struct_size, png_size_t png_info_size)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
jmp_buf tmp_jmp; /* to save current jump buffer */ jmp_buf tmp_jmp; /* to save current jump buffer */
#endif #endif
int i = 0;
do
{
if (user_png_ver[i] != png_libpng_ver[i])
{
#ifdef PNG_LEGACY_SUPPORTED
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
#else
png_ptr->error_fn=(png_error_ptr)NULL;
png_error(png_ptr,
"Application uses deprecated png_write_init() and must be recompiled.");
#endif
}
} while (png_libpng_ver[i++]);
if (sizeof(png_struct) > png_struct_size ||
sizeof(png_info) > png_info_size)
{
png_ptr->error_fn=(png_error_ptr)NULL;
png_error(png_ptr,
"Application and library have different sized structs. Please recompile.");
}
png_debug(1, "in png_write_init_2\n");
png_debug(1, "in png_write_init\n");
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */ /* save jump buffer and error functions */
png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf)); png_memcpy(tmp_jmp, png_ptr->jmpbuf, sizeof (jmp_buf));
@@ -522,7 +577,7 @@ png_write_init(png_structp png_ptr)
* have called png_set_interlace_handling(), you will have to * have called png_set_interlace_handling(), you will have to
* "write" the image seven times. * "write" the image seven times.
*/ */
void void PNGAPI
png_write_rows(png_structp png_ptr, png_bytepp row, png_write_rows(png_structp png_ptr, png_bytepp row,
png_uint_32 num_rows) png_uint_32 num_rows)
{ {
@@ -540,7 +595,7 @@ png_write_rows(png_structp png_ptr, png_bytepp row,
/* Write the image. You only need to call this function once, even /* Write the image. You only need to call this function once, even
* if you are writing an interlaced image. * if you are writing an interlaced image.
*/ */
void void PNGAPI
png_write_image(png_structp png_ptr, png_bytepp image) png_write_image(png_structp png_ptr, png_bytepp image)
{ {
png_uint_32 i; /* row index */ png_uint_32 i; /* row index */
@@ -567,7 +622,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
} }
/* called by user to write a row of image data */ /* called by user to write a row of image data */
void void PNGAPI
png_write_row(png_structp png_ptr, png_bytep row) png_write_row(png_structp png_ptr, png_bytep row)
{ {
png_debug2(1, "in png_write_row (row %ld, pass %d)\n", png_debug2(1, "in png_write_row (row %ld, pass %d)\n",
@@ -718,7 +773,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #if defined(PNG_WRITE_FLUSH_SUPPORTED)
/* Set the automatic flush interval or 0 to turn flushing off */ /* Set the automatic flush interval or 0 to turn flushing off */
void void PNGAPI
png_set_flush(png_structp png_ptr, int nrows) png_set_flush(png_structp png_ptr, int nrows)
{ {
png_debug(1, "in png_set_flush\n"); png_debug(1, "in png_set_flush\n");
@@ -726,7 +781,7 @@ png_set_flush(png_structp png_ptr, int nrows)
} }
/* flush the current output buffers now */ /* flush the current output buffers now */
void void PNGAPI
png_write_flush(png_structp png_ptr) png_write_flush(png_structp png_ptr)
{ {
int wrote_IDAT; int wrote_IDAT;
@@ -779,7 +834,7 @@ png_write_flush(png_structp png_ptr)
#endif /* PNG_WRITE_FLUSH_SUPPORTED */ #endif /* PNG_WRITE_FLUSH_SUPPORTED */
/* free all memory used by the write */ /* free all memory used by the write */
void void PNGAPI
png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{ {
png_structp png_ptr = NULL; png_structp png_ptr = NULL;
@@ -804,11 +859,13 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{ {
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
if (png_ptr->num_chunk_list) if (png_ptr->num_chunk_list)
{ {
png_free(png_ptr, png_ptr->chunk_list); png_free(png_ptr, png_ptr->chunk_list);
png_ptr->num_chunk_list=0; png_ptr->num_chunk_list=0;
} }
#endif
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)info_ptr, free_fn); png_destroy_struct_2((png_voidp)info_ptr, free_fn);
@@ -832,7 +889,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
/* Free any memory used in png_ptr struct (old method) */ /* Free any memory used in png_ptr struct (old method) */
void void PNGAPI
png_write_destroy(png_structp png_ptr) png_write_destroy(png_structp png_ptr)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
@@ -897,7 +954,7 @@ png_write_destroy(png_structp png_ptr)
} }
/* Allow the application to select one or more row filters to use. */ /* Allow the application to select one or more row filters to use. */
void void PNGAPI
png_set_filter(png_structp png_ptr, int method, int filters) png_set_filter(png_structp png_ptr, int method, int filters)
{ {
png_debug(1, "in png_set_filter\n"); png_debug(1, "in png_set_filter\n");
@@ -997,7 +1054,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
* better compression. * better compression.
*/ */
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* GRR 970116 */ #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* GRR 970116 */
void void PNGAPI
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int num_weights, png_doublep filter_weights, int num_weights, png_doublep filter_weights,
png_doublep filter_costs) png_doublep filter_costs)
@@ -1114,7 +1171,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
} }
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
void void PNGAPI
png_set_compression_level(png_structp png_ptr, int level) png_set_compression_level(png_structp png_ptr, int level)
{ {
png_debug(1, "in png_set_compression_level\n"); png_debug(1, "in png_set_compression_level\n");
@@ -1122,7 +1179,7 @@ png_set_compression_level(png_structp png_ptr, int level)
png_ptr->zlib_level = level; png_ptr->zlib_level = level;
} }
void void PNGAPI
png_set_compression_mem_level(png_structp png_ptr, int mem_level) png_set_compression_mem_level(png_structp png_ptr, int mem_level)
{ {
png_debug(1, "in png_set_compression_mem_level\n"); png_debug(1, "in png_set_compression_mem_level\n");
@@ -1130,7 +1187,7 @@ png_set_compression_mem_level(png_structp png_ptr, int mem_level)
png_ptr->zlib_mem_level = mem_level; png_ptr->zlib_mem_level = mem_level;
} }
void void PNGAPI
png_set_compression_strategy(png_structp png_ptr, int strategy) png_set_compression_strategy(png_structp png_ptr, int strategy)
{ {
png_debug(1, "in png_set_compression_strategy\n"); png_debug(1, "in png_set_compression_strategy\n");
@@ -1138,7 +1195,7 @@ png_set_compression_strategy(png_structp png_ptr, int strategy)
png_ptr->zlib_strategy = strategy; png_ptr->zlib_strategy = strategy;
} }
void void PNGAPI
png_set_compression_window_bits(png_structp png_ptr, int window_bits) png_set_compression_window_bits(png_structp png_ptr, int window_bits)
{ {
if (window_bits > 15) if (window_bits > 15)
@@ -1157,7 +1214,7 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
png_ptr->zlib_window_bits = window_bits; png_ptr->zlib_window_bits = window_bits;
} }
void void PNGAPI
png_set_compression_method(png_structp png_ptr, int method) png_set_compression_method(png_structp png_ptr, int method)
{ {
png_debug(1, "in png_set_compression_method\n"); png_debug(1, "in png_set_compression_method\n");
@@ -1167,14 +1224,14 @@ png_set_compression_method(png_structp png_ptr, int method)
png_ptr->zlib_method = method; png_ptr->zlib_method = method;
} }
void void PNGAPI
png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
{ {
png_ptr->write_row_fn = write_row_fn; png_ptr->write_row_fn = write_row_fn;
} }
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
void void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
write_user_transform_fn) write_user_transform_fn)
{ {
@@ -1186,7 +1243,8 @@ png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
#if defined(PNG_INFO_IMAGE_SUPPORTED) #if defined(PNG_INFO_IMAGE_SUPPORTED)
void png_write_png(png_structp png_ptr, png_infop info_ptr, void PNGAPI
png_write_png(png_structp png_ptr, png_infop info_ptr,
int transforms, int transforms,
voidp params) voidp params)
{ {

View File

@@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -14,7 +14,7 @@
/* Transform the data according to the user's wishes. The order of /* Transform the data according to the user's wishes. The order of
* transformations is significant. * transformations is significant.
*/ */
void void /* PRIVATE */
png_do_write_transformations(png_structp png_ptr) png_do_write_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_do_write_transformations\n"); png_debug(1, "in png_do_write_transformations\n");
@@ -82,7 +82,7 @@ png_do_write_transformations(png_structp png_ptr)
* row_info bit depth should be 8 (one pixel per byte). The channels * row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images). * should be 1 (this only happens on grayscale and paletted images).
*/ */
void void /* PRIVATE */
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{ {
png_debug(1, "in png_do_pack\n"); png_debug(1, "in png_do_pack\n");
@@ -208,7 +208,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
* would pass 3 as bit_depth, and this routine would translate the * would pass 3 as bit_depth, and this routine would translate the
* data to 0 to 15. * data to 0 to 15.
*/ */
void void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{ {
png_debug(1, "in png_do_shift\n"); png_debug(1, "in png_do_shift\n");
@@ -332,7 +332,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
#endif #endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
void void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_swap_alpha\n"); png_debug(1, "in png_do_write_swap_alpha\n");
@@ -420,7 +420,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
#endif #endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
void void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_invert_alpha\n"); png_debug(1, "in png_do_write_invert_alpha\n");

View File

@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* libpng 1.0.6h - April 24, 2000 * libpng 1.0.7beta11 - May 6, 2000
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
* Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1996, 1997 Andreas Dilger
@@ -15,7 +15,7 @@
* with unsigned numbers for convenience, although one supported * with unsigned numbers for convenience, although one supported
* ancillary chunk uses signed (two's complement) numbers. * ancillary chunk uses signed (two's complement) numbers.
*/ */
void void /* PRIVATE */
png_save_uint_32(png_bytep buf, png_uint_32 i) png_save_uint_32(png_bytep buf, png_uint_32 i)
{ {
buf[0] = (png_byte)((i >> 24) & 0xff); buf[0] = (png_byte)((i >> 24) & 0xff);
@@ -29,7 +29,7 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
* complement format. If this isn't the case, then this routine needs to * complement format. If this isn't the case, then this routine needs to
* be modified to write data in two's complement format. * be modified to write data in two's complement format.
*/ */
void void /* PRIVATE */
png_save_int_32(png_bytep buf, png_int_32 i) png_save_int_32(png_bytep buf, png_int_32 i)
{ {
buf[0] = (png_byte)((i >> 24) & 0xff); buf[0] = (png_byte)((i >> 24) & 0xff);
@@ -43,7 +43,7 @@ png_save_int_32(png_bytep buf, png_int_32 i)
* The parameter is declared unsigned int, not png_uint_16, * The parameter is declared unsigned int, not png_uint_16,
* just to avoid potential problems on pre-ANSI C compilers. * just to avoid potential problems on pre-ANSI C compilers.
*/ */
void void /* PRIVATE */
png_save_uint_16(png_bytep buf, unsigned int i) png_save_uint_16(png_bytep buf, unsigned int i)
{ {
buf[0] = (png_byte)((i >> 8) & 0xff); buf[0] = (png_byte)((i >> 8) & 0xff);
@@ -59,7 +59,7 @@ png_save_uint_16(png_bytep buf, unsigned int i)
* png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end() * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end()
* functions instead. * functions instead.
*/ */
void void PNGAPI
png_write_chunk(png_structp png_ptr, png_bytep chunk_name, png_write_chunk(png_structp png_ptr, png_bytep chunk_name,
png_bytep data, png_size_t length) png_bytep data, png_size_t length)
{ {
@@ -72,7 +72,7 @@ png_write_chunk(png_structp png_ptr, png_bytep chunk_name,
* The total_length is the sum of the lengths of all the data you will be * The total_length is the sum of the lengths of all the data you will be
* passing in png_write_chunk_data(). * passing in png_write_chunk_data().
*/ */
void void PNGAPI
png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
png_uint_32 length) png_uint_32 length)
{ {
@@ -95,7 +95,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
* sum of the lengths from these calls *must* add up to the total_length * sum of the lengths from these calls *must* add up to the total_length
* given to png_write_chunk_start(). * given to png_write_chunk_start().
*/ */
void void PNGAPI
png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length) png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
/* write the data, and run the CRC over it */ /* write the data, and run the CRC over it */
@@ -107,7 +107,7 @@ png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length)
} }
/* Finish a chunk started with png_write_chunk_start(). */ /* Finish a chunk started with png_write_chunk_start(). */
void void PNGAPI
png_write_chunk_end(png_structp png_ptr) png_write_chunk_end(png_structp png_ptr)
{ {
png_byte buf[4]; png_byte buf[4];
@@ -124,7 +124,7 @@ png_write_chunk_end(png_structp png_ptr)
* we should call png_set_sig_bytes() to tell libpng how many of the * we should call png_set_sig_bytes() to tell libpng how many of the
* bytes have already been written. * bytes have already been written.
*/ */
void void /* PRIVATE */
png_write_sig(png_structp png_ptr) png_write_sig(png_structp png_ptr)
{ {
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@@ -151,7 +151,7 @@ typedef struct
} compression_state; } compression_state;
/* compress given text into storage in the png_ptr structure */ /* compress given text into storage in the png_ptr structure */
static int static int /* PRIVATE */
png_text_compress(png_structp png_ptr, png_text_compress(png_structp png_ptr,
png_charp text, png_size_t text_len, int compression, png_charp text, png_size_t text_len, int compression,
compression_state *comp) compression_state *comp)
@@ -167,7 +167,7 @@ png_text_compress(png_structp png_ptr,
{ {
comp->input = text; comp->input = text;
comp->input_len = text_len; comp->input_len = text_len;
return(text_len); return((int)text_len);
} }
if (compression >= PNG_TEXT_COMPRESSION_LAST) if (compression >= PNG_TEXT_COMPRESSION_LAST)
@@ -314,11 +314,11 @@ png_text_compress(png_structp png_ptr,
if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)
text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out; text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out;
return(text_len); return((int)text_len);
} }
/* ship the compressed text out via chunk writes */ /* ship the compressed text out via chunk writes */
static void static void /* PRIVATE */
png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
{ {
int i; int i;
@@ -354,7 +354,7 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
* information. Note that the rest of this code depends upon this * information. Note that the rest of this code depends upon this
* information being correct. * information being correct.
*/ */
void void /* PRIVATE */
png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
int bit_depth, int color_type, int compression_type, int filter_type, int bit_depth, int color_type, int compression_type, int filter_type,
int interlace_type) int interlace_type)
@@ -497,7 +497,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
* correct order for PNG, so people can redefine it to any convenient * correct order for PNG, so people can redefine it to any convenient
* structure. * structure.
*/ */
void void /* PRIVATE */
png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -541,7 +541,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
} }
/* write an IDAT chunk */ /* write an IDAT chunk */
void void /* PRIVATE */
png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -553,7 +553,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
} }
/* write an IEND chunk */ /* write an IEND chunk */
void void /* PRIVATE */
png_write_IEND(png_structp png_ptr) png_write_IEND(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -567,7 +567,7 @@ png_write_IEND(png_structp png_ptr)
#if defined(PNG_WRITE_gAMA_SUPPORTED) #if defined(PNG_WRITE_gAMA_SUPPORTED)
/* write a gAMA chunk */ /* write a gAMA chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void void /* PRIVATE */
png_write_gAMA(png_structp png_ptr, double file_gamma) png_write_gAMA(png_structp png_ptr, double file_gamma)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -584,7 +584,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma)
} }
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void void /* PRIVATE */
png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -602,7 +602,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
#if defined(PNG_WRITE_sRGB_SUPPORTED) #if defined(PNG_WRITE_sRGB_SUPPORTED)
/* write a sRGB chunk */ /* write a sRGB chunk */
void void /* PRIVATE */
png_write_sRGB(png_structp png_ptr, int srgb_intent) png_write_sRGB(png_structp png_ptr, int srgb_intent)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -621,7 +621,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
#if defined(PNG_WRITE_iCCP_SUPPORTED) #if defined(PNG_WRITE_iCCP_SUPPORTED)
/* write an iCCP chunk */ /* write an iCCP chunk */
void void /* PRIVATE */
png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
png_charp profile, int profile_len) png_charp profile, int profile_len)
{ {
@@ -647,8 +647,8 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
profile_len = 0; profile_len = 0;
if (profile_len) if (profile_len)
profile_len = png_text_compress(png_ptr, profile, profile_len, profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len,
PNG_TEXT_COMPRESSION_zTXt, &comp); PNG_TEXT_COMPRESSION_zTXt, &comp);
/* make sure we include the NULL after the name and the compression type */ /* make sure we include the NULL after the name and the compression type */
png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
@@ -665,7 +665,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
#if defined(PNG_WRITE_sPLT_SUPPORTED) #if defined(PNG_WRITE_sPLT_SUPPORTED)
/* write a sPLT chunk */ /* write a sPLT chunk */
void void /* PRIVATE */
png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -721,7 +721,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
#if defined(PNG_WRITE_sBIT_SUPPORTED) #if defined(PNG_WRITE_sBIT_SUPPORTED)
/* write the sBIT chunk */ /* write the sBIT chunk */
void void /* PRIVATE */
png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -778,7 +778,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
#if defined(PNG_WRITE_cHRM_SUPPORTED) #if defined(PNG_WRITE_cHRM_SUPPORTED)
/* write the cHRM chunk */ /* write the cHRM chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
void void /* PRIVATE */
png_write_cHRM(png_structp png_ptr, double white_x, double white_y, png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y, double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y) double blue_x, double blue_y)
@@ -842,7 +842,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
} }
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void void /* PRIVATE */
png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y, png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y,
png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x,
@@ -897,7 +897,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
#if defined(PNG_WRITE_tRNS_SUPPORTED) #if defined(PNG_WRITE_tRNS_SUPPORTED)
/* write the tRNS chunk */ /* write the tRNS chunk */
void void /* PRIVATE */
png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
int num_trans, int color_type) int num_trans, int color_type)
{ {
@@ -940,7 +940,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
#if defined(PNG_WRITE_bKGD_SUPPORTED) #if defined(PNG_WRITE_bKGD_SUPPORTED)
/* write the background chunk */ /* write the background chunk */
void void /* PRIVATE */
png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -981,7 +981,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
#if defined(PNG_WRITE_hIST_SUPPORTED) #if defined(PNG_WRITE_hIST_SUPPORTED)
/* write the histogram */ /* write the histogram */
void void /* PRIVATE */
png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -1021,7 +1021,7 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
* by the calling routine. This avoids problems with trying to write to * by the calling routine. This avoids problems with trying to write to
* static keywords without having to have duplicate copies of the strings. * static keywords without having to have duplicate copies of the strings.
*/ */
png_size_t png_size_t /* PRIVATE */
png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
{ {
png_size_t key_len; png_size_t key_len;
@@ -1131,7 +1131,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
#if defined(PNG_WRITE_tEXt_SUPPORTED) #if defined(PNG_WRITE_tEXt_SUPPORTED)
/* write a tEXt chunk */ /* write a tEXt chunk */
void void /* PRIVATE */
png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
png_size_t text_len) png_size_t text_len)
{ {
@@ -1172,7 +1172,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
#if defined(PNG_WRITE_zTXt_SUPPORTED) #if defined(PNG_WRITE_zTXt_SUPPORTED)
/* write a compressed text chunk */ /* write a compressed text chunk */
void void /* PRIVATE */
png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
png_size_t text_len, int compression) png_size_t text_len, int compression)
{ {
@@ -1204,7 +1204,8 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
png_free(png_ptr, new_key); png_free(png_ptr, new_key);
/* compute the compressed data; do it now for the length */ /* compute the compressed data; do it now for the length */
text_len = png_text_compress(png_ptr, text, text_len, compression, &comp); text_len = png_text_compress(png_ptr, text, text_len, compression,
&comp);
/* write start of chunk */ /* write start of chunk */
png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32) png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32)
@@ -1224,7 +1225,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
#if defined(PNG_WRITE_iTXt_SUPPORTED) #if defined(PNG_WRITE_iTXt_SUPPORTED)
/* write an iTXt chunk */ /* write an iTXt chunk */
void void /* PRIVATE */
png_write_iTXt(png_structp png_ptr, int compression, png_charp key, png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
png_charp lang, png_charp lang_key, png_charp text) png_charp lang, png_charp lang_key, png_charp text)
{ {
@@ -1256,7 +1257,8 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
text_len = 0; text_len = 0;
/* compute the compressed data; do it now for the length */ /* compute the compressed data; do it now for the length */
text_len = png_text_compress(png_ptr, text, text_len, compression-2, &comp); text_len = png_text_compress(png_ptr, text, text_len, compression-2,
&comp);
/* make sure we include the compression flag, the compression byte, /* make sure we include the compression flag, the compression byte,
* and the NULs after the key, lang, and lang_key parts */ * and the NULs after the key, lang, and lang_key parts */
@@ -1301,7 +1303,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
#if defined(PNG_WRITE_oFFs_SUPPORTED) #if defined(PNG_WRITE_oFFs_SUPPORTED)
/* write the oFFs chunk */ /* write the oFFs chunk */
void void /* PRIVATE */
png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset, png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset,
png_uint_32 y_offset, png_uint_32 y_offset,
int unit_type) int unit_type)
@@ -1325,7 +1327,7 @@ png_write_oFFs(png_structp png_ptr, png_uint_32 x_offset,
#if defined(PNG_WRITE_pCAL_SUPPORTED) #if defined(PNG_WRITE_pCAL_SUPPORTED)
/* write the pCAL chunk (png-scivis-19970203) */ /* write the pCAL chunk (png-scivis-19970203) */
void void /* PRIVATE */
png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_int_32 X1, int type, int nparams, png_charp units, png_charpp params) png_int_32 X1, int type, int nparams, png_charp units, png_charpp params)
{ {
@@ -1386,7 +1388,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
#if defined(PNG_WRITE_sCAL_SUPPORTED) #if defined(PNG_WRITE_sCAL_SUPPORTED)
/* write the sCAL chunk */ /* write the sCAL chunk */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
void void /* PRIVATE */
png_write_sCAL(png_structp png_ptr, int unit, double width,double height) png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -1411,7 +1413,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void void /* PRIVATE */
png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width, png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_charp height) png_charp height)
{ {
@@ -1441,7 +1443,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
#if defined(PNG_WRITE_pHYs_SUPPORTED) #if defined(PNG_WRITE_pHYs_SUPPORTED)
/* write the pHYs chunk */ /* write the pHYs chunk */
void void /* PRIVATE */
png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
png_uint_32 y_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type) int unit_type)
@@ -1467,7 +1469,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
/* Write the tIME chunk. Use either png_convert_from_struct_tm() /* Write the tIME chunk. Use either png_convert_from_struct_tm()
* or png_convert_from_time_t(), or fill in the structure yourself. * or png_convert_from_time_t(), or fill in the structure yourself.
*/ */
void void /* PRIVATE */
png_write_tIME(png_structp png_ptr, png_timep mod_time) png_write_tIME(png_structp png_ptr, png_timep mod_time)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -1496,7 +1498,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
#endif #endif
/* initializes the row writing capability of libpng */ /* initializes the row writing capability of libpng */
void void /* PRIVATE */
png_write_start_row(png_structp png_ptr) png_write_start_row(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -1590,7 +1592,7 @@ png_write_start_row(png_structp png_ptr)
} }
/* Internal use only. Called when finished processing a row of data. */ /* Internal use only. Called when finished processing a row of data. */
void void /* PRIVATE */
png_write_finish_row(png_structp png_ptr) png_write_finish_row(png_structp png_ptr)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -1704,7 +1706,7 @@ png_write_finish_row(png_structp png_ptr)
* sp will always be >= dp, so we should never overwrite anything. * sp will always be >= dp, so we should never overwrite anything.
* See the default: case for the easiest code to understand. * See the default: case for the easiest code to understand.
*/ */
void void /* PRIVATE */
png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -1875,7 +1877,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
#define PNG_HISHIFT 10 #define PNG_HISHIFT 10
#define PNG_LOMASK ((png_uint_32)0xffffL) #define PNG_LOMASK ((png_uint_32)0xffffL)
#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT)) #define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT))
void void /* PRIVATE */
png_write_find_filter(png_structp png_ptr, png_row_infop row_info) png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{ {
png_bytep prev_row, best_row, row_buf; png_bytep prev_row, best_row, row_buf;
@@ -2487,7 +2489,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
/* Do the actual writing of a previously filtered row. */ /* Do the actual writing of a previously filtered row. */
void void /* PRIVATE */
png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
{ {
png_debug(1, "in png_write_filtered_row\n"); png_debug(1, "in png_write_filtered_row\n");

View File

@@ -1,14 +1,9 @@
# makefile for libpng on BeOS x86 ELF with gcc # makefile for libpng on BeOS x86 ELF with gcc
# modified from makefile.linux by Sander Stoks # modified from makefile.linux by Sander Stoks
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1999, 2000 Greg Roelofs # Copyright (C) 1999 Greg Roelofs
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not
# have to change it.
PNGMAJ = 10
PNGMIN = 6h
PNGVER = $(PNGMAJ).$(PNGMIN)
CC=gcc CC=gcc
# Where the zlib library and include files are located # Where the zlib library and include files are located
@@ -33,6 +28,11 @@ LDFLAGS=-L. -Wl,-soname=libpng.so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm
RANLIB=ranlib RANLIB=ranlib
#RANLIB=echo #RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it.
PNGMAJ = 2
PNGMIN = 1.0.7beta11
PNGVER = $(PNGMAJ).$(PNGMIN)
# where make install puts libpng.a, libpng.so*, and png.h # where make install puts libpng.a, libpng.so*, and png.h
prefix=/usr/local prefix=/usr/local

View File

@@ -11,10 +11,10 @@ prefix=/usr/local
ZLIBLIB=../zlib ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 10 PNGMAJ = 2
PNGMIN = 6h PNGMIN = 1.0.7beta11
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
CC=cc CC=cc

View File

@@ -31,10 +31,10 @@ LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
RANLIB=ranlib RANLIB=ranlib
#RANLIB=echo #RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 10 PNGMAJ = 2
PNGMIN = 6h PNGMIN = 1.0.7beta11
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

114
scripts/makefile.intel Normal file
View File

@@ -0,0 +1,114 @@
# Makefile for libpng
# Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h
# To use, do "nmake /f scripts\makefile.intel"
# ------------------- Intel C/C++ Compiler 4.0 and later -------------------
# Caution: the assembler code was introduced at libpng version 1.0.4 and has
# not yet been thoroughly tested.
# Use assembler code
ASMCODE=-DPNG_USE_PNGVCRD
# Where the zlib library and include files are located
ZLIBLIB=..\zlib
ZLIBINC=..\zlib
# Target CPU
CPU=6 # Pentium II
#CPU=5 # Pentium
# Calling convention
CALLING=r # __fastcall
#CALLING=z # __stdcall
#CALLING=d # __cdecl
# Uncomment next to put error messages in a file
#ERRFILE=>>pngerrs
# --------------------------------------------------------------------------
CC=icl -c
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) $(ASMCODE) -nologo
LD=link
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
O=.obj
OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)\
pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)\
pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O)
all: test
png$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngset$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngget$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngread$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngpread$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngrtran$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngrutil$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngvcrd$(O): png.h pngconf.h pngasmrd.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngerror$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngmem$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngrio$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwio$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngtest$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngtrans$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwrite$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwtran$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwutil$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
libpng.lib: $(OBJS)
if exist libpng.lib del libpng.lib
lib /NOLOGO /OUT:libpng.lib $(OBJS)
pngtest.exe: pngtest.obj libpng.lib
$(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
test: pngtest.exe
pngtest.exe
# End of makefile for libpng

View File

@@ -1,6 +1,6 @@
# makefile for libpng on Linux ELF with gcc # makefile for libpng on Linux ELF with gcc
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1998-2000, Greg Roelofs # Copyright (C) 1998, 1999 Greg Roelofs
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
CC=gcc CC=gcc
@@ -31,10 +31,10 @@ LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
RANLIB=ranlib RANLIB=ranlib
#RANLIB=echo #RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 10 PNGMAJ = 2
PNGMIN = 6h PNGMIN = 1.0.7beta11
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@@ -2,7 +2,7 @@
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
# force ELF build dynamic linking, SONAME setting in lib and RPATH in app # force ELF build dynamic linking, SONAME setting in lib and RPATH in app
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1998, 2000 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
CC=cc CC=cc
@@ -22,10 +22,10 @@ LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
#RANLIB=ranlib #RANLIB=ranlib
RANLIB=echo RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 10 PNGMAJ = 2
PNGMIN = 6h PNGMIN = 1.0.7beta11
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=gcc -shared LDSHARED=gcc -shared
VER=1.0.6h VER=1.0.7beta11
LIBS=libpng.so.1.0.6h LIBS=libpng.so.1.0.7beta11
SHAREDLIB=libpng.so SHAREDLIB=libpng.so
libdir=$(prefix)/lib32 libdir=$(prefix)/lib32

View File

@@ -1,7 +1,7 @@
# makefile for libpng on Solaris 2.x with gcc # makefile for libpng on Solaris 2.x with gcc
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1998, 2000 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
CC=gcc CC=gcc
@@ -28,10 +28,10 @@ LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
#RANLIB=ranlib #RANLIB=ranlib
RANLIB=echo RANLIB=echo
# read libpng.txt or png.h to see why PNGMAJ is 10. You should not # read libpng.txt or png.h to see why PNGMAJ is 2. You should not
# have to change it. # have to change it.
PNGMAJ = 10 PNGMAJ = 2
PNGMIN = 6h PNGMIN = 1.0.7beta11
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include

View File

@@ -1,28 +1,48 @@
# Makefile for libpng # Makefile for libpng
# Watcom 10.0 and later 32-bit protected mode flat memory model # Watcom C/C++ 10.0 and later, 32-bit protected mode, flat memory model
# Adapted by Pawel Mrochen, based on makefile.msc # Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
# To use, do "wmake /f scripts\makefile.watcom" # To use, do "wmake /f scripts\makefile.watcom"
# ------------- Watcom 10.0 and later -------------
MODEL=-mf # ---------------------- Watcom C/C++ 10.0 and later -----------------------
CFLAGS= $(MODEL) -5r -fp5 -fpi87 -oneatx -i=..\zlib
# Where the zlib library and include files are located
ZLIBLIB=..\zlib
ZLIBINC=..\zlib
# Target OS
OS=DOS
#OS=NT
# Target CPU
CPU=6 # Pentium Pro
#CPU=5 # Pentium
# Calling convention
CALLING=r # registers
#CALLING=s # stack
# Uncomment next to put error messages in a file
#ERRFILE=>>pngerrs
# --------------------------------------------------------------------------
CC=wcc386 CC=wcc386
CFLAGS=-$(CPU)$(CALLING) -fp$(CPU) -fpi87 -oneatx -mf -bt=$(OS) -i=$(ZLIBINC) -zq
LD=wcl386 LD=wcl386
LIB=wlib -b -c LDFLAGS=-zq
LDFLAGS=
O=.obj O=.obj
#uncomment next to put error messages in a file OBJS1=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
#ERRFILE= >> pngerrs OBJS2=pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)
OBJS3=pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
# variables
OBJS1 = png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O)
OBJS2 = pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O)
OBJS3 = pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
all: test all: test
@@ -75,14 +95,15 @@ pngwutil$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3) libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
$(LIB) -n libpng.lib $(OBJS1) wlib -b -c -n -q libpng.lib $(OBJS1)
$(LIB) libpng.lib $(OBJS2) wlib -b -c -q libpng.lib $(OBJS2)
$(LIB) libpng.lib $(OBJS3) wlib -b -c -q libpng.lib $(OBJS3)
pngtest.exe: pngtest.obj libpng.lib pngtest.exe: pngtest.obj libpng.lib
$(LD) $(LDFLAGS) pngtest.obj libpng.lib ..\zlib\zlib.lib $(LD) $(LDFLAGS) pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
test: pngtest.exe .symbolic test: pngtest.exe .symbolic
pngtest pngtest.exe
# End of makefile for libpng # End of makefile for libpng

View File

@@ -3,7 +3,7 @@ unit pngdef;
interface interface
const const
PNG_LIBPNG_VER_STRING = '1.0.6h'; PNG_LIBPNG_VER_STRING = '1.0.7beta11';
PNG_LIBPNG_VER = 10007; PNG_LIBPNG_VER = 10007;
type type