diff --git a/ANNOUNCE b/ANNOUNCE index fbf5b3220fc4037a4f396ae3549fb5b847e22768..d9149c1859ec564b70733b882302557149965191 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.0.6h - April 24, 2000 +Libpng 1.0.6i - May 1, 2000 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -33,13 +33,31 @@ version 1.0.6f [April 14, 2000] Removed superfluous prototype for png_set_itxt from png.h Removed "else" from pngread.c, after png_error(), and changed "0" to "length". Changed several png_errors about malformed ancillary chunks to png_warnings. -version 1.0.6h [April 24, 2000] +version 1.0.6g [April 24, 2000] 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 and other revisions (Matthias Benckmann) 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 (breaks compatibility with libpng-1.0.6). +version 1.0.6h [April 24, 2000] + 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) +version 1.0.6i [May 1, 2000] + 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 instead of using png_create_*(), as authors were instructed to + do in libpng-0.88 and earlier. + Added makefile.intel and updated makefile.watcom (Pawel Mrochen) Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/CHANGES b/CHANGES index 5075b8dc991e98395865bbaf1f351c08ece346ff..bdbf6805d8f12373d55ece270dc74e791c1d2222 100644 --- a/CHANGES +++ b/CHANGES @@ -699,6 +699,31 @@ version 1.0.6g [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 libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h) +version 1.0.6i [May 1, 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 instead of using png_create_*(), as authors were instructed to + do in libpng-0.88 and earlier. + 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) Send comments/corrections/commendations to png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu diff --git a/INSTALL b/INSTALL index ed6e16d720a417339705ab4124e85dfeafade579..088e67f512dc20069678cdf492f9dd305491414b 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.0.6h - April 24, 2000 +Installing libpng version 1.0.6i - May 1, 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.6h" or "lpng106" and "zlib-1.1.3" +might be called "libpng-1.0.6i" 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.6h) - makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6h, + makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6i) + makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.6i, 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.6h) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6i) 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.6i) makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.mips => MIPS makefile makefile.acorn => Acorn makefile diff --git a/KNOWNBUG b/KNOWNBUG index 909dda3ccf9e44ac094edff58e74c2e58aba6b5c..6bd8d9eebc0f9890f99acebfd8869c319a0af8da 100644 --- a/KNOWNBUG +++ b/KNOWNBUG @@ -1,21 +1,57 @@ 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.6i, 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 - make direct access to the info_ptr and png_ptr, due to the insertion - of the free_me member ahead of some previously existing members. + make direct access to members of the png_struct and png_info structures, + 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.6g 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. 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 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 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 STATUS: The function has been simplified and no longer uses strdup() 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 factors. 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 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() 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 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 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 @@ -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 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 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. -10. September 1999 -- ENHANCEMENT -- +11. September 1999 -- ENHANCEMENT -- It should be possible to use libpng without floating-point aritmetic. diff --git a/LICENSE b/LICENSE index 777cd00d7be6b800e6c8383daaf4afd8dbe7817f..a904f2000f0e2d8a2ce15ed84a262e4dcc2a306b 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.6h, April 24, 2000) +(libpng versions 0.97, January 1998, through 1.0.6i, May 1, 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 -April 24, 2000 +May 1, 2000 diff --git a/README b/README index 5f69529b005dd234df8371f6925d8783e4fba31a..d6b7d531fd0c92942a2f0aca71d050a94b1cd32b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng 1.0.6h - April 24, 2000 (shared library 2.1) +README for libpng 1.0.6i - May 1, 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.6h) + (gcc, creates libpng.so.2.1.0.6i) makefile.gcmmx => Linux/ELF makefile (gcc, creates - libpng.so.2.1.0.6h, uses assembler code + libpng.so.2.1.0.6i, 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.6h) + makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.6i) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng.so.2.1.0.6h) + (gcc, creates libpng.so.2.1.0.6i) 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 820a449d2d66d2e3fab3e6a4d386312a51dcc890..f5f22f945610afba3b7e3d9b8f01f26b9c4c802f 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - April 24, 2000 + May 1, 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.6h are Y2K compliant. It is my belief that earlier + upward through 1.0.6i 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 8d2d7e6d9a02422398134d6ef828ede621b40ff8..eee28bb3172d4da4070569a3b17959bdbe4478ff 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ echo " - There is no \"configure\" script for Libpng-1.0.6h. Instead, please + There is no \"configure\" script for Libpng-1.0.6i. Instead, please copy the appropriate makefile for your system from the \"scripts\" directory. Read the INSTALL file for more details. " diff --git a/example.c b/example.c index 3284b326bf341a0368eadf8d55708013f3c5e019..2f4f23c279341eddcdf1bacca44667a137e4aa13 100644 --- a/example.c +++ b/example.c @@ -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) */ - 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) */ png_set_swap_alpha(png_ptr); diff --git a/libpng.3 b/libpng.3 index 67bd0ffd1f0b11c2f5f72d15751f1886fc0df0f2..461e395f0e15ffc0240454f8d844557c0cec0799 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "April 24, 2000" +.TH LIBPNG 3 "May 1, 2000" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6h +libpng \- Portable Network Graphics (PNG) Reference Library 1.0.6i .SH SYNOPSIS \fI\fB @@ -725,7 +725,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.6h - April 24, 2000 + libpng version 1.0.6i - May 1, 2000 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -1062,14 +1062,39 @@ dithering, and setting filler.) If this is the case, simply do this: png_read_png(png_ptr, info_ptr, png_transforms, NULL) -where png_transforms is an integer containing the logical-or of some set of -transformation flags. This call is equivalent to png_read_info(), +where png_transforms is an integer containing the logical OR of +some set of transformation flags. This call is equivalent to png_read_info(), followed the set of transformations indicated by the transform mask, -followed by png_update_info(), followed by a read of the image bytes -to the info_ptr, followed by png_read_end(). +then png_read_image(), and finally png_read_end(). -(The final parameter of this call is not yet used. Someday it -will point to transformation parameters.) +(The final parameter of this call is not yet used. Someday it might point +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 Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson @@ -337,14 +337,39 @@ dithering, and setting filler.) If this is the case, simply do this: png_read_png(png_ptr, info_ptr, png_transforms, NULL) -where png_transforms is an integer containing the logical-or of some set of -transformation flags. This call is equivalent to png_read_info(), +where png_transforms is an integer containing the logical OR of +some set of transformation flags. This call is equivalent to png_read_info(), followed the set of transformations indicated by the transform mask, -followed by png_update_info(), followed by a read of the image bytes -to the info_ptr, followed by png_read_end(). +then png_read_image(), and finally png_read_end(). -(The final parameter of this call is not yet used. Someday it -will point to transformation parameters.) +(The final parameter of this call is not yet used. Someday it might point +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\fP diff --git a/png.5 b/png.5 index 133d25d7ae35f7091bdc6020e67e2ff643212028..b0f600eb487e946c942a236890539c9f35e70cb1 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "April 24, 2000" +.TH PNG 5 "May 1, 2000" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index b0671b3e21d639bc6c1173af5db920cd2986e68c..9823edca1a838987d67be25a79ceb8eb8a3d8d5e 100644 --- a/png.c +++ b/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * libpng version 1.0.6h - April 24, 2000 + * libpng version 1.0.6i - May 1, 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_6h Your_png_h_is_not_version_1_0_6h; +typedef version_1_0_6i Your_png_h_is_not_version_1_0_6i; /* 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.6h"; +char png_libpng_ver[12] = "1.0.6i"; /* png_sig was changed to a function in version 1.0.5c */ /* Place to hold the signature string for a PNG file. */ @@ -134,7 +134,7 @@ png_check_sig(png_bytep sig, int 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 png_zalloc(voidpf png_ptr, uInt items, uInt size) { @@ -261,6 +261,7 @@ png_info_init(png_infop info_ptr) png_memset(info_ptr, 0, sizeof (png_info)); } +#ifdef PNG_FREE_ME_SUPPORTED void png_data_freer(png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask) @@ -276,6 +277,7 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr, png_warning(png_ptr, "Unknown freer parameter in png_data_freer."); } +#endif void png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num) @@ -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) /* 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) +#endif { if (num != -1) { @@ -314,7 +318,11 @@ if (mask & PNG_FREE_TRNS) { 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; } @@ -362,7 +370,9 @@ if (mask & PNG_FREE_ICCP) { 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); @@ -427,7 +437,11 @@ if (mask & PNG_FREE_HIST) { 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); info_ptr->valid &= ~PNG_INFO_hIST; } @@ -439,7 +453,11 @@ if (mask & PNG_FREE_PLTE) { 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); info_ptr->valid &= ~(PNG_INFO_PLTE); info_ptr->num_palette = 0; @@ -450,7 +468,9 @@ if (mask & PNG_FREE_PLTE) /* 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) +#endif { int row; @@ -460,8 +480,10 @@ if (mask & PNG_FREE_ROWS) } } #endif +#ifdef PNG_FREE_ME_SUPPORTED if(num == -1) info_ptr->free_me &= ~mask; +#endif } /* This is an internal routine to free any memory that the info struct is @@ -475,7 +497,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr) 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) { png_free(png_ptr, png_ptr->chunk_list); @@ -561,7 +583,7 @@ png_charp png_get_copyright(png_structp png_ptr) { 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.6i - May 1, 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"); @@ -579,8 +601,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.6h"); - return("1.0.6h"); + return("1.0.6i"); + return("1.0.6i"); } png_charp diff --git a/png.h b/png.h index fd527b60ca1757903717faeb9f7537dfe8442fb5..863b412af9416cc9cd1ddf33f5f1641e80694b9f 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.0.6h - April 24, 2000 + * libpng version 1.0.6i - May 1, 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.6h - April 24, 2000: Glenn + * libpng versions 0.97, January 1998, through 1.0.6i - May 1, 2000: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -48,9 +48,11 @@ * 1.0.5s-v 1.0.5s-v 10006 2.1.0.5s-v (not binary compatible) * 1.0.6 (+ 3 patches) 1.0.6 10006 2.1.0.6 (still binary incompat) * 1.0.6d-f 1.0.6d-f 10007 2.1.0.6d-f (still binary incompat) - * 1.0.6g 1.0.6g 10007 2.1.0.6g (compatible with 1.0.5) - * 1.0.6h 1.0.6h 10007 10.6h (compatible with 1.0.5) - * 1.0.7 1.0.7 10007 10.7 (still compatible) + * 1.0.6g 1.0.6g 10007 2.1.0.6g + * 1.0.6h 1.0.6h 10007 10.6h + * 1.0.6 (+ 4 patches) 1.0.6 10006 2.1.0.6ad (compatible with 1.0.0) + * 1.0.6i 1.0.6i 10007 10.6i (can be compatible w/ 1.0.0) + * 1.0.7 1.0.7 10007 10.7 (still can be compatible) * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -79,7 +81,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.6h, April 24, 2000) + * (libpng versions 0.97, January 1998, through 1.0.6i, May 1, 2000) * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: @@ -154,13 +156,13 @@ * Y2K compliance in libpng: * ========================= * - * April 24, 2000 + * May 1, 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.6h are Y2K compliant. It is my belief that earlier + * upward through 1.0.6i 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 @@ -238,7 +240,7 @@ extern "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.6i" /* Careful here. At one time, Guy wanted to use 082, but that would be octal. * We must not include leading zeros. @@ -489,15 +491,13 @@ typedef struct png_info_struct * 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 * 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. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */ #endif -#endif #if defined(PNG_sRGB_SUPPORTED) /* GR-P, 0.96a */ @@ -517,9 +517,6 @@ typedef struct png_info_struct int num_text; /* number of comments read/to write */ int max_text; /* current size of text array */ 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 */ #if defined(PNG_tIME_SUPPORTED) @@ -595,7 +592,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_uint_16p hist; #endif -#if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_cHRM_SUPPORTED /* 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 * mapping of the input image to ensure that the viewer sees the same @@ -636,6 +633,16 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte pcal_nparams; /* number of parameters given in pcal_params */ #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) /* iCCP chunk data. */ png_charp iccp_name; /* profile name */ @@ -669,19 +676,13 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) #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) /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */ /* Data valid if (valid & PNG_INFO_IDAT) non-zero */ png_bytepp row_pointers; /* the image bits */ #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) */ #endif @@ -696,8 +697,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_fixed_point int_y_blue; #endif - png_uint_32 free_me; /* flags items libpng is responsible for freeing */ - } png_info; typedef png_info FAR * png_infop; @@ -828,7 +827,8 @@ typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep, #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) typedef void (*png_user_transform_ptr) PNGARG((png_structp, png_row_infop, png_bytep)); #endif @@ -885,11 +885,14 @@ struct png_struct_def png_user_transform_ptr write_user_transform_fn; /* user write transform */ #endif +/* These were added in libpng-1.0.2 */ +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) #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 #endif png_uint_32 mode; /* tells us where we are in the PNG file */ @@ -941,14 +944,18 @@ struct png_struct_def png_byte sig_bytes; /* magic bytes read/written from start of file */ #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 */ #endif +#endif #if defined(PNG_READ_bKGD_SUPPORTED) png_byte background_gamma_type; -#ifdef PNG_FLOATING_POINT_SUPPORTED +# ifdef PNG_FLOATING_POINT_SUPPORTED float background_gamma; -#endif +# 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 */ @@ -978,7 +985,7 @@ struct png_struct_def 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) +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_sBIT_SUPPORTED) png_color_8 sig_bit; /* significant bits in each available channel */ #endif @@ -1058,6 +1065,22 @@ struct png_struct_def png_free_ptr free_fn; /* function for freeing memory */ #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) png_byte rgb_to_gray_status; png_uint_16 rgb_to_gray_red_coeff; @@ -1070,27 +1093,16 @@ struct png_struct_def 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 -#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 -and png.h are both at * version 1.0.6h +and png.h are both at * version 1.0.6i */ -typedef png_structp version_1_0_6h; +typedef png_structp version_1_0_6i; typedef png_struct FAR * FAR * png_structpp; @@ -1574,18 +1586,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)); #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 png_ptr, png_user_transform_ptr read_user_transform_fn)); #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 png_ptr, png_user_transform_ptr write_user_transform_fn)); #endif #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 png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels)); @@ -1634,18 +1649,17 @@ extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); /* Free data that was allocated internally */ extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 free_me, int num)); +#ifdef PNG_FREE_ME_SUPPORTED /* Reassign responsibility for freeing existing data, whether allocated * by libpng or by the application */ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask)); +#endif /* assignments for png_data_freer */ #define PNG_DESTROY_WILL_FREE_DATA 1 #define PNG_SET_WILL_FREE_DATA 1 #define PNG_USER_WILL_FREE_DATA 2 /* 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_ICCP 0x0010 #define PNG_FREE_SPLT 0x0020 @@ -1654,7 +1668,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_UNKN 0x0200 #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 extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, @@ -2034,6 +2051,7 @@ extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp #endif #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, png_infop info_ptr, int transforms, @@ -2084,7 +2102,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.6h - April 24, 2000 (header)\n" + " libpng version 1.0.6i - May 1, 2000 (header)\n" #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED /* With these routines we avoid an integer divide, which will be slower on @@ -2150,6 +2168,8 @@ extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); #define PNG_WROTE_tIME 0x200 #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 #define PNG_BACKGROUND_IS_GRAY 0x800 +#define PNG_CREATED_READ_STRUCT 0x1000 +#define PNG_CREATED_WRITE_STRUCT 0x2000 /* flags for the transformations the PNG library does on the image data */ #define PNG_BGR 0x0001 @@ -2200,8 +2220,11 @@ 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_CRITICAL_USE 0x0400 #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 -#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x1000 -#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x2000 +#define PNG_FLAG_FREE_PLTE 0x1000 +#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 /* For use in png_set_keep_unknown, png_handle_as_unknown */ #define HANDLE_CHUNK_AS_DEFAULT 0 diff --git a/pngasmrd.h b/pngasmrd.h index db2d5f84e7fd26f31f488bb77cb98711b76eefa0..98b81b20b4542ccca4893ed15d28c755151af875 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.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 ea8da8104f15c6d5331685a020ad7176d64326e5..b40143d817da5bac553a8d6dad93d75e7eef76eb 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -17,6 +17,37 @@ #ifndef PNGCONF_H #define PNGCONF_H +/* The following support, added at version 1.0.6, will be turned on by + * default in version 2.0.0. + * They have been turned off here in case you need binary compatibility + * with old applications that require the length of png_struct and + * png_info to remain at the old length. + */ + + +#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_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 +#endif + +#ifndef PNG_NO_FREE_ME +#define PNG_FREE_ME_SUPPORTED +#endif + /* This is the size of the compression buffer, and thus the size of * an IDAT chunk. Make this whatever size you feel is best for your * machine. One of these will be allocated per png_struct. When this @@ -267,11 +298,13 @@ 1.0.1c, for consistency) */ -#ifndef PNG_NO_FLOATING_POINT_SUPPORTED +#ifndef PNG_NO_FLOATING_POINT_SUPPORTED #define PNG_FLOATING_POINT_SUPPORTED #endif -#ifndef PNG_NO_FIXED_POINT_SUPPORTED +/* Ignore attempt to turn off both floating and fixed point support */ + +#ifndef PNG_FLOATING_POINT_SUPPORTED #define PNG_FIXED_POINT_SUPPORTED #endif @@ -389,6 +422,13 @@ #endif #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 encoders, but can cause trouble if left undefined */ @@ -455,7 +495,9 @@ /* very little testing */ /* #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +#ifndef PNG_NO_USER_MEM #define PNG_USER_MEM_SUPPORTED +#endif */ /* This is only for PowerPC big-endian and 680x0 systems */ @@ -560,7 +602,15 @@ # define PNG_READ_zTXt_SUPPORTED # define PNG_zTXt_SUPPORTED #endif -#ifndef PNG_NO_READ_USER_CHUNKS +#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 +#if !defined (PNG_NO_READ_USER_CHUNKS) && \ +defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) # define PNG_READ_USER_CHUNKS_SUPPORTED # define PNG_USER_CHUNKS_SUPPORTED # ifdef PNG_NO_READ_UNKNOWN_CHUNKS @@ -570,13 +620,6 @@ # undef PNG_NO_HANDLE_AS_UNKNOWN # 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 # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ #endif /* optional PLTE chunk in RGB and RGBA images */ diff --git a/pngerror.c b/pngerror.c index 63853a178fad19b8805fa8a0aa10c3ae52b28773..ca64d5b65a738f83b26904b521c8510ab39fc17c 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 76cec6b4e0755d9e66b7a6743899a58e5a9b2676..228f1f043d586974e01e0da5bef9fc6a20df386c 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.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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/pngget.c b/pngget.c index 2dc5b44a113e7c9da0ef63ea6b15c30088119226..3b8b0f01c1e17c0769d8325d90890bf023217452 100644 --- a/pngget.c +++ b/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -434,6 +434,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) return (0); } #endif +#ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point *int_file_gamma) @@ -448,6 +449,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, return (0); } #endif +#endif #if defined(PNG_READ_sRGB_SUPPORTED) png_uint_32 diff --git a/pngmem.c b/pngmem.c index 12a4fd8d5104c2c0d62c38dcea59e1357c9d1f94..ce69191d748de2fd6ae79b0be7e8bfa1cb614006 100644 --- a/pngmem.c +++ b/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 a8eee72c8eef307840a16ef54f40955f419eac74..1454f526e407d27af3b489ed5d9b02878c6319da 100644 --- a/pngpread.c +++ b/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -1336,12 +1336,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 defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != HANDLE_CHUNK_ALWAYS #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) && png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL #endif ) +#endif png_chunk_error(png_ptr, "unknown critical chunk"); /* to quiet compiler warnings about unused info_ptr */ diff --git a/pngread.c b/pngread.c index dac3d983bd636d30716db085ea3f44aad8b08abe..813df00ba5033bc15f430a68ff53a67c8e65fbc6 100644 --- a/pngread.c +++ b/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -108,6 +108,8 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_set_read_fn(png_ptr, NULL, NULL); + png_ptr->mode |= PNG_CREATED_READ_STRUCT; + return (png_ptr); } @@ -136,6 +138,15 @@ png_read_init(png_structp png_ptr) png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf)); #endif +#ifndef PNG_LEGACY_SUPPORTED + if(!(png_ptr->mode & PNG_CREATED_READ_STRUCT)) + { + png_ptr->error_fn=NULL; + png_error(png_ptr, + "Read struct not properly created; use a legacy-supporting libpng."); + } +#endif + /* initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, @@ -641,7 +652,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.6h. + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6i. */ void @@ -690,7 +701,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.6h. + * [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.6i. */ void png_read_image(png_structp png_ptr, png_bytepp image) @@ -1013,19 +1024,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_to_1); #endif +#ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_PLTE) png_zfree(png_ptr, png_ptr->palette); 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) || \ defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) +#ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_TRNS) png_free(png_ptr, png_ptr->trans); 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 #if defined(PNG_READ_hIST_SUPPORTED) +#ifdef PNG_FREE_ME_SUPPORTED if (png_ptr->free_me & PNG_FREE_HIST) png_free(png_ptr, png_ptr->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 #if defined(PNG_READ_GAMMA_SUPPORTED) if (png_ptr->gamma_16_table != NULL) @@ -1218,15 +1247,29 @@ void 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; + } +#endif + } if(info_ptr->row_pointers == NULL) { info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, info_ptr->height * sizeof(png_bytep)); +#ifdef PNG_FREE_ME_SUPPORTED 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); info_ptr->valid |= PNG_INFO_IDAT; diff --git a/pngrio.c b/pngrio.c index cec81b786399269c776a67653cc9aa10ca84cc29..d7990c7fed60ed5e4526fe532c8f3fefc843877f 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 bd60d1d321a63d6af6fb7dfb117fccbdf1846174..311e9f117f1842deeba4bb60785aa766e29b188d 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.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -645,14 +645,23 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, } #endif -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_LEGACY_SUPPORTED) void png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr read_user_transform_fn) { 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->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 @@ -1079,7 +1088,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr) info_ptr->channels++; #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(info_ptr->bit_depth < png_ptr->user_transform_depth) @@ -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 pixel_depth; bits per pixel (depth*channels) */ png_ptr->row_buf + 1); /* start of pixel data for row */ +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) if(png_ptr->user_transform_depth) png_ptr->row_info.bit_depth = png_ptr->user_transform_depth; if(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.channels); png_ptr->row_info.rowbytes = (png_ptr->row_info.width * diff --git a/pngrutil.c b/pngrutil.c index 8e5cf7f6459f0ceb390e836b0233fe21b6b129b5..de732a04fb14e0a66728fb0dab3e6315c3e17f43 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -446,11 +446,15 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->palette = palette; 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_ptr->free_me |= PNG_FREE_PLTE; +#else + png_ptr->flags |= PNG_FLAG_FREE_PLTE; +#endif 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 (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) @@ -849,8 +853,19 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) igamma=(int)info_ptr->int_gamma; #else # ifdef PNG_FLOATING_POINT_SUPPORTED - igamma=info_ptr->gamma * 100000.; + igamma=(int)(info_ptr->gamma * 100000.); # 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 if(igamma < 45000L || igamma > 46000L) { @@ -870,6 +885,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif /* PNG_READ_gAMA_SUPPORTED */ #ifdef PNG_READ_cHRM_SUPPORTED +#ifdef PNG_FIXED_POINT_SUPPORTED if (info_ptr->valid & PNG_INFO_cHRM) if (abs(info_ptr->int_x_white - 31270L) > 1000 || abs(info_ptr->int_y_white - 32900L) > 1000 || @@ -883,6 +899,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_warning(png_ptr, "Ignoring incorrect cHRM value when sRGB is also present"); } +#endif /* PNG_FIXED_POINT_SUPPORTED */ #endif /* PNG_READ_cHRM_SUPPORTED */ png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent); @@ -1157,8 +1174,12 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) if (png_crc_finish(png_ptr, 0)) return; +#ifdef PNG_FREE_ME_SUPPORTED png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); 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_ptr->trans_values)); } @@ -1304,8 +1325,12 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) if (png_crc_finish(png_ptr, 0)) return; +#ifdef PNG_FREE_ME_SUPPORTED png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); 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); } #endif @@ -1924,12 +1949,14 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) 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) != HANDLE_CHUNK_ALWAYS #if defined(PNG_READ_USER_CHUNKS_SUPPORTED) && png_ptr->read_user_chunk_fn == (png_user_chunk_ptr)NULL #endif ) +#endif png_chunk_error(png_ptr, "unknown critical chunk"); } @@ -2831,7 +2858,8 @@ png_read_start_row(png_structp png_ptr) } #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) { int user_pixel_depth=png_ptr->user_transform_depth* diff --git a/pngset.c b/pngset.c index 2817b1f5fec41ed61b19803a686d2e617eb6c510..397ab6fdb377626a581131ecdfbb39e28e2cf471 100644 --- a/pngset.c +++ b/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -123,7 +123,9 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point #ifdef PNG_FLOATING_POINT_SUPPORTED info_ptr->gamma = (float)(int_gamma/100000.); #endif +#ifdef PNG_FIXED_POINT_SUPPORTED info_ptr->int_gamma = int_gamma; +#endif info_ptr->valid |= PNG_INFO_gAMA; } @@ -441,7 +443,9 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr, /* Compression is always zero but is here so the API and info structure * does not have to change if we introduce multiple compression types */ info_ptr->iccp_compression = (png_byte)compression_type; +#ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_ICCP; +#endif info_ptr->valid |= PNG_INFO_iCCP; } #endif @@ -574,7 +578,9 @@ 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); } } @@ -652,7 +658,9 @@ png_set_sPLT(png_structp png_ptr, info_ptr->splt_palettes = np; info_ptr->splt_palettes_num += nentries; info_ptr->valid |= PNG_INFO_sPLT; +#ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_SPLT; +#endif } #endif /* PNG_sPLT_SUPPORTED */ @@ -691,7 +699,9 @@ png_set_unknown_chunks(png_structp png_ptr, info_ptr->unknown_chunks = np; info_ptr->unknown_chunks_num += num_unknowns; +#ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_UNKN; +#endif } void png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, @@ -749,7 +759,9 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep *p=(png_byte)keep; png_ptr->num_chunk_list=old_num_chunks+num_chunks; png_ptr->chunk_list=new_list; +#ifdef PNG_FREE_ME_SUPPORTED png_ptr->free_me |= PNG_FREE_LIST; +#endif } #endif @@ -780,7 +792,6 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) } #endif - void png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) { diff --git a/pngtest.c b/pngtest.c index 22435d4c99862119c7d1bec079f0195a7a774062..93b373bd24ef29c178eae6dd73b0bd49227c668b 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -687,11 +687,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif } } +#if defined(PNG_FIXED_POINT_SUPPORTED) #if defined(PNG_cHRM_SUPPORTED) { png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; - 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)) { @@ -710,6 +710,32 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #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) { png_charp name; @@ -1129,6 +1155,8 @@ main(int argc, char *argv[]) fprintf(STDERR," library:%s",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," 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 not sure this matters, but it is nice to know, the first of these @@ -1201,7 +1229,10 @@ main(int argc, char *argv[]) #endif for (i=2; iuser_transform_ptr = user_transform_ptr; png_ptr->user_transform_depth = (png_byte)user_transform_depth; 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 * the user transform functions. The application should free any memory @@ -590,6 +598,11 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp png_voidp png_get_user_transform_ptr(png_structp png_ptr) { +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) return ((png_voidp)png_ptr->user_transform_ptr); -} +#else + if(png_ptr) + return (NULL); + return (NULL); #endif +} diff --git a/pngvcrd.c b/pngvcrd.c index be72d58de77328815718fa0f25165654e58f5c4c..73c9c774cd8a811e8eb85e1f266ec6b2c7c88de7 100644 --- a/pngvcrd.c +++ b/pngvcrd.c @@ -2,7 +2,7 @@ * * For Intel x86 CPU and Microsoft Visual C++ compiler * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 2edc7610df31ac1fff074496284ee53a1c24caf9..3a2f06cf1113ca8f63e5320bd6e1cf7ee0565fe0 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 c787c5029ee6fa0dd28727cb10a19da8361fd1e0..e28caf3d0df8f79747f81343015b21165c783f37 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -480,6 +480,8 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, 1, NULL, NULL); #endif + png_ptr->mode |= PNG_CREATED_WRITE_STRUCT; + return ((png_structp)png_ptr); } @@ -505,6 +507,15 @@ png_write_init(png_structp png_ptr) png_memcpy(png_ptr->jmpbuf, tmp_jmp, sizeof (jmp_buf)); #endif +#ifndef PNG_LEGACY_SUPPORTED + if(!(png_ptr->mode & PNG_CREATED_WRITE_STRUCT)) + { + png_ptr->error_fn=NULL; + png_error(png_ptr, + "Write struct not properly created; use a legacy-supporting libpng."); + } +#endif + /* initialize zbuf - compression buffer */ png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, @@ -804,11 +815,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); +#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) if (png_ptr->num_chunk_list) { png_free(png_ptr, png_ptr->chunk_list); png_ptr->num_chunk_list=0; } +#endif #ifdef PNG_USER_MEM_SUPPORTED png_destroy_struct_2((png_voidp)info_ptr, free_fn); diff --git a/pngwtran.c b/pngwtran.c index 1ff20906afa5aad2c5efa4706568e2a318f07bd7..80e80b699e777c0879ccefa571837caf8bd52a9f 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.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 029e9e827bb2f33b6b5f94b01228847d4b98ab2c..b722933e8c34b29e5266b1cc2b59eef676a3c24c 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * libpng 1.0.6h - April 24, 2000 + * libpng 1.0.6i - May 1, 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 @@ -167,7 +167,7 @@ png_text_compress(png_structp png_ptr, { comp->input = text; comp->input_len = text_len; - return(text_len); + return((int)text_len); } if (compression >= PNG_TEXT_COMPRESSION_LAST) @@ -314,7 +314,7 @@ png_text_compress(png_structp png_ptr, if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) 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 */ @@ -647,8 +647,8 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, profile_len = 0; if (profile_len) - profile_len = png_text_compress(png_ptr, profile, profile_len, - PNG_TEXT_COMPRESSION_zTXt, &comp); + profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len, + PNG_TEXT_COMPRESSION_zTXt, &comp); /* make sure we include the NULL after the name and the compression type */ png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, @@ -1204,7 +1204,8 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, png_free(png_ptr, new_key); /* 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 */ png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32) @@ -1256,7 +1257,8 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key, text_len = 0; /* 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, * and the NULs after the key, lang, and lang_key parts */ diff --git a/scripts/makefile.beos b/scripts/makefile.beos index dc29ddfe0a5d15f8c937859a8d302c2dd95cea44..0790cadc05e4453faf2837cf6a13f8e575131d4e 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -7,7 +7,7 @@ # read libpng.txt or png.h to see why PNGMAJ is 10. You should not # have to change it. PNGMAJ = 10 -PNGMIN = 6h +PNGMIN = 6i PNGVER = $(PNGMAJ).$(PNGMIN) CC=gcc diff --git a/scripts/makefile.dec b/scripts/makefile.dec index 06a4e51b2053842e1a4d081ea30cdb0c4942cab3..02d5f2080b11075bb99316e18d7ff4165dffa74a 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 10. You should not # have to change it. PNGMAJ = 10 -PNGMIN = 6h +PNGMIN = 6i PNGVER = $(PNGMAJ).$(PNGMIN) CC=cc diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx index 882f711dc3667049420398e3b6648e7c5007b213..7dc9b1f02fe81c764e213255bc07510e38995cf7 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 10. You should not # have to change it. PNGMAJ = 10 -PNGMIN = 6h +PNGMIN = 6i PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.intel b/scripts/makefile.intel new file mode 100644 index 0000000000000000000000000000000000000000..b5522633961321890b0f21bc10a9258b179e2a44 --- /dev/null +++ b/scripts/makefile.intel @@ -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 diff --git a/scripts/makefile.linux b/scripts/makefile.linux index 6a986481924e33d26b82da8a8418cde21db38343..bd23d80c2fdc8e6b9f22efc5ef3e17bd7c4b5e18 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 10. You should not # have to change it. PNGMAJ = 10 -PNGMIN = 6h +PNGMIN = 6i PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sco b/scripts/makefile.sco index 794d6e7844331940f5f871f80b137a9c0bc27e7f..98a95a706e3f85877bec8cd4d03142fb3d55a866 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 10. You should not # have to change it. PNGMAJ = 10 -PNGMIN = 6h +PNGMIN = 6i PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc index f251956c3c0349dbc5998a0420ac821d2d221683..d7f8c3a9aaedd15a89ea52fea0e27eda0b41cd9b 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.6h -LIBS=libpng.so.1.0.6h +VER=1.0.6i +LIBS=libpng.so.1.0.6i SHAREDLIB=libpng.so libdir=$(prefix)/lib32 diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index ad1e93bf56735387ebb3183aa69a049ab674c6d3..43f236e75704d52f6165f3a28027f96d8b4c8a47 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 10. You should not # have to change it. PNGMAJ = 10 -PNGMIN = 6h +PNGMIN = 6i PNGVER = $(PNGMAJ).$(PNGMIN) INCPATH=$(prefix)/include diff --git a/scripts/makefile.watcom b/scripts/makefile.watcom index e14f162ac34ea8a7ac52e3273d1317878af1ef07..5e860fc06c76258fa4e3dbda2589bf5281e21bd4 100644 --- a/scripts/makefile.watcom +++ b/scripts/makefile.watcom @@ -1,28 +1,48 @@ # 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 -# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib # To use, do "wmake /f scripts\makefile.watcom" -# ------------- Watcom 10.0 and later ------------- -MODEL=-mf -CFLAGS= $(MODEL) -5r -fp5 -fpi87 -oneatx -i=..\zlib + +# ---------------------- Watcom C/C++ 10.0 and later ----------------------- + +# 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 +CFLAGS=-$(CPU)$(CALLING) -fp$(CPU) -fpi87 -oneatx -mf -bt=$(OS) -i=$(ZLIBINC) -zq LD=wcl386 -LIB=wlib -b -c -LDFLAGS= +LDFLAGS=-zq + O=.obj -#uncomment next to put error messages in a file -#ERRFILE= >> pngerrs +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) -# 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 @@ -75,14 +95,15 @@ pngwutil$(O): png.h pngconf.h $(CC) $(CFLAGS) $*.c $(ERRFILE) libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3) - $(LIB) -n libpng.lib $(OBJS1) - $(LIB) libpng.lib $(OBJS2) - $(LIB) libpng.lib $(OBJS3) + wlib -b -c -n -q libpng.lib $(OBJS1) + wlib -b -c -q libpng.lib $(OBJS2) + wlib -b -c -q libpng.lib $(OBJS3) 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 - pngtest + pngtest.exe + # End of makefile for libpng diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas index b7af17286054bc57548e9ac7702262862563129a..bfac79193d872865026c35013e4583c15132d47f 100644 --- a/scripts/pngdef.pas +++ b/scripts/pngdef.pas @@ -3,7 +3,7 @@ unit pngdef; interface const - PNG_LIBPNG_VER_STRING = '1.0.6h'; + PNG_LIBPNG_VER_STRING = '1.0.6i'; PNG_LIBPNG_VER = 10007; type