From 1ef65b674253a5a2ac4b171872eb041a3fb5476e Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 12 May 2000 06:19:53 -0500 Subject: [PATCH] Imported from libpng-1.0.7beta12.tar --- ANNOUNCE | 11 +++- CHANGES | 14 ++++- INSTALL | 12 ++-- LICENSE | 4 +- README | 10 ++-- Y2KINFO | 4 +- configure | 2 +- libpng.3 | 124 ++++++++++++++++++++++++++------------- libpng.txt | 112 +++++++++++++++++++++++------------ libpngpf.3 | 4 +- png.5 | 2 +- png.c | 103 ++++++++++++++++++++------------ png.h | 93 ++++++++++++++++++----------- pngasmrd.h | 2 +- pngconf.h | 37 ++++-------- pngerror.c | 2 +- pnggccrd.c | 6 +- pngget.c | 2 +- pngmem.c | 2 +- pngpread.c | 2 +- pngread.c | 17 ++---- pngrio.c | 2 +- pngrtran.c | 2 +- pngrutil.c | 6 +- pngset.c | 40 ++++++------- pngtest.c | 10 ++-- pngtrans.c | 2 +- pngvcrd.c | 2 +- pngwio.c | 2 +- pngwrite.c | 5 +- pngwtran.c | 2 +- pngwutil.c | 2 +- scripts/makefile.beos | 2 +- scripts/makefile.dec | 2 +- scripts/makefile.gcmmx | 2 +- scripts/makefile.linux | 2 +- scripts/makefile.sco | 2 +- scripts/makefile.sggcc | 4 +- scripts/makefile.solaris | 2 +- scripts/pngdef.pas | 4 +- scripts/pngos2.def | 2 + 41 files changed, 390 insertions(+), 272 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 59d51214..a0d0e095 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.0.7beta11 - May 6, 2000 +Libpng 1.0.7beta12 - May 12, 2000 This is a public release of libpng, intended for use in production codes. @@ -57,9 +57,14 @@ Changes since the last public release (1.0.6): 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. + Made PNG_NO_ITXT_SUPPORTED the default setting, to avoid memory overrun + when old applications fill the info_ptr->text structure directly. Added PNGAPI macro, and added it to the definitions of all exported functions. + Made PNG_NO_CONSOLE_IO the default condition when PNG_BUILD_DLL is defined. + Use MSC _RPTn debugging instead of fprintf if _MSC_VER is defined. + Added png_access_version_number() function. + Check for mask&PNG_FREE_CHNK (for TEXT, SCAL, PCAL) in png_free_data(). + Expanded libpng.3/libpng.txt information about png_data_freer(). Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/CHANGES b/CHANGES index 297d6bf3..488b5efd 100644 --- a/CHANGES +++ b/CHANGES @@ -729,14 +729,22 @@ 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] +version 1.0.7beta11 [May 7, 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. + Made PNG_NO_ITXT_SUPPORTED the default setting, to avoid memory overrun + when old applications fill the info_ptr->text structure directly. Added PNGAPI macro, and added it to the definitions of all exported functions. +version 1.0.7beta12 [May 12, 2000] + Revised pngset.c to avoid a problem with expanding the png_debug macro. + Deleted some extraneous defines from pngconf.h + Made PNG_NO_CONSOLE_IO the default condition when PNG_BUILD_DLL is defined. + Use MSC _RPTn debugging instead of fprintf if _MSC_VER is defined. + Added png_access_version_number() function. + Check for mask&PNG_FREE_CHNK (for TEXT, SCAL, PCAL) in png_free_data(). + Expanded libpng.3/libpng.txt information about png_data_freer(). Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/INSTALL b/INSTALL index 31bf2675..3405b876 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.0.7beta11 - May 6, 2000 +Installing libpng version 1.0.7beta12 - May 12, 2000 Before installing libpng, you must first install zlib. zlib 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. You can rename the directories that you downloaded (they -might be called "libpng-1.0.7beta11" or "lpng106" and "zlib-1.1.3" +might be called "libpng-1.0.7beta12" or "lpng106" and "zlib-1.1.3" or "zlib113") so that you have directories called "zlib" and "libpng". Your directory structure should look like this: @@ -47,8 +47,8 @@ The files that are presently available in the scripts directory include makefile.std => Generic UNIX makefile (cc, creates static libpng.a) - 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.7beta11, + makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta12) + makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.7beta12, uses assembler code tuned for Intel MMX platform) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with @@ -59,9 +59,9 @@ include 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 makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) - makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta11) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta12) makefile.sunos => Sun makefile - makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.7beta11) + makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.7beta12) makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.mips => MIPS makefile makefile.acorn => Acorn makefile diff --git a/LICENSE b/LICENSE index 6306d87d..f71528ae 100644 --- a/LICENSE +++ b/LICENSE @@ -5,7 +5,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1996, 1997 Andreas Dilger (libpng versions 0.90, December 1996, through 0.96, May 1997) Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson -(libpng versions 0.97, January 1998, through 1.0.7beta11, May 6, 2000) +(libpng versions 0.97, January 1998, through 1.0.7beta12, May 12, 2000) For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: @@ -68,4 +68,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson randeg@alum.rpi.edu -May 6, 2000 +May 12, 2000 diff --git a/README b/README index 4cd5a121..85caa8ce 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng 1.0.7beta11 - May 6, 2000 (shared library 2.1) +README for libpng 1.0.7beta12 - May 12, 2000 (shared library 2.1) See the note about version numbers near the top of png.h 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 makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.linux => Linux/ELF makefile - (gcc, creates libpng.so.2.1.0.7beta11) + (gcc, creates libpng.so.2.1.0.7beta12) makefile.gcmmx => Linux/ELF makefile (gcc, creates - libpng.so.2.1.0.7beta11, uses assembler code + libpng.so.2.1.0.7beta12, uses assembler code tuned for Intel MMX platform) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with @@ -185,10 +185,10 @@ Files in this distribution: 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 makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) - makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta11) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.7beta12) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng.so.2.1.0.7beta11) + (gcc, creates libpng.so.2.1.0.7beta12) makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.mips => MIPS makefile makefile.acorn => Acorn makefile diff --git a/Y2KINFO b/Y2KINFO index ffa82c18..e5f54dbf 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - May 6, 2000 + May 12, 2000 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and - upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier + upward through 1.0.7beta12 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer diff --git a/configure b/configure index c7d20025..ee188768 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ echo " - There is no \"configure\" script for Libpng-1.0.7beta11. Instead, please + There is no \"configure\" script for Libpng-1.0.7beta12. Instead, please copy the appropriate makefile for your system from the \"scripts\" directory. Read the INSTALL file for more details. " diff --git a/libpng.3 b/libpng.3 index 29068757..75e7ae2b 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "May 6, 2000" +.TH LIBPNG 3 "May 12, 2000" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta11 +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta12 .SH SYNOPSIS \fI\fB @@ -8,6 +8,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta11 \fI\fB +\fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP + +\fI\fB + \fBint png_check_sig (png_bytep \fP\fIsig\fP\fB, int \fInum\fP\fB);\fP \fI\fB @@ -739,7 +743,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.0.7beta11 - May 6, 2000 + libpng version 1.0.7beta12 - May 12, 2000 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -1291,7 +1295,7 @@ into the info_ptr is returned for any complex types. text_ptr[i].key - keyword for comment. Must contain 1-79 characters. text_ptr[i].text - text comments for current - keyword. Can empty. + keyword. Can be empty. text_ptr[i].text_length - length of text string, after decompression, 0 for iTXt text_ptr[i].itxt_length - length of itxt string, @@ -1921,15 +1925,17 @@ It is also possible to individually free the info_ptr members that point to libpng-allocated storage with the following functions: png_free_data(png_ptr, info_ptr, mask, n) - mask - identifies data to be freed, a mask - containing the logical OR of one or more of - PNG_FREE_PLTE, PNG_FREE_TRNS, - PNG_FREE_HIST, PNG_FREE_ICCP, - PNG_FREE_SPLT, PNG_FREE_ROWS, - PNG_FREE_TEXT, PNG_FREE_UNKN, - or simply PNG_FREE_ALL - n - sequence number of item to be freed - (-1 for all items) + mask - identifies data to be freed, a mask + containing the logical OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + n - sequence number of item to be freed + (-1 for all items) These functions may be safely called when the relevant storage has already been freed, or has not yet been allocated, or was allocated @@ -1945,12 +1951,12 @@ or so that it will free data that was allocated by the user with png_malloc() or png_zalloc() and passed in via a png_set_*() function, with png_data_freer(png_ptr, info_ptr, freer, mask) - mask - which data elements are affected - same choices as in png_free_data() - freer - one of - PNG_DESTROY_WILL_FREE_DATA - PNG_SET_WILL_FREE_DATA - PNG_USER_WILL_FREE_DATA + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA This function only affects data that has already been allocated. You can call this function after reading the PNG data but before calling @@ -1959,13 +1965,23 @@ function is responsible for freeing any existing data that might be present, and again 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. +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it (the png_zalloc() function is the same +as png_malloc() except that it also zeroes the newly-allocated memory). 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]. +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. + For a more compact example of reading a PNG image, see the file example.c. .SS Reading PNG files progressively @@ -2606,7 +2622,8 @@ transformations are permitted, enabled by the following masks. PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes. -If you have valid image data in the info structure, simply do this: +If you have valid image data in the info structure (you can use +png_set_rows() to put image data in the info structure), simply do this: png_write_png(png_ptr, info_ptr, png_transforms, NULL) @@ -2866,15 +2883,17 @@ It is also possible to individually free the info_ptr members that point to libpng-allocated storage with the following functions: png_free_data(png_ptr, info_ptr, mask, n) - mask - identifies data to be freed, a mask - containing the logical OR of one or more of - PNG_FREE_PLTE, PNG_FREE_TRNS, - PNG_FREE_HIST, PNG_FREE_ICCP, - PNG_FREE_SPLT, PNG_FREE_ROWS, - PNG_FREE_TEXT, PNG_FREE_UNKN, - or simply PNG_FREE_ALL - n - sequence number of item to be freed - (-1 for all items) + mask - identifies data to be freed, a mask + containing the logical OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + n - sequence number of item to be freed + (-1 for all items) These functions may be safely called when the relevant storage has already been freed, or has not yet been allocated, or was allocated @@ -2894,12 +2913,12 @@ or so that it will free data that was allocated by the user with png_malloc() or png_zalloc() and passed in via a png_set_*() function, with png_data_freer(png_ptr, info_ptr, freer, mask) - mask - which data elements are affected - same choices as in png_free_data() - freer - one of - PNG_DESTROY_WILL_FREE_DATA - PNG_SET_WILL_FREE_DATA - PNG_USER_WILL_FREE_DATA + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA For example, to transfer responsibility for some data from a read structure to a write structure, you could use @@ -2921,8 +2940,17 @@ 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. +application must use +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it. +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. For a more compact example of writing a PNG image, see the file example.c. .SH V. Modifying/Customizing libpng: @@ -3312,15 +3340,29 @@ png_set_error_fn(), which is essentially the same function, but with a new name to force compilation errors with applications that try to use the old method. +Starting with version 1.0.7, you can find out which version of the library +you are using at run-time: + + png_uint_32 libpng_vn = png_access_version_number(); + +The number libpng_vn is constructed from the major version, minor +version with leading zero, and release number with leading zero, +(e.g., libpng_vn for version 1.0.7 is 10007). + +You can also check which version of png.h you used when compiling your +application: + + png_uint_32 application_vn = PNG_LIBPNG_VER; + .SH VII. Y2K Compliance in libpng -May 6, 2000 +May 12, 2000 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier +upward through 1.0.7beta12 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that @@ -3461,7 +3503,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.0.7beta11 - May 6, 2000: +Libpng version 1.0.7beta12 - May 12, 2000: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu). @@ -3476,7 +3518,7 @@ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1996, 1997 Andreas Dilger (libpng versions 0.89c, May 1996, through 0.96, May 1997) Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson -(libpng versions 0.97, January 1998, through 1.0.7beta11, May 6, 2000) +(libpng versions 0.97, January 1998, through 1.0.7beta12, May 12, 2000) For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: diff --git a/libpng.txt b/libpng.txt index c223561e..90c2de75 100644 --- a/libpng.txt +++ b/libpng.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.0.7beta11 - May 6, 2000 + libpng version 1.0.7beta12 - May 12, 2000 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -552,7 +552,7 @@ into the info_ptr is returned for any complex types. text_ptr[i].key - keyword for comment. Must contain 1-79 characters. text_ptr[i].text - text comments for current - keyword. Can empty. + keyword. Can be empty. text_ptr[i].text_length - length of text string, after decompression, 0 for iTXt text_ptr[i].itxt_length - length of itxt string, @@ -1182,15 +1182,17 @@ It is also possible to individually free the info_ptr members that point to libpng-allocated storage with the following functions: png_free_data(png_ptr, info_ptr, mask, n) - mask - identifies data to be freed, a mask - containing the logical OR of one or more of - PNG_FREE_PLTE, PNG_FREE_TRNS, - PNG_FREE_HIST, PNG_FREE_ICCP, - PNG_FREE_SPLT, PNG_FREE_ROWS, - PNG_FREE_TEXT, PNG_FREE_UNKN, - or simply PNG_FREE_ALL - n - sequence number of item to be freed - (-1 for all items) + mask - identifies data to be freed, a mask + containing the logical OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + n - sequence number of item to be freed + (-1 for all items) These functions may be safely called when the relevant storage has already been freed, or has not yet been allocated, or was allocated @@ -1206,12 +1208,12 @@ or so that it will free data that was allocated by the user with png_malloc() or png_zalloc() and passed in via a png_set_*() function, with png_data_freer(png_ptr, info_ptr, freer, mask) - mask - which data elements are affected - same choices as in png_free_data() - freer - one of - PNG_DESTROY_WILL_FREE_DATA - PNG_SET_WILL_FREE_DATA - PNG_USER_WILL_FREE_DATA + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA This function only affects data that has already been allocated. You can call this function after reading the PNG data but before calling @@ -1220,13 +1222,23 @@ function is responsible for freeing any existing data that might be present, and again 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. +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it (the png_zalloc() function is the same +as png_malloc() except that it also zeroes the newly-allocated memory). 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]. +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. + For a more compact example of reading a PNG image, see the file example.c. Reading PNG files progressively @@ -1867,7 +1879,8 @@ transformations are permitted, enabled by the following masks. PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes. -If you have valid image data in the info structure, simply do this: +If you have valid image data in the info structure (you can use +png_set_rows() to put image data in the info structure), simply do this: png_write_png(png_ptr, info_ptr, png_transforms, NULL) @@ -2127,15 +2140,17 @@ It is also possible to individually free the info_ptr members that point to libpng-allocated storage with the following functions: png_free_data(png_ptr, info_ptr, mask, n) - mask - identifies data to be freed, a mask - containing the logical OR of one or more of - PNG_FREE_PLTE, PNG_FREE_TRNS, - PNG_FREE_HIST, PNG_FREE_ICCP, - PNG_FREE_SPLT, PNG_FREE_ROWS, - PNG_FREE_TEXT, PNG_FREE_UNKN, - or simply PNG_FREE_ALL - n - sequence number of item to be freed - (-1 for all items) + mask - identifies data to be freed, a mask + containing the logical OR of one or + more of + PNG_FREE_PLTE, PNG_FREE_TRNS, + PNG_FREE_HIST, PNG_FREE_ICCP, + PNG_FREE_PCAL, PNG_FREE_ROWS, + PNG_FREE_SCAL, PNG_FREE_SPLT, + PNG_FREE_TEXT, PNG_FREE_UNKN, + or simply PNG_FREE_ALL + n - sequence number of item to be freed + (-1 for all items) These functions may be safely called when the relevant storage has already been freed, or has not yet been allocated, or was allocated @@ -2155,12 +2170,12 @@ or so that it will free data that was allocated by the user with png_malloc() or png_zalloc() and passed in via a png_set_*() function, with png_data_freer(png_ptr, info_ptr, freer, mask) - mask - which data elements are affected - same choices as in png_free_data() - freer - one of - PNG_DESTROY_WILL_FREE_DATA - PNG_SET_WILL_FREE_DATA - PNG_USER_WILL_FREE_DATA + mask - which data elements are affected + same choices as in png_free_data() + freer - one of + PNG_DESTROY_WILL_FREE_DATA + PNG_SET_WILL_FREE_DATA + PNG_USER_WILL_FREE_DATA For example, to transfer responsibility for some data from a read structure to a write structure, you could use @@ -2182,8 +2197,17 @@ 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. +application must use +png_free() to free it, and when the user transfers responsibility to libpng +for data that the user has allocated, the user must have used png_malloc() +or png_zalloc() to allocate it. +If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword +separately, do not transfer responsibility for freeing text_ptr to libpng, +because when libpng fills a png_text structure it combines these members with +the key member, and png_free_data() will free only text_ptr.key. Similarly, +if you transfer responsibility for free'ing text_ptr from libpng to your +application, your application must not separately free those members. For a more compact example of writing a PNG image, see the file example.c. V. Modifying/Customizing libpng: @@ -2573,15 +2597,29 @@ png_set_error_fn(), which is essentially the same function, but with a new name to force compilation errors with applications that try to use the old method. +Starting with version 1.0.7, you can find out which version of the library +you are using at run-time: + + png_uint_32 libpng_vn = png_access_version_number(); + +The number libpng_vn is constructed from the major version, minor +version with leading zero, and release number with leading zero, +(e.g., libpng_vn for version 1.0.7 is 10007). + +You can also check which version of png.h you used when compiling your +application: + + png_uint_32 application_vn = PNG_LIBPNG_VER; + VII. Y2K Compliance in libpng -May 6, 2000 +May 12, 2000 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier +upward through 1.0.7beta12 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that diff --git a/libpngpf.3 b/libpngpf.3 index 79c54aa6..d778d5f5 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "May 6, 2000" +.TH LIBPNGPF 3 "May 12, 2000" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta11 +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.7beta12 (private functions) .SH SYNOPSIS \fB#include \fP diff --git a/png.5 b/png.5 index 479cf000..d5462ae7 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "May 6, 2000" +.TH PNG 5 "May 12, 2000" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index 0b4cc05a..26db4f24 100644 --- a/png.c +++ b/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * libpng version 1.0.7beta11 - May 6, 2000 + * libpng version 1.0.7beta12 - May 12, 2000 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -14,14 +14,14 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_0_7beta11 Your_png_h_is_not_version_1_0_7beta11; +typedef version_1_0_7beta12 Your_png_h_is_not_version_1_0_7beta12; /* Version information for C files. This had better match the version * string defined in png.h. */ #ifdef PNG_USE_GLOBAL_ARRAYS /* png_libpng_ver was changed to a function in version 1.0.5c */ -char png_libpng_ver[12] = "1.0.7beta11"; +char png_libpng_ver[12] = "1.0.7beta12"; /* png_sig was changed to a function in version 1.0.5c */ /* Place to hold the signature string for a PNG file. */ @@ -290,6 +290,8 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num /* 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) +#else +if (mask & PNG_FREE_TEXT) #endif { if (num != -1) @@ -314,15 +316,14 @@ if (mask & info_ptr->free_me & PNG_FREE_TEXT) #if defined(PNG_tRNS_SUPPORTED) /* free any tRNS entry */ -if (mask & PNG_FREE_TRNS) +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_TRNS & info_ptr->free_me) +#else +if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS)) +#endif { if (info_ptr->valid & PNG_INFO_tRNS) { -#ifdef PNG_FREE_ME_SUPPORTED - 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); info_ptr->valid &= ~PNG_INFO_tRNS; } @@ -331,6 +332,11 @@ if (mask & PNG_FREE_TRNS) #if defined(PNG_sCAL_SUPPORTED) /* free any sCAL entry */ +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_SCAL & info_ptr->free_me) +#else +if (mask & PNG_FREE_SCAL) +#endif { if (info_ptr->valid & PNG_INFO_sCAL) { @@ -345,6 +351,11 @@ if (mask & PNG_FREE_TRNS) #if defined(PNG_pCAL_SUPPORTED) /* free any pCAL entry */ +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_PCAL & info_ptr->free_me) +#else +if (mask & PNG_FREE_PCAL) +#endif { if (info_ptr->valid & PNG_INFO_pCAL) { @@ -366,17 +377,16 @@ if (mask & PNG_FREE_TRNS) #if defined(PNG_iCCP_SUPPORTED) /* free any iCCP entry */ +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_ICCP & info_ptr->free_me) +#else if (mask & PNG_FREE_ICCP) +#endif { if (info_ptr->valid & PNG_INFO_iCCP) { -#ifdef PNG_FREE_ME_SUPPORTED - if (info_ptr->free_me & PNG_FREE_ICCP) -#endif - { - png_free(png_ptr, info_ptr->iccp_name); - png_free(png_ptr, info_ptr->iccp_profile); - } + png_free(png_ptr, info_ptr->iccp_name); + png_free(png_ptr, info_ptr->iccp_profile); info_ptr->valid &= ~PNG_INFO_iCCP; } } @@ -384,7 +394,11 @@ if (mask & PNG_FREE_ICCP) #if defined(PNG_sPLT_SUPPORTED) /* free a given sPLT entry, or (if num == -1) all sPLT entries */ +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_SPLT & info_ptr->free_me) +#else if (mask & PNG_FREE_SPLT) +#endif { if (num != -1) { @@ -408,7 +422,11 @@ if (mask & PNG_FREE_SPLT) #endif #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & info_ptr->free_me & PNG_FREE_UNKN) +#else if (mask & PNG_FREE_UNKN) +#endif { if (num != -1) { @@ -433,32 +451,30 @@ if (mask & PNG_FREE_UNKN) #if defined(PNG_hIST_SUPPORTED) /* free any hIST entry */ -if (mask & PNG_FREE_HIST) +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_HIST & info_ptr->free_me) +#else +if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST)) +#endif { if (info_ptr->valid & PNG_INFO_hIST) { -#ifdef PNG_FREE_ME_SUPPORTED - 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; } } #endif /* free any PLTE entry that was internally allocated */ -if (mask & PNG_FREE_PLTE) +#ifdef PNG_FREE_ME_SUPPORTED +if (mask & PNG_FREE_PLTE & info_ptr->free_me) +#else +if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE)) +#endif { if (info_ptr->valid & PNG_INFO_PLTE) { -#ifdef PNG_FREE_ME_SUPPORTED - 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->num_palette = 0; } @@ -466,18 +482,20 @@ if (mask & PNG_FREE_PLTE) #if defined(PNG_INFO_IMAGE_SUPPORTED) /* free any image bits attached to the info structure */ -if (mask & PNG_FREE_ROWS) -{ #ifdef PNG_FREE_ME_SUPPORTED - if (info_ptr->free_me & PNG_FREE_ROWS) +if (mask & info_ptr->free_me & PNG_FREE_ROWS) +#else +if (mask & PNG_FREE_ROWS) #endif - { +{ + if(info_ptr->row_pointers) + { int row; - 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 #ifdef PNG_FREE_ME_SUPPORTED @@ -583,7 +601,7 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr) { if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */ - return ("\n libpng version 1.0.7beta11 - May 6, 2000\n\ + return ("\n libpng version 1.0.7beta12 - May 12, 2000\n\ Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n\ Copyright (c) 1996, 1997 Andreas Dilger\n\ Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson\n"); @@ -601,8 +619,8 @@ png_get_libpng_ver(png_structp png_ptr) { /* Version of *.c files used when building libpng */ if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return("1.0.7beta11"); - return("1.0.7beta11"); + return("1.0.7beta12"); + return("1.0.7beta12"); } png_charp PNGAPI @@ -646,3 +664,10 @@ png_reset_zstream(png_structp png_ptr) { return (inflateReset(&png_ptr->zstream)); } + +png_uint_32 PNGAPI +png_access_version_number(void) +{ + /* Version of *.c files used when building libpng */ + return((png_uint_32) 10007L); +} diff --git a/png.h b/png.h index 09af919e..880c4227 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.0.7beta11 - May 6, 2000 + * libpng version 1.0.7beta12 - May 12, 2000 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -9,7 +9,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.0.7beta11 - May 6, 2000: Glenn + * libpng versions 0.97, January 1998, through 1.0.7beta12 - May 12, 2000: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -52,7 +52,7 @@ * 1.0.6h 10007 10.6h (testing xy.z so-numbering) * 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) + * 1.0.7beta11-12 10007 2.1.0.7beta11-12 (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) @@ -87,7 +87,7 @@ * Copyright (c) 1996, 1997 Andreas Dilger * (libpng versions 0.89c, June 1996, through 0.96, May 1997) * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson - * (libpng versions 0.97, January 1998, through 1.0.7beta11, May 6, 2000) + * (libpng versions 0.97, January 1998, through 1.0.7beta12, May 12, 2000) * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: @@ -162,13 +162,13 @@ * Y2K compliance in libpng: * ========================= * - * May 6, 2000 + * May 12, 2000 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.0.7beta11 are Y2K compliant. It is my belief that earlier + * upward through 1.0.7beta12 are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer @@ -223,6 +223,30 @@ * at the actual function definitions and structure components. */ +/* Version information for png.h - this should match the version in png.c */ +#define PNG_LIBPNG_VER_STRING "1.0.7beta12" + +#define PNG_LIBPNG_VER_SONUM 2 + +/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ +#define PNG_LIBPNG_VER_MAJOR 1 +#define PNG_LIBPNG_VER_MINOR 0 +#define PNG_LIBPNG_VER_RELEASE 7 +/* This should match the numeric part of the final component of + * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ +#define PNG_LIBPNG_VER_BUILD 12 + +/* Careful here. At one time, Guy wanted to use 082, but that would be octal. + * We must not include leading zeros. + * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only + * version 1.0.0 was mis-numbered 100 instead of 10000). From + * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ +#define PNG_LIBPNG_VER 10007 /* 1.0.7 */ + +/* Note to maintainer: update this number in scripts/pngdef.pas as well */ + +#ifndef PNG_VERSION_INFO_ONLY + /* include the compression library's header */ #include "zlib.h" @@ -245,18 +269,6 @@ extern "C" { * which applications aren't expected to use directly. */ -/* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.0.7beta11" - -/* Careful here. At one time, Guy wanted to use 082, but that would be octal. - * We must not include leading zeros. - * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only - * version 1.0.0 was mis-numbered 100 instead of 10000). From - * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=bugfix */ -#define PNG_LIBPNG_VER 10007 /* 1.0.7 */ - -/* Note to maintainer: update this number in scripts/pngdef.pas as well */ - /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) /* Version information for C files, stored in png.c. This had better match @@ -1111,9 +1123,9 @@ struct png_struct_def }; /* This prevents a compiler error in png_get_copyright() in png.c if png.c -and png.h are both at * version 1.0.7beta11 +and png.h are both at * version 1.0.7beta12 */ -typedef png_structp version_1_0_7beta11; +typedef png_structp version_1_0_7beta12; typedef png_struct FAR * FAR * png_structpp; @@ -1123,6 +1135,9 @@ typedef png_struct FAR * FAR * png_structpp; * a simple one line description of the use of each function. */ +/* Returns the version number of the library */ +extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); + /* Tell lib we have already handled the first magic bytes. * Handling more than 8 bytes from the beginning of the file is an error. */ @@ -1675,14 +1690,14 @@ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, #define PNG_FREE_ICCP 0x0010 #define PNG_FREE_SPLT 0x0020 #define PNG_FREE_ROWS 0x0040 -#define PNG_FREE_PCAL 0x0080 /* not used any more */ -#define PNG_FREE_SCAL 0x0100 /* not used any more */ +#define PNG_FREE_PCAL 0x0080 +#define PNG_FREE_SCAL 0x0100 #define PNG_FREE_UNKN 0x0200 #define PNG_FREE_LIST 0x0400 #define PNG_FREE_PLTE 0x1000 #define PNG_FREE_TRNS 0x2000 #define PNG_FREE_TEXT 0x4000 -#define PNG_FREE_ALL 0x3fff +#define PNG_FREE_ALL 0x7fff #ifdef PNG_USER_MEM_SUPPORTED extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, @@ -2080,19 +2095,28 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, */ #ifdef PNG_DEBUG #if (PNG_DEBUG > 0) +#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) +#include +#define png_debug(l,m) if (PNG_DEBUG > l) _RPT0(_CRT_WARN,m) +#define png_debug1(l,m,p1) if (PNG_DEBUG > l) _RPT1(_CRT_WARN,m,p1) +#define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) _RPT2(_CRT_WARN,m,p1,p2) +#else /* PNG_DEBUG_FILE || !_MSC_VER */ #ifndef PNG_DEBUG_FILE #define PNG_DEBUG_FILE stderr #endif /* PNG_DEBUG_FILE */ - -#define png_debug(l,m) if (PNG_DEBUG > l) \ - fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ - (l==2 ? "\t\t":(l>2 ? "\t\t\t":"")))) -#define png_debug1(l,m,p1) if (PNG_DEBUG > l) \ - fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ - (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1) -#define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) \ - fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ - (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1,p2) +#define png_debug(l,m) \ + if (PNG_DEBUG > l) \ + fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ + (l==2 ? "\t\t":(l>2 ? "\t\t\t":"")))) +#define png_debug1(l,m,p1) \ + if (PNG_DEBUG > l) \ + fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ + (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1) +#define png_debug2(l,m,p1,p2) \ + if (PNG_DEBUG > l) \ + fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \ + (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1,p2) +#endif /* _MSC_VER */ #endif /* (PNG_DEBUG > 0) */ #endif /* PNG_DEBUG */ #ifndef png_debug @@ -2113,7 +2137,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)); #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.0.7beta11 - May 6, 2000 (header)\n" + " libpng version 1.0.7beta12 - May 12, 2000 (header)\n" #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on @@ -2905,5 +2929,6 @@ PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, } #endif +#endif /* PNG_VERSION_INFO_ONLY */ /* do not put anything past this line */ #endif /* _PNG_H */ diff --git a/pngasmrd.h b/pngasmrd.h index 8275c867..92d7cc7c 100644 --- a/pngasmrd.h +++ b/pngasmrd.h @@ -1,6 +1,6 @@ /* pngasmrd.h - assembler version of utilities to read a PNG file * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1999, 2000 Glenn Randers-Pehrson * diff --git a/pngconf.h b/pngconf.h index ae738eef..7188b30a 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,6 +1,6 @@ /* pngconf.h - machine configurable file for libpng * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -58,6 +58,14 @@ * #define PNG_NO_STDIO */ +#ifdef PNG_BUILD_DLL +# ifndef PNG_CONSOLE_IO_SUPPORTED +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# endif +#endif + # ifdef PNG_NO_STDIO # ifndef PNG_NO_CONSOLE_IO # define PNG_NO_CONSOLE_IO @@ -987,34 +995,9 @@ typedef z_stream FAR * png_zstreamp; # define PNG_ATTR_DLLIMP #endif -#ifndef PNG_EXPORT -# define PNG_EXPORT(type,symbol) type symbol -#endif - -#if defined(__MINGW32__) || defined(__CYGWIN32__) -# define PNG_ATTR_DLLIMP -#endif - #ifdef PNG_USE_GLOBAL_ARRAYS #ifndef PNG_EXPORT_VAR -# if defined(_MSC_VER) && defined(_DLL) /* GRR 20000206 */ -# define PNG_EXPORT_VAR(type) extern type __declspec(dllexport) -# endif -# ifdef PNG_DECL_DLLEXP -# define PNG_EXPORT_VAR(type) extern __declspec(dllexport) type -# endif -# ifdef PNG_ATTR_DLLEXP -# define PNG_EXPORT_VAR(type) extern type __attribute__((dllexport)) -# endif -# ifdef PNG_DECL_DLLIMP -# define PNG_EXPORT_VAR(type) extern __declspec(dllimport) type -# endif -# ifdef PNG_ATTR_DLLIMP -# define PNG_EXPORT_VAR(type) extern type __attribute__((dllimport)) -# endif -#endif -#ifndef PNG_EXPORT_VAR -# define PNG_EXPORT_VAR(type) extern type +# define PNG_EXPORT_VAR(type) extern type #endif #endif diff --git a/pngerror.c b/pngerror.c index 0555ae7f..17c100f1 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pnggccrd.c b/pnggccrd.c index afd3f8cf..87ddc792 100644 --- a/pnggccrd.c +++ b/pnggccrd.c @@ -6,7 +6,7 @@ * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm * for Intel's performance analysis of the MMX vs. non-MMX code. * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -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 if the machine supports MMX. */ -void PNGAPI +void /* PRIVATE */ png_combine_row(png_structp png_ptr, png_bytep row, int mask) { png_debug(1,"in png_combine_row_asm\n"); @@ -4310,7 +4310,7 @@ png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, // Optimized png_read_filter_row routines -void PNGAPI +void /* PRIVATE */ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter) { diff --git a/pngget.c b/pngget.c index 548adb6e..8f43cbfc 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngmem.c b/pngmem.c index 66f83f22..9204f70b 100644 --- a/pngmem.c +++ b/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngpread.c b/pngpread.c index 0532bf9a..9a553dc0 100644 --- a/pngpread.c +++ b/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngread.c b/pngread.c index 29310892..86c89ce6 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -697,7 +697,7 @@ 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 * be ignored, so pass NULL to it. * - * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta11 + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta12 */ void PNGAPI @@ -746,7 +746,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row, * only call this function once. If you desire to have an image for * each pass of a interlaced image, use png_read_rows() instead. * - * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta11 + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.7beta12 */ void PNGAPI png_read_image(png_structp png_ptr, png_bytepp image) @@ -1293,18 +1293,9 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, /* -------------- 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; - } + png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); #endif - } if(info_ptr->row_pointers == NULL) { info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, diff --git a/pngrio.c b/pngrio.c index a8024a4e..8dbd6e8b 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngrtran.c b/pngrtran.c index 3c262e72..f5b7b7ca 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngrutil.c b/pngrutil.c index c28e69d9..e9893ff7 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -2043,9 +2043,9 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) you want all pixels to be combined, pass 0xff (255) in mask. */ void /* PRIVATE */ #ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW -png_combine_row_c /* PRIVATE */ +png_combine_row_c #else -png_combine_row /* PRIVATE */ +png_combine_row #endif /* PNG_HAVE_ASSEMBLER_COMBINE_ROW */ (png_structp png_ptr, png_bytep row, int mask) { diff --git a/pngset.c b/pngset.c index 971c3350..eeaff22c 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -240,6 +240,9 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, } info_ptr->valid |= PNG_INFO_pCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PCAL; +#endif } #endif @@ -284,6 +287,9 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); info_ptr->valid |= PNG_INFO_sCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_SCAL; +#endif } #endif #endif @@ -488,6 +494,9 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, info_ptr->num_text = 0; info_ptr->text = (png_textp)png_malloc(png_ptr, (png_uint_32)(info_ptr->max_text * sizeof (png_text))); +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_TEXT; +#endif } png_debug1(3, "allocated %d entries for info_ptr->text\n", info_ptr->max_text); @@ -495,9 +504,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, for (i = 0; i < num_text; i++) { 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]); if (text_ptr[i].key == (png_charp)NULL) @@ -505,7 +512,12 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, key_len = png_strlen(text_ptr[i].key); - if(text_ptr[i].compression > 0) + if(text_ptr[i].compression <= 0) + { + lang_len = 0; + lang_key_len = 0; + } + else #ifdef PNG_iTXt_SUPPORTED { /* set iTXt data */ @@ -518,11 +530,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, else lang_key_len = 0; } - else - { - lang_len = 0; - lang_key_len = 0; - } #else { png_warning(png_ptr, "iTXt chunk not supported."); @@ -547,17 +554,9 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, } textp->key = (png_charp)png_malloc(png_ptr, - (png_uint_32)(key_len + -#ifdef PNG_iTXt_SUPPORTED - lang_len + lang_key_len + -#endif - text_length + 4)); + (png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); png_debug2(2, "Allocated %d bytes at %x in png_set_text\n", - key_len + -#ifdef PNG_iTXt_SUPPORTED - lang_len + lang_key_len + -#endif - text_length + 4, textp->key); + key_len + lang_len + lang_key_len + text_length + 4, textp->key); png_memcpy(textp->key, text_ptr[i].key, (png_size_t)(key_len)); @@ -603,9 +602,6 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, } info_ptr->text[info_ptr->num_text]= *textp; info_ptr->num_text++; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_TEXT; -#endif png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); } } diff --git a/pngtest.c b/pngtest.c index 08ff399b..a3acd9fc 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -1152,9 +1152,11 @@ main(int argc, char *argv[]) fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); fprintf(STDERR,"%s",png_get_copyright(NULL)); /* Show the version of libpng used in building the library */ - fprintf(STDERR," library:%s",png_get_header_version(NULL)); + fprintf(STDERR," library (%lu):%s", png_access_version_number(), + png_get_header_version(NULL)); /* Show the version of libpng used in building the application */ - fprintf(STDERR," pngtest:%s",PNG_HEADER_VERSION_STRING); + fprintf(STDERR," pngtest (%lu):%s", PNG_LIBPNG_VER, + PNG_HEADER_VERSION_STRING); fprintf(STDERR," sizeof(png_struct)=%d, sizeof(png_info)=%d\n", sizeof(png_struct), sizeof(png_info)); @@ -1378,4 +1380,4 @@ main(int argc, char *argv[]) } /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_0_7beta11 your_png_h_is_not_version_1_0_7beta11; +typedef version_1_0_7beta12 your_png_h_is_not_version_1_0_7beta12; diff --git a/pngtrans.c b/pngtrans.c index f4bd1f3d..e303da40 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngvcrd.c b/pngvcrd.c index 96338529..5c3a7787 100644 --- a/pngvcrd.c +++ b/pngvcrd.c @@ -2,7 +2,7 @@ * * For Intel x86 CPU and Microsoft Visual C++ compiler * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998, Intel Corporation * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson diff --git a/pngwio.c b/pngwio.c index 0dae25ef..f7420546 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwrite.c b/pngwrite.c index 30bd1ee8..207ca82b 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger @@ -1245,8 +1245,7 @@ png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr #if defined(PNG_INFO_IMAGE_SUPPORTED) void PNGAPI png_write_png(png_structp png_ptr, png_infop info_ptr, - int transforms, - voidp params) + int transforms, voidp params) { #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) /* invert the alpha channel from opacity to transparency */ diff --git a/pngwtran.c b/pngwtran.c index f5ae9006..41625cc2 100644 --- a/pngwtran.c +++ b/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/pngwutil.c b/pngwutil.c index b1273e58..3254a5d4 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * libpng 1.0.7beta11 - May 6, 2000 + * libpng 1.0.7beta12 - May 12, 2000 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. * Copyright (c) 1996, 1997 Andreas Dilger diff --git a/scripts/makefile.beos b/scripts/makefile.beos index a007939a..f67a9a02 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -31,7 +31,7 @@ RANLIB=ranlib # 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 +PNGMIN = 1.0.7beta12 PNGVER = $(PNGMAJ).$(PNGMIN) # where make install puts libpng.a, libpng.so*, and png.h diff --git a/scripts/makefile.dec b/scripts/makefile.dec index 5c3d423c..865037bb 100644 --- a/scripts/makefile.dec +++ b/scripts/makefile.dec @@ -14,7 +14,7 @@ ZLIBINC=../zlib # 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 +PNGMIN = 1.0.7beta12 PNGVER = $(PNGMAJ).$(PNGMIN) CC=cc diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx index cb203988..8e2daef2 100644 --- a/scripts/makefile.gcmmx +++ b/scripts/makefile.gcmmx @@ -34,7 +34,7 @@ RANLIB=ranlib # 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 +PNGMIN = 1.0.7beta12 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.linux b/scripts/makefile.linux index 6aaaecca..7520c265 100644 --- a/scripts/makefile.linux +++ b/scripts/makefile.linux @@ -34,7 +34,7 @@ RANLIB=ranlib # 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 +PNGMIN = 1.0.7beta12 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sco b/scripts/makefile.sco index 43b47127..3563ef51 100644 --- a/scripts/makefile.sco +++ b/scripts/makefile.sco @@ -25,7 +25,7 @@ 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 +PNGMIN = 1.0.7beta12 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc index 7a158236..1c438413 100644 --- a/scripts/makefile.sggcc +++ b/scripts/makefile.sggcc @@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 # -g -DPNG_DEBUG=5 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDSHARED=gcc -shared -VER=1.0.7beta11 -LIBS=libpng.so.1.0.7beta11 +VER=1.0.7beta12 +LIBS=libpng.so.1.0.7beta12 SHAREDLIB=libpng.so libdir=$(prefix)/lib32 diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index c52abcf3..9eb82922 100644 --- a/scripts/makefile.solaris +++ b/scripts/makefile.solaris @@ -31,7 +31,7 @@ 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 +PNGMIN = 1.0.7beta12 PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas index 2991c549..69a83e0b 100644 --- a/scripts/pngdef.pas +++ b/scripts/pngdef.pas @@ -1,9 +1,11 @@ unit pngdef; +// Caution: this file is probably out of date. + interface const - PNG_LIBPNG_VER_STRING = '1.0.7beta11'; + PNG_LIBPNG_VER_STRING = '1.0.7beta12'; PNG_LIBPNG_VER = 10007; type diff --git a/scripts/pngos2.def b/scripts/pngos2.def index 0c0316d6..e2478da0 100644 --- a/scripts/pngos2.def +++ b/scripts/pngos2.def @@ -2,6 +2,8 @@ ; PNGLIB module definition file for OS/2 ;---------------------------------------- +; Caution: This file is probably out of date. + LIBRARY PNG DESCRIPTION "PNG image compression library for OS/2" CODE PRELOAD MOVEABLE DISCARDABLE