Author: korli Date: 2009-11-09 00:30:28 +0100 (Mon, 09 Nov 2009) New Revision: 33956 Changeset: http://dev.haiku-os.org/changeset/33956/haiku Modified: haiku/trunk/headers/libs/png/png.h haiku/trunk/headers/libs/png/pngconf.h haiku/trunk/src/libs/png/LICENSE haiku/trunk/src/libs/png/png.c haiku/trunk/src/libs/png/pngset.c haiku/trunk/src/libs/png/pngwutil.c Log: updated libpng to 1.2.40 Modified: haiku/trunk/headers/libs/png/png.h =================================================================== --- haiku/trunk/headers/libs/png/png.h 2009-11-08 23:22:57 UTC (rev 33955) +++ haiku/trunk/headers/libs/png/png.h 2009-11-08 23:30:28 UTC (rev 33956) @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library * - * libpng version 1.2.39 - August 13, 2009 + * libpng version 1.2.40 - September 10, 2009 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -10,7 +10,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.39 - August 13, 2009: Glenn + * libpng versions 0.97, January 1998, through 1.2.40 - September 10, 2009: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -241,6 +241,10 @@ * 1.2.39rc01 13 10239 12.so.0.39[.0] * 1.0.48 10 10048 10.so.0.48[.0] * 1.2.39 13 10239 12.so.0.39[.0] + * 1.2.40beta01 13 10240 12.so.0.40[.0] + * 1.2.40rc01 13 10240 12.so.0.40[.0] + * 1.0.49 10 10049 10.so.0.49[.0] + * 1.2.40 13 10240 12.so.0.40[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -272,7 +276,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.2.39, August 13, 2009, are + * libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are * Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -384,13 +388,13 @@ * Y2K compliance in libpng: * ========================= * - * August 13, 2009 + * September 10, 2009 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.2.39 are Y2K compliant. It is my belief that earlier + * upward through 1.2.40 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 @@ -446,9 +450,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.2.39" +#define PNG_LIBPNG_VER_STRING "1.2.40" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.2.39 - August 13, 2009\n" + " libpng version 1.2.40 - September 10, 2009\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 @@ -456,7 +460,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 -#define PNG_LIBPNG_VER_RELEASE 39 +#define PNG_LIBPNG_VER_RELEASE 40 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ @@ -486,14 +490,14 @@ * 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 10239 /* 1.2.39 */ +#define PNG_LIBPNG_VER 10240 /* 1.2.40 */ #ifndef PNG_VERSION_INFO_ONLY -/* include the compression library's header */ +/* Include the compression library's header */ #include "zlib.h" #endif -/* include all user configurable info, including optional assembler routines */ +/* Include all user configurable info, including optional assembler routines */ #include "pngconf.h" /* @@ -575,7 +579,7 @@ */ #ifdef PNG_USE_GLOBAL_ARRAYS PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18]; - /* need room for 99.99.99beta99z */ + /* Need room for 99.99.99beta99z */ #else #define png_libpng_ver png_get_header_ver(NULL) #endif @@ -785,7 +789,7 @@ */ typedef struct png_info_struct { - /* the following are necessary for every PNG file */ + /* The following are necessary for every PNG file */ png_uint_32 width; /* width of image in pixels (from IHDR) */ png_uint_32 height; /* height of image in pixels (from IHDR) */ png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ @@ -1190,10 +1194,10 @@ #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ -#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only, deprecated */ +#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only, deprecated */ /* Added to libpng-1.2.34 */ -#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* WRITE only */ -#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* WRITE only */ +#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* write only */ +#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ /* Flags for MNG supported features */ #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 @@ -1434,7 +1438,7 @@ #if defined(PNG_MNG_FEATURES_SUPPORTED) || \ defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -/* changed from png_byte to png_uint_32 at version 1.2.0 */ +/* Changed from png_byte to png_uint_32 at version 1.2.0 */ #ifdef PNG_1_0_X png_byte mng_features_permitted; #else @@ -1513,7 +1517,7 @@ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef png_structp version_1_2_39; +typedef png_structp version_1_2_40; typedef png_struct FAR * FAR * png_structpp; @@ -2090,7 +2094,7 @@ extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); -/* function that combines rows. Not very much different than the +/* Function that combines rows. Not very much different than the * png_combine_row() call. Is this even used????? */ extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, @@ -2996,7 +3000,7 @@ /* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */ #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) -/* place to hold the signature string for a PNG file. */ +/* Place to hold the signature string for a PNG file. */ #ifdef PNG_USE_GLOBAL_ARRAYS PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8]; #else Modified: haiku/trunk/headers/libs/png/pngconf.h =================================================================== --- haiku/trunk/headers/libs/png/pngconf.h 2009-11-08 23:22:57 UTC (rev 33955) +++ haiku/trunk/headers/libs/png/pngconf.h 2009-11-08 23:30:28 UTC (rev 33956) @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.2.39 - August 13, 2009 + * libpng version 1.2.40 - September 10, 2009 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) Modified: haiku/trunk/src/libs/png/LICENSE =================================================================== --- haiku/trunk/src/libs/png/LICENSE 2009-11-08 23:22:57 UTC (rev 33955) +++ haiku/trunk/src/libs/png/LICENSE 2009-11-08 23:30:28 UTC (rev 33956) @@ -10,7 +10,7 @@ This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.2.39, August 13, 2009, are +libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -108,4 +108,4 @@ Glenn Randers-Pehrson glennrp at users.sourceforge.net -August 13, 2009 +September 10, 2009 Modified: haiku/trunk/src/libs/png/png.c =================================================================== --- haiku/trunk/src/libs/png/png.c 2009-11-08 23:22:57 UTC (rev 33955) +++ haiku/trunk/src/libs/png/png.c 2009-11-08 23:30:28 UTC (rev 33956) @@ -16,7 +16,7 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_39 Your_png_h_is_not_version_1_2_39; +typedef version_1_2_40 Your_png_h_is_not_version_1_2_40; /* Version information for C files. This had better match the version * string defined in png.h. */ @@ -705,7 +705,7 @@ png_get_copyright(png_structp png_ptr) { png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ - return ((png_charp) "\n libpng version 1.2.39 - August 13, 2009\n\ + return ((png_charp) "\n libpng version 1.2.40 - September 10, 2009\n\ Copyright (c) 1998-2009 Glenn Randers-Pehrson\n\ Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); Modified: haiku/trunk/src/libs/png/pngset.c =================================================================== --- haiku/trunk/src/libs/png/pngset.c 2009-11-08 23:22:57 UTC (rev 33955) +++ haiku/trunk/src/libs/png/pngset.c 2009-11-08 23:30:28 UTC (rev 33956) @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.39 [August 13, 2009] + * Last changed in libpng 1.2.40 [September 10, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -25,6 +25,7 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) { png_debug1(1, "in %s storage function", "bKGD"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -41,6 +42,7 @@ double green_x, double green_y, double blue_x, double blue_y) { png_debug1(1, "in %s storage function", "cHRM"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -74,6 +76,7 @@ png_fixed_point blue_x, png_fixed_point blue_y) { png_debug1(1, "in %s storage function", "cHRM fixed"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -112,7 +115,9 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) { double png_gamma; + png_debug1(1, "in %s storage function", "gAMA"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -140,6 +145,7 @@ png_fixed_point png_gamma; png_debug1(1, "in %s storage function", "gAMA"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -177,8 +183,10 @@ int i; png_debug1(1, "in %s storage function", "hIST"); + if (png_ptr == NULL || info_ptr == NULL) return; + if (info_ptr->num_palette == 0 || info_ptr->num_palette > PNG_MAX_PALETTE_LENGTH) { @@ -221,6 +229,7 @@ int filter_type) { png_debug1(1, "in %s storage function", "IHDR"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -328,6 +337,7 @@ png_int_32 offset_x, png_int_32 offset_y, int unit_type) { png_debug1(1, "in %s storage function", "oFFs"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -348,6 +358,7 @@ int i; png_debug1(1, "in %s storage function", "pCAL"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -417,6 +428,7 @@ int unit, double width, double height) { png_debug1(1, "in %s storage function", "sCAL"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -435,6 +447,7 @@ png_uint_32 length; png_debug1(1, "in %s storage function", "sCAL"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -480,6 +493,7 @@ png_uint_32 res_x, png_uint_32 res_y, int unit_type) { png_debug1(1, "in %s storage function", "pHYs"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -496,6 +510,7 @@ { png_debug1(1, "in %s storage function", "PLTE"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -546,6 +561,7 @@ png_color_8p sig_bit) { png_debug1(1, "in %s storage function", "sBIT"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -559,6 +575,7 @@ png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) { png_debug1(1, "in %s storage function", "sRGB"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -586,6 +603,7 @@ int_green_y, int_blue_x, int_blue_y; #endif png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -655,6 +673,7 @@ png_uint_32 length; png_debug1(1, "in %s storage function", "iCCP"); + if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) return; @@ -869,6 +888,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) { png_debug1(1, "in %s storage function", "tIME"); + if (png_ptr == NULL || info_ptr == NULL || (png_ptr->mode & PNG_WROTE_tIME)) return; @@ -884,6 +904,7 @@ png_bytep trans, int num_trans, png_color_16p trans_values) { png_debug1(1, "in %s storage function", "tRNS"); + if (png_ptr == NULL || info_ptr == NULL) return; @@ -1008,7 +1029,7 @@ } #endif /* PNG_sPLT_SUPPORTED */ -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED void PNGAPI png_set_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns) @@ -1088,7 +1109,9 @@ { /* This function is deprecated in favor of png_permit_mng_features() and will be removed from libpng-1.3.0 */ + png_debug(1, "in png_permit_empty_plte, DEPRECATED."); + if (png_ptr == NULL) return; png_ptr->mng_features_permitted = (png_byte) @@ -1103,6 +1126,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) { png_debug(1, "in png_permit_mng_features"); + if (png_ptr == NULL) return (png_uint_32)0; png_ptr->mng_features_permitted = @@ -1164,8 +1188,10 @@ png_user_chunk_ptr read_user_chunk_fn) { png_debug(1, "in png_set_read_user_chunk_fn"); + if (png_ptr == NULL) return; + png_ptr->read_user_chunk_fn = read_user_chunk_fn; png_ptr->user_chunk_ptr = user_chunk_ptr; } Modified: haiku/trunk/src/libs/png/pngwutil.c =================================================================== --- haiku/trunk/src/libs/png/pngwutil.c 2009-11-08 23:22:57 UTC (rev 33955) +++ haiku/trunk/src/libs/png/pngwutil.c 2009-11-08 23:30:28 UTC (rev 33956) @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.2.39 [August 13, 2009] + * Last changed in libpng 1.2.40 [September 10, 2009] * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -102,6 +102,7 @@ png_debug2(0, "Writing %s chunk, length = %lu", chunk_name, (unsigned long)length); + if (png_ptr == NULL) return; @@ -398,6 +399,7 @@ png_byte buf[13]; /* Buffer to store the IHDR info */ png_debug(1, "in png_write_IHDR"); + /* Check that we have valid input data from the application info */ switch (color_type) { @@ -575,6 +577,7 @@ png_byte buf[3]; png_debug(1, "in png_write_PLTE"); + if (( #if defined(PNG_MNG_FEATURES_SUPPORTED) !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && @@ -634,6 +637,7 @@ #ifdef PNG_USE_LOCAL_ARRAYS PNG_IDAT; #endif + png_debug(1, "in png_write_IDAT"); /* Optimize the CMF field in the zlib stream. */ @@ -688,7 +692,9 @@ #ifdef PNG_USE_LOCAL_ARRAYS PNG_IEND; #endif + png_debug(1, "in png_write_IEND"); + png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL, (png_size_t)0); png_ptr->mode |= PNG_HAVE_IEND; @@ -707,6 +713,7 @@ png_byte buf[4]; png_debug(1, "in png_write_gAMA"); + /* file_gamma is saved in 1/100,000ths */ igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); png_save_uint_32(buf, igamma); @@ -723,6 +730,7 @@ png_byte buf[4]; png_debug(1, "in png_write_gAMA"); + /* file_gamma is saved in 1/100,000ths */ png_save_uint_32(buf, (png_uint_32)file_gamma); png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); @@ -741,6 +749,7 @@ png_byte buf[1]; png_debug(1, "in png_write_sRGB"); + if (srgb_intent >= PNG_sRGB_INTENT_LAST) png_warning(png_ptr, "Invalid sRGB rendering intent specified"); @@ -849,6 +858,7 @@ #endif png_debug(1, "in png_write_sPLT"); + if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0) return; @@ -922,6 +932,7 @@ png_size_t size; png_debug(1, "in png_write_sBIT"); + /* Make sure we don't depend upon the order of PNG_COLOR_8 */ if (color_type & PNG_COLOR_MASK_COLOR) { @@ -1029,6 +1040,7 @@ png_byte buf[32]; png_debug(1, "in png_write_cHRM"); + /* Each value is saved in 1/100,000ths */ #if !defined(PNG_NO_CHECK_cHRM) if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, @@ -1065,6 +1077,7 @@ png_byte buf[6]; png_debug(1, "in png_write_tRNS"); + if (color_type == PNG_COLOR_TYPE_PALETTE) { if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) @@ -1120,6 +1133,7 @@ png_byte buf[6]; png_debug(1, "in png_write_bKGD"); + if (color_type == PNG_COLOR_TYPE_PALETTE) { if ( @@ -1174,6 +1188,7 @@ png_byte buf[3]; png_debug(1, "in png_write_hIST"); + if (num_hist > (int)png_ptr->num_palette) { png_debug2(3, "num_hist = %d, num_palette = %d", num_hist, @@ -1214,6 +1229,7 @@ int kwarn=0; png_debug(1, "in png_check_keyword"); + *new_key = NULL; if (key == NULL || (key_len = png_strlen(key)) == 0) @@ -1337,6 +1353,7 @@ png_charp new_key; png_debug(1, "in png_write_tEXt"); + if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) return; @@ -1525,6 +1542,7 @@ png_byte buf[9]; png_debug(1, "in png_write_oFFs"); + if (unit_type >= PNG_OFFSET_LAST) png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); @@ -1551,6 +1569,7 @@ int i; png_debug1(1, "in png_write_pCAL (%d parameters)", nparams); + if (type >= PNG_EQUATION_LAST) png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); @@ -1684,6 +1703,7 @@ png_byte buf[9]; png_debug(1, "in png_write_pHYs"); + if (unit_type >= PNG_RESOLUTION_LAST) png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); @@ -1708,6 +1728,7 @@ png_byte buf[7]; png_debug(1, "in png_write_tIME"); + if (mod_time->month > 12 || mod_time->month < 1 || mod_time->day > 31 || mod_time->day < 1 || mod_time->hour > 23 || mod_time->second > 60) @@ -1752,6 +1773,7 @@ png_size_t buf_size; png_debug(1, "in png_write_start_row"); + buf_size = (png_size_t)(PNG_ROWBYTES( png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1); @@ -1852,6 +1874,7 @@ int ret; png_debug(1, "in png_write_finish_row"); + /* Next row */ png_ptr->row_number++; @@ -1961,6 +1984,7 @@ #endif png_debug(1, "in png_do_write_interlace"); + /* We don't have to do anything on the last pass (6) */ #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL && pass < 6) @@ -2133,8 +2157,6 @@ png_debug(1, "in png_write_find_filter"); - - png_debug(1, "in png_write_find_filter"); /* Find out how many bytes offset each pixel is */ bpp = (row_info->pixel_depth + 7) >> 3; @@ -2744,6 +2766,7 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) { png_debug(1, "in png_write_filtered_row"); + png_debug1(2, "filter = %d", filtered_row[0]); /* Set up the zlib input buffer */