diff -ru4NwbB libpng-1.2.42/png.c libpng-1.2.43beta04/png.c --- libpng-1.2.42/png.c 2010-01-02 23:04:19.598757954 -0600 +++ libpng-1.2.43beta04/png.c 2010-02-07 22:33:30.729743011 -0600 @@ -1,8 +1,8 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.2.42 [February 8, 2010] + * Last changed in libpng 1.2.43 [February 8, 2010] * Copyright (c) 1998-2010 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.) * @@ -77,9 +77,10 @@ PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ /* Mask to determine which pixels are valid in a pass */ -PNG_CONST int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; +PNG_CONST int FARDATA png_pass_mask[] = + {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; /* Mask to determine which pixels to overwrite while displaying */ PNG_CONST int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; @@ -686,10 +687,10 @@ wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"), ptime->day % 32, short_months[(ptime->month - 1) % 12], ptime->year, ptime->hour % 24, ptime->minute % 60, ptime->second % 61); - WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29, - NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, + 29, NULL, NULL); } #else #ifdef USE_FAR_KEYWORD { diff -ru4NwbB libpng-1.2.42/png.h libpng-1.2.43beta04/png.h --- libpng-1.2.42/png.h 2010-01-02 23:04:19.574120328 -0600 +++ libpng-1.2.43beta04/png.h 2010-02-07 22:33:30.705234807 -0600 @@ -253,8 +253,11 @@ * 1.2.42beta01-02 13 10242 12.so.0.42[.0] * 1.2.42rc01-05 13 10242 12.so.0.42[.0] * 1.0.52 10 10052 10.so.0.52[.0] * 1.2.42 13 10242 12.so.0.42[.0] + * 1.2.43beta01-03 13 10243 12.so.0.43[.0] + * 1.0.53rc01 10 10053 10.so.0.53[.0] + * 1.2.43rc01 13 10243 12.so.0.43[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The @@ -1272,9 +1275,18 @@ png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */ png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */ png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */ png_uint_32 rowbytes PNG_DEPSTRUCT; /* size of row in bytes */ - png_uint_32 irowbytes PNG_DEPSTRUCT; /* size of current interlaced row in bytes */ +#if 0 /* Replaced with the following in libpng-1.2.43 */ + png_size_t irowbytes PNG_DEPSTRUCT; +#endif +/* Added in libpng-1.2.43 */ +#ifdef PNG_USER_LIMITS_SUPPORTED + /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown + * chunks that can be stored (0 means unlimited). + */ + png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT; +#endif png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */ png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */ png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */ png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */ @@ -1504,9 +1516,9 @@ /* New members added in libpng-1.0.16 and 1.2.6 */ png_byte compression_type PNG_DEPSTRUCT; -#ifdef PNG_SET_USER_LIMITS_SUPPORTED +#ifdef PNG_USER_LIMITS_SUPPORTED png_uint_32 user_width_max PNG_DEPSTRUCT; png_uint_32 user_height_max PNG_DEPSTRUCT; #endif diff -ru4NwbB libpng-1.2.42/pngconf.h libpng-1.2.43beta04/pngconf.h --- libpng-1.2.42/pngconf.h 2010-01-02 23:04:19.583584354 -0600 +++ libpng-1.2.43beta04/pngconf.h 2010-02-07 22:33:30.714198209 -0600 @@ -621,24 +621,20 @@ # endif # ifndef PNG_NO_READ_BACKGROUND # define PNG_READ_BACKGROUND_SUPPORTED # endif -#ifndef PNG_1_0_X # ifndef PNG_NO_READ_16_TO_8 # define PNG_READ_16_TO_8_SUPPORTED # endif -#endif # ifndef PNG_NO_READ_FILLER # define PNG_READ_FILLER_SUPPORTED # endif # ifndef PNG_NO_READ_GAMMA # define PNG_READ_GAMMA_SUPPORTED # endif -#ifndef PNG_1_0_X # ifndef PNG_NO_READ_GRAY_TO_RGB # define PNG_READ_GRAY_TO_RGB_SUPPORTED # endif -#endif # ifndef PNG_NO_READ_SWAP_ALPHA # define PNG_READ_SWAP_ALPHA_SUPPORTED # endif # ifndef PNG_NO_READ_INVERT_ALPHA @@ -850,8 +846,15 @@ # endif # endif #endif /* PNG_1_0_X */ +/* Added at libpng-1.0.53 and 1.2.43 */ +#ifndef PNG_USER_LIMITS_SUPPORTED +# ifndef PNG_NO_USER_LIMITS +# define PNG_USER_LIMITS_SUPPORTED +# endif +#endif + /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter * how large, set these limits to 0x7fffffffL */ #ifndef PNG_USER_WIDTH_MAX @@ -860,13 +863,18 @@ #ifndef PNG_USER_HEIGHT_MAX # define PNG_USER_HEIGHT_MAX 1000000L #endif -#ifndef PNG_1_0_X -/* Added at libpng-1.2.41 */ +/* Added at libpng-1.2.43. To accept all valid PNGs no matter + * how large, set these two limits to 0. + */ #ifndef PNG_USER_CHUNK_CACHE_MAX -# define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL +# define PNG_USER_CHUNK_CACHE_MAX 0 #endif + +/* Added at libpng-1.2.43 */ +#ifndef PNG_USER_CHUNK_MALLOC_MAX +# define PNG_USER_CHUNK_MALLOC_MAX 0 #endif #ifndef PNG_LITERAL_SHARP # define PNG_LITERAL_SHARP 0x23 diff -ru4NwbB libpng-1.2.42/pngget.c libpng-1.2.43beta04/pngget.c --- libpng-1.2.42/pngget.c 2010-01-02 23:04:19.615604574 -0600 +++ libpng-1.2.43beta04/pngget.c 2010-02-07 22:33:30.747995862 -0600 @@ -1,9 +1,9 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.2.41 [December 3, 2009] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.43 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -871,15 +871,13 @@ return (png_ptr? png_ptr->user_chunk_ptr : NULL); } #endif -#ifdef PNG_WRITE_SUPPORTED png_uint_32 PNGAPI png_get_compression_buffer_size(png_structp png_ptr) { return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); } -#endif #ifdef PNG_ASSEMBLER_CODE_SUPPORTED #ifndef PNG_1_0_X /* This function was added to libpng 1.2.0 and should exist by default */ @@ -928,9 +926,10 @@ #endif /* ?PNG_1_0_X */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED -/* These functions were added to libpng 1.2.6 */ +/* These functions were added to libpng 1.2.6 but not enabled +* by default. They will be enabled in libpng-1.4.0 */ png_uint_32 PNGAPI png_get_user_width_max (png_structp png_ptr) { return (png_ptr? png_ptr->user_width_max : 0); diff -ru4NwbB libpng-1.2.42/pngmem.c libpng-1.2.43beta04/pngmem.c --- libpng-1.2.42/pngmem.c 2010-01-02 23:04:19.621920776 -0600 +++ libpng-1.2.43beta04/pngmem.c 2010-02-07 22:33:30.754607585 -0600 @@ -1,9 +1,9 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.2.41 [December 3, 2009] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.41 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -200,9 +200,9 @@ if (table == NULL) { #ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */ + png_error(png_ptr, "Out Of Memory."); /* Note "O", "M" */ else png_warning(png_ptr, "Out Of Memory."); #endif return (NULL); @@ -228,9 +228,9 @@ if (png_ptr->offset_table_ptr == NULL) { #ifndef PNG_USER_MEM_SUPPORTED if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */ + png_error(png_ptr, "Out Of memory."); /* Note "O", "m" */ else png_warning(png_ptr, "Out Of memory."); #endif return (NULL); diff -ru4NwbB libpng-1.2.42/pngpread.c libpng-1.2.43beta04/pngpread.c --- libpng-1.2.42/pngpread.c 2010-01-02 23:04:19.630442557 -0600 +++ libpng-1.2.43beta04/pngpread.c 2010-02-07 22:33:30.763287669 -0600 @@ -1,9 +1,9 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.2.42 [February 8, 2010] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.43 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -330,9 +330,11 @@ png_ptr->idat_size = png_ptr->push_length; png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->process_mode = PNG_READ_IDAT_MODE; png_push_have_info(png_ptr, info_ptr); - png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; + png_ptr->zstream.avail_out = + (uInt) PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; png_ptr->zstream.next_out = png_ptr->row_buf; return; } @@ -872,9 +874,11 @@ png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; break; } png_push_process_row(png_ptr); - png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; + png_ptr->zstream.avail_out = + (uInt) PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; png_ptr->zstream.next_out = png_ptr->row_buf; } else @@ -1140,11 +1144,8 @@ png_pass_inc[png_ptr->pass] - 1 - png_pass_start[png_ptr->pass]) / png_pass_inc[png_ptr->pass]; - png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, - png_ptr->iwidth) + 1; - if (png_ptr->transformations & PNG_INTERLACE) break; png_ptr->num_rows = (png_ptr->height + diff -ru4NwbB libpng-1.2.42/pngread.c libpng-1.2.43beta04/pngread.c --- libpng-1.2.42/pngread.c 2010-01-02 23:04:19.639538939 -0600 +++ libpng-1.2.43beta04/pngread.c 2010-02-07 22:33:30.772355145 -0600 @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.41 [December 3, 2009] + * Last changed in libpng 1.2.43 [February 8, 2010] * 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.) * @@ -30,9 +30,11 @@ return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn, warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL)); } -/* Alternate create PNG structure for reading, and allocate any memory needed. */ +/* Alternate create PNG structure for reading, and allocate any memory + * needed. + */ png_structp PNGAPI png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn) @@ -63,11 +65,19 @@ if (png_ptr == NULL) return (NULL); /* Added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED +#ifdef PNG_USER_LIMITS_SUPPORTED png_ptr->user_width_max = PNG_USER_WIDTH_MAX; png_ptr->user_height_max = PNG_USER_HEIGHT_MAX; +# ifdef PNG_USER_CHUNK_CACHE_MAX + /* Added at libpng-1.2.43 and 1.4.0 */ + png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX; +# endif +# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX + /* Added at libpng-1.2.43 and 1.4.1 */ + png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX; +# endif #endif #ifdef PNG_SETJMP_SUPPORTED #ifdef USE_FAR_KEYWORD @@ -230,18 +240,20 @@ #ifdef PNG_ERROR_NUMBERS_SUPPORTED png_ptr->flags = 0; #endif png_error(png_ptr, - "The png struct allocated by the application for reading is too small."); + "The png struct allocated by the application for reading is" + " too small."); } if (png_sizeof(png_info) > png_info_size) { png_ptr->error_fn = NULL; #ifdef PNG_ERROR_NUMBERS_SUPPORTED png_ptr->flags = 0; #endif png_error(png_ptr, - "The info struct allocated by application for reading is too small."); + "The info struct allocated by application for reading is" + " too small."); } png_read_init_3(&png_ptr, user_png_ver, png_struct_size); } #endif /* PNG_1_0_X || PNG_1_2_X */ @@ -269,9 +281,10 @@ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; #else png_ptr->warning_fn = NULL; png_warning(png_ptr, - "Application uses deprecated png_read_init() and should be recompiled."); + "Application uses deprecated png_read_init() and should be" + " recompiled."); break; #endif } } while (png_libpng_ver[i++]); @@ -316,9 +329,10 @@ switch (inflateInit(&png_ptr->zstream)) { case Z_OK: /* Do nothing */ break; case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break; - case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); break; + case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); + break; default: png_error(png_ptr, "Unknown zlib error"); } png_ptr->zstream.next_out = png_ptr->zbuf; @@ -608,9 +622,10 @@ #if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED) if (png_ptr->transformations & PNG_FILLER) png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined."); #endif -#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && !defined(PNG_READ_PACKSWAP_SUPPORTED) +#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \ + !defined(PNG_READ_PACKSWAP_SUPPORTED) if (png_ptr->transformations & PNG_PACKSWAP) png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined."); #endif #if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED) @@ -711,9 +726,11 @@ if (!(png_ptr->mode & PNG_HAVE_IDAT)) png_error(png_ptr, "Invalid attempt to read row data"); png_ptr->zstream.next_out = png_ptr->row_buf; - png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; + png_ptr->zstream.avail_out = + (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1); do { if (!(png_ptr->zstream.avail_in)) { @@ -1178,9 +1195,10 @@ } /* Free all memory used by the read (old method) */ void /* PRIVATE */ -png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) +png_read_destroy(png_structp png_ptr, png_infop info_ptr, + png_infop end_info_ptr) { #ifdef PNG_SETJMP_SUPPORTED jmp_buf tmp_jmp; #endif diff -ru4NwbB libpng-1.2.42/pngrio.c libpng-1.2.43beta04/pngrio.c --- libpng-1.2.42/pngrio.c 2010-01-02 23:04:19.644531909 -0600 +++ libpng-1.2.43beta04/pngrio.c 2010-02-07 22:33:30.777425777 -0600 @@ -1,9 +1,9 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.2.41 [December 3, 2009] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.43 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -91,9 +91,10 @@ io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); if ((png_bytep)n_data == data) { #ifdef _WIN32_WCE - if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) + if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, + NULL) ) check = 0; #else check = fread(n_data, 1, length, io_ptr); #endif diff -ru4NwbB libpng-1.2.42/pngrtran.c libpng-1.2.43beta04/pngrtran.c --- libpng-1.2.42/pngrtran.c 2010-01-02 23:04:19.660071212 -0600 +++ libpng-1.2.43beta04/pngrtran.c 2010-02-07 22:33:30.793222200 -0600 @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.42 [February 8, 2010] + * Last changed in libpng 1.2.43 [February 8, 2010] * Copyright (c) 1998-2010 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.) * @@ -431,10 +431,12 @@ [num_new_palette]] = png_ptr->index_to_palette[j]; png_ptr->palette_to_index[png_ptr->index_to_palette[j]] = png_ptr->palette_to_index[num_new_palette]; - png_ptr->index_to_palette[j] = (png_byte)num_new_palette; - png_ptr->palette_to_index[num_new_palette] = (png_byte)j; + png_ptr->index_to_palette[j] = + (png_byte)num_new_palette; + png_ptr->palette_to_index[num_new_palette] = + (png_byte)j; } if (num_new_palette <= maximum_colors) break; } @@ -501,9 +503,10 @@ for (ir = 0; ir < num_red; ir++) { /* int dr = abs(ir - r); */ int dr = ((ir > r) ? ir - r : r - ir); - int index_r = (ir << (PNG_DITHER_BLUE_BITS + PNG_DITHER_GREEN_BITS)); + int index_r = (ir << (PNG_DITHER_BLUE_BITS + + PNG_DITHER_GREEN_BITS)); for (ig = 0; ig < num_green; ig++) { /* int dg = abs(ig - g); */ @@ -771,10 +774,11 @@ #ifdef PNG_USELESS_TESTS_SUPPORTED if (png_ptr != NULL) #endif { -#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \ - || defined(PNG_READ_GAMMA_SUPPORTED) +#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ + defined(PNG_READ_SHIFT_SUPPORTED) || \ + defined(PNG_READ_GAMMA_SUPPORTED) int color_type = png_ptr->color_type; #endif #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) @@ -969,9 +973,10 @@ { back.red = (png_byte)(pow( (double)png_ptr->background.red/%F255%, gs) * 255.0 + .5); back.green = (png_byte)(pow( - (double)png_ptr->background.green/%F255%, gs) * 255.0 + .5); + (double)png_ptr->background.green/%F255%, gs) * 255.0 + + .5); back.blue = (png_byte)(pow( (double)png_ptr->background.blue/%F255%, gs) * 255.0 + .5); } @@ -1383,9 +1388,10 @@ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED if (png_ptr->transformations & PNG_RGB_TO_GRAY) { int rgb_error = - png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1); + png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), + png_ptr->row_buf + 1); if (rgb_error) { png_ptr->rgb_to_gray_status=1; if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == @@ -2395,9 +2401,10 @@ else { png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> png_ptr->gamma_shift][red>>8]; - png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> + png_uint_16 green_1 = + png_ptr->gamma_16_to_1[(green&0xff) >> png_ptr->gamma_shift][green>>8]; png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> png_ptr->gamma_shift][blue>>8]; png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1 @@ -2492,9 +2499,10 @@ else { png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> png_ptr->gamma_shift][red>>8]; - png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> + png_uint_16 green_1 = + png_ptr->gamma_16_to_1[(green&0xff) >> png_ptr->gamma_shift][green>>8]; png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> png_ptr->gamma_shift][blue>>8]; png_uint_16 gray16 = (png_uint_16)((rc * red_1 @@ -2596,17 +2604,19 @@ } } /* This function is currently unused. Do we really need it? */ -#if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED) +#if defined(PNG_READ_DITHER_SUPPORTED) && \ + defined(PNG_CORRECT_PALETTE_SUPPORTED) void /* PRIVATE */ png_correct_palette(png_structp png_ptr, png_colorp palette, int num_palette) { png_debug(1, "in png_correct_palette"); #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ - defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) + defined(PNG_READ_GAMMA_SUPPORTED) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND)) { png_color back, back_1; @@ -2625,10 +2635,10 @@ double g; g = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma); - if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_SCREEN || - fabs(g - 1.0) < PNG_GAMMA_THRESHOLD) + if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_SCREEN + || fabs(g - 1.0) < PNG_GAMMA_THRESHOLD) { back.red = png_ptr->background.red; back.green = png_ptr->background.green; back.blue = png_ptr->background.blue; diff -ru4NwbB libpng-1.2.42/pngrutil.c libpng-1.2.43beta04/pngrutil.c --- libpng-1.2.42/pngrutil.c 2010-01-02 23:04:19.673407448 -0600 +++ libpng-1.2.43beta04/pngrutil.c 2010-02-07 22:33:30.806694888 -0600 @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.41 [December 3, 2009] + * Last changed in libpng 1.2.43 [February 8, 2010] * 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,9 +25,10 @@ #ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef WIN32_WCE_OLD /* The strtod() function is not supported on WindowsCE */ -__inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, char **endptr) +__inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, + char **endptr) { double result = 0; int len; wchar_t *str, *end; @@ -216,8 +217,74 @@ } #if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ defined(PNG_READ_iCCP_SUPPORTED) +png_size_t +png_measure_decompressed_chunk(png_structp png_ptr, int comp_type, + png_size_t chunklength, png_size_t prefix_size) +{ + png_charp text; + png_charp test = "X"; + png_size_t text_size = 0; + + if (comp_type == PNG_COMPRESSION_TYPE_BASE) + { + int ret = Z_OK; + + png_ptr->zstream.next_in = (png_bytep)(png_ptr->chunkdata + prefix_size); + png_ptr->zstream.avail_in = (uInt)(chunklength - prefix_size); + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + + text = NULL; + + while (png_ptr->zstream.avail_in) + { + ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); + if (ret != Z_OK && ret != Z_STREAM_END) + { + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + break; + } + if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END) + { + if (text == NULL) /* Initialize the decompression buffer */ + { + text_size = prefix_size + + png_ptr->zbuf_size - png_ptr->zstream.avail_out; + + text=test; + } + else /* Enlarge the decompression buffer */ + { + text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; +#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED + if (png_ptr->user_chunk_malloc_max && + (text_size >= png_ptr->user_chunk_malloc_max - 1)) +#else + if ((PNG_USER_CHUNK_MALLOC_MAX > 0) && + text_size >= PNG_USER_CHUNK_MALLOC_MAX - 1) +#endif + return 0; + } + } + if (ret == Z_STREAM_END) + break; + + else + { + png_ptr->zstream.next_out = png_ptr->zbuf; + png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; + } + } + + inflateReset(&png_ptr->zstream); + png_ptr->zstream.avail_in = 0; + } + return text_size; +} + /* * Decompress trailing data in a chunk. The assumption is that chunkdata * points at an allocated area holding the contents of a chunk with a * trailing compressed part. What we get back is an allocated area @@ -231,19 +298,31 @@ { static PNG_CONST char msg[] = "Error decoding compressed chunk"; png_charp text; png_size_t text_size; + png_size_t expanded_size; + + expanded_size= png_measure_decompressed_chunk(png_ptr, comp_type, + chunklength, prefix_size); + if (expanded_size == 0) + { + *newlength=0; + return; + } if (comp_type == PNG_COMPRESSION_TYPE_BASE) { int ret = Z_OK; + png_size_t buffer_size; + png_ptr->zstream.next_in = (png_bytep)(png_ptr->chunkdata + prefix_size); png_ptr->zstream.avail_in = (uInt)(chunklength - prefix_size); png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; text_size = 0; text = NULL; + buffer_size = 0; while (png_ptr->zstream.avail_in) { ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); @@ -261,11 +340,12 @@ text_size = prefix_size + png_sizeof(msg) + 1; text = (png_charp)png_malloc_warn(png_ptr, text_size); if (text == NULL) { - png_free(png_ptr, png_ptr->chunkdata); - png_ptr->chunkdata = NULL; - png_error(png_ptr, "Not enough memory to decompress chunk"); + png_error(png_ptr, + "Not enough memory to decompress chunk"); + text_size = 0; + break; } png_memcpy(text, png_ptr->chunkdata, prefix_size); } @@ -273,57 +353,40 @@ /* Copy what we can of the error message into the text chunk */ text_size = (png_size_t)(chunklength - (text - png_ptr->chunkdata) - 1); + if (text_size > png_sizeof(msg)) text_size = png_sizeof(msg); + png_memcpy(text + prefix_size, msg, text_size); + buffer_size = text_size; break; } if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END) { - if (text == NULL) + if (text == NULL) /* Initialize the decompression buffer */ { - text_size = prefix_size + - png_ptr->zbuf_size - png_ptr->zstream.avail_out; + text_size = expanded_size; + text = (png_charp)png_malloc_warn(png_ptr, text_size + 1); if (text == NULL) { - png_free(png_ptr, png_ptr->chunkdata); - png_ptr->chunkdata = NULL; png_error(png_ptr, "Not enough memory to decompress chunk."); + text_size = 0; + break; } png_memcpy(text + prefix_size, png_ptr->zbuf, text_size - prefix_size); png_memcpy(text, png_ptr->chunkdata, prefix_size); *(text + text_size) = 0x00; + buffer_size = text_size; } - else - { - png_charp tmp; - - tmp = text; - text = (png_charp)png_malloc_warn(png_ptr, - (png_uint_32)(text_size + - png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1)); - if (text == NULL) - { - png_free(png_ptr, tmp); - png_free(png_ptr, png_ptr->chunkdata); - png_ptr->chunkdata = NULL; - png_error(png_ptr, - "Not enough memory to decompress chunk.."); - } - png_memcpy(text, tmp, text_size); - png_free(png_ptr, tmp); - png_memcpy(text + text_size, png_ptr->zbuf, - (png_ptr->zbuf_size - png_ptr->zstream.avail_out)); - text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; - *(text + text_size) = 0x00; } if (ret == Z_STREAM_END) break; + else { png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; @@ -328,9 +391,9 @@ png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; } } - } + if (ret != Z_STREAM_END) { #if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) char umsg[52]; @@ -362,9 +425,9 @@ if (text == NULL) { png_free(png_ptr, png_ptr->chunkdata); png_ptr->chunkdata = NULL; - png_error(png_ptr, "Not enough memory for text."); + png_error(png_ptr, "Not enough memory for text"); } png_memcpy(text, png_ptr->chunkdata, prefix_size); } *(text + text_size) = 0x00; @@ -1136,8 +1199,26 @@ png_size_t slength; png_debug(1, "in png_handle_sPLT"); +#ifdef PNG_USER_LIMITS_SUPPORTED + + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for sPLT"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before sPLT"); else if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -1168,9 +1249,10 @@ } png_ptr->chunkdata[slength] = 0x00; - for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; entry_start++) + for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; + entry_start++) /* Empty loop to find end of name */ ; ++entry_start; /* A sample depth should follow the separator, and we should be on it */ @@ -1922,8 +2004,25 @@ int ret; png_debug(1, "in png_handle_tEXt"); +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for tEXt"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before tEXt"); if (png_ptr->mode & PNG_HAVE_IDAT) @@ -2007,8 +2106,25 @@ png_size_t slength, prefix_len, data_len; png_debug(1, "in png_handle_zTXt"); +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for zTXt"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before zTXt"); if (png_ptr->mode & PNG_HAVE_IDAT) @@ -2111,8 +2227,25 @@ png_size_t slength, prefix_len, data_len; png_debug(1, "in png_handle_iTXt"); +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for iTXt"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before iTXt"); if (png_ptr->mode & PNG_HAVE_IDAT) @@ -2238,8 +2371,25 @@ png_uint_32 skip = 0; png_debug(1, "in png_handle_unknown"); +#ifdef PNG_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_cache_max != 0) + { + if (png_ptr->user_chunk_cache_max == 1) + { + png_crc_finish(png_ptr, length); + return; + } + if (--png_ptr->user_chunk_cache_max == 1) + { + png_warning(png_ptr, "No space in chunk cache for unknown chunk"); + png_crc_finish(png_ptr, length); + return; + } + } +#endif + if (png_ptr->mode & PNG_HAVE_IDAT) { #ifdef PNG_USE_LOCAL_ARRAYS PNG_CONST PNG_IDAT; @@ -2278,9 +2428,10 @@ #endif png_memcpy((png_charp)png_ptr->unknown_chunk.name, (png_charp)png_ptr->chunk_name, png_sizeof(png_ptr->unknown_chunk.name)); - png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0'; + png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] + = '\0'; png_ptr->unknown_chunk.size = (png_size_t)length; if (length == 0) png_ptr->unknown_chunk.data = NULL; else @@ -2750,9 +2901,10 @@ } default: { png_size_t pixel_bytes = (row_info->pixel_depth >> 3); - png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes; + png_bytep sp = row + (png_size_t)(row_info->width - 1) + * pixel_bytes; png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; int jstop = png_pass_inc[pass]; png_uint_32 i; @@ -2945,11 +3097,8 @@ png_pass_inc[png_ptr->pass] - 1 - png_pass_start[png_ptr->pass]) / png_pass_inc[png_ptr->pass]; - png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, - png_ptr->iwidth) + 1; - if (!(png_ptr->transformations & PNG_INTERLACE)) { png_ptr->num_rows = (png_ptr->height + png_pass_yinc[png_ptr->pass] - 1 - @@ -3074,18 +3223,14 @@ png_ptr->iwidth = (png_ptr->width + png_pass_inc[png_ptr->pass] - 1 - png_pass_start[png_ptr->pass]) / png_pass_inc[png_ptr->pass]; - - png_ptr->irowbytes = - PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1; } else #endif /* PNG_READ_INTERLACING_SUPPORTED */ { png_ptr->num_rows = png_ptr->height; png_ptr->iwidth = png_ptr->width; - png_ptr->irowbytes = png_ptr->rowbytes + 1; } max_pixel_depth = png_ptr->pixel_depth; #ifdef PNG_READ_PACK_SUPPORTED @@ -3240,9 +3385,10 @@ png_debug1(3, "height = %lu,", png_ptr->height); png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); - png_debug1(3, "irowbytes = %lu", png_ptr->irowbytes); + png_debug1(3, "irowbytes = %lu", + PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1); png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ diff -ru4NwbB libpng-1.2.42/pngset.c libpng-1.2.43beta04/pngset.c --- libpng-1.2.42/pngset.c 2010-01-02 23:04:19.681601636 -0600 +++ libpng-1.2.43beta04/pngset.c 2010-02-07 22:33:30.814903043 -0600 @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.42 [February 8, 2010] + * Last changed in libpng 1.2.43 [February 8, 2010] * Copyright (c) 1998-2010 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.) * @@ -1143,9 +1143,8 @@ info_ptr->valid |= PNG_INFO_IDAT; } #endif -#ifdef PNG_WRITE_SUPPORTED void PNGAPI png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) { @@ -1156,9 +1155,8 @@ png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size); png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; } -#endif void PNGAPI png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) { diff -ru4NwbB libpng-1.2.42/pngtest.c libpng-1.2.43beta04/pngtest.c --- libpng-1.2.42/pngtest.c 2010-01-02 23:04:19.690626211 -0600 +++ libpng-1.2.43beta04/pngtest.c 2010-02-07 22:33:30.823793065 -0600 @@ -1,9 +1,9 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.2.41 [December 3, 2009] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.43 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -718,9 +718,10 @@ row_buf = NULL; #ifdef _WIN32_WCE MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); - if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) + if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, + NULL)) == INVALID_HANDLE_VALUE) #else if ((fpin = fopen(inname, "rb")) == NULL) #endif { @@ -729,9 +730,10 @@ } #ifdef _WIN32_WCE MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH); - if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL)) == INVALID_HANDLE_VALUE) + if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + 0, NULL)) == INVALID_HANDLE_VALUE) #else if ((fpout = fopen(outname, "wb")) == NULL) #endif { @@ -919,10 +921,10 @@ #ifdef 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)) + 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)) { png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); } @@ -1072,9 +1074,10 @@ if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width, &scal_height)) { - png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, scal_height); + png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, + scal_height); } } #endif #endif @@ -1356,9 +1359,10 @@ png_debug(0, "Opening files for comparison"); #ifdef _WIN32_WCE MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); - if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) + if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, + 0, NULL)) == INVALID_HANDLE_VALUE) #else if ((fpin = fopen(inname, "rb")) == NULL) #endif { @@ -1367,9 +1371,10 @@ } #ifdef _WIN32_WCE MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH); - if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) + if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, + 0, NULL)) == INVALID_HANDLE_VALUE) #else if ((fpout = fopen(outname, "rb")) == NULL) #endif { @@ -1535,16 +1540,16 @@ int allocation_now = current_allocation; #endif for (i=2; imode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) + if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \ + (png_ptr->mng_features_permitted)) { png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); png_ptr->mng_features_permitted = 0; } @@ -638,18 +639,20 @@ #ifdef PNG_ERROR_NUMBERS_SUPPORTED png_ptr->flags = 0; #endif png_error(png_ptr, - "The png struct allocated by the application for writing is too small."); + "The png struct allocated by the application for writing is" + " too small."); } if (png_sizeof(png_info) > png_info_size) { png_ptr->error_fn = NULL; #ifdef PNG_ERROR_NUMBERS_SUPPORTED png_ptr->flags = 0; #endif png_error(png_ptr, - "The info struct allocated by the application for writing is too small."); + "The info struct allocated by the application for writing is" + " too small."); } png_write_init_3(&png_ptr, user_png_ver, png_struct_size); } #endif /* PNG_1_0_X || PNG_1_2_X */ @@ -802,17 +805,21 @@ /* Check for transforms that have been set but were defined out */ #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) if (png_ptr->transformations & PNG_INVERT_MONO) - png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined."); + png_warning(png_ptr, + "PNG_WRITE_INVERT_SUPPORTED is not defined."); #endif #if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED) if (png_ptr->transformations & PNG_FILLER) - png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined."); + png_warning(png_ptr, + "PNG_WRITE_FILLER_SUPPORTED is not defined."); #endif -#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED) +#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \ + defined(PNG_READ_PACKSWAP_SUPPORTED) if (png_ptr->transformations & PNG_PACKSWAP) - png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined."); + png_warning(png_ptr, + "PNG_WRITE_PACKSWAP_SUPPORTED is not defined."); #endif #if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED) if (png_ptr->transformations & PNG_PACK) png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined."); @@ -1065,9 +1072,9 @@ if (png_ptr != NULL) { png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); -#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED +#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED if (png_ptr->num_chunk_list) { png_free(png_ptr, png_ptr->chunk_list); png_ptr->chunk_list = NULL; diff -ru4NwbB libpng-1.2.42/pngwtran.c libpng-1.2.43beta04/pngwtran.c --- libpng-1.2.42/pngwtran.c 2010-01-02 23:04:19.722154917 -0600 +++ libpng-1.2.43beta04/pngwtran.c 2010-02-07 22:33:30.855360183 -0600 @@ -1,9 +1,9 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.2.41 [December 3, 2009] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.43 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -29,9 +29,10 @@ #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED if (png_ptr->transformations & PNG_USER_TRANSFORM) if (png_ptr->write_user_transform_fn != NULL) - (*(png_ptr->write_user_transform_fn)) /* User write transform function */ + (*(png_ptr->write_user_transform_fn)) /* User write transform + function */ (png_ptr, /* png_ptr */ &(png_ptr->row_info), /* row_info: */ /* png_uint_32 width; width of row */ /* png_uint_32 rowbytes; number of bytes in row */ diff -ru4NwbB libpng-1.2.42/pngwutil.c libpng-1.2.43beta04/pngwutil.c --- libpng-1.2.42/pngwutil.c 2010-01-02 23:04:19.733499388 -0600 +++ libpng-1.2.43beta04/pngwutil.c 2010-02-07 22:33:30.866835964 -0600 @@ -1,9 +1,9 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.2.41 [December 3, 2009] - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Last changed in libpng 1.2.43 [February 8, 2010] + * Copyright (c) 1998-2010 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.) * * This code is released under the libpng license. @@ -412,9 +412,10 @@ case 2: case 4: case 8: case 16: png_ptr->channels = 1; break; - default: png_error(png_ptr, "Invalid bit depth for grayscale image"); + default: png_error(png_ptr, + "Invalid bit depth for grayscale image"); } break; case PNG_COLOR_TYPE_RGB: if (bit_depth != 8 && bit_depth != 16) @@ -617,9 +618,11 @@ buf[2] = pal_ptr->blue; png_write_chunk_data(png_ptr, buf, (png_size_t)3); } #else - /* This is a little slower but some buggy compilers need to do this instead */ + /* This is a little slower but some buggy compilers need to do this + * instead + */ pal_ptr=palette; for (i = 0; i < num_pal; i++) { buf[0] = pal_ptr[i].red; @@ -1639,9 +1642,10 @@ wchar_t wc_buf[32]; size_t wc_len; swprintf(wc_buf, TEXT("%12.12e"), width); wc_len = wcslen(wc_buf); - WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + 1, wc_len, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + 1, wc_len, NULL, + NULL); total_len = wc_len + 2; swprintf(wc_buf, TEXT("%12.12e"), height); wc_len = wcslen(wc_buf); WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + total_len, wc_len, diff -ru4NwbB libpng-1.2.42/projects/xcode/libpng.xcodeproj/project.pbxproj libpng-1.2.43beta04/projects/xcode/libpng.xcodeproj/project.pbxproj --- libpng-1.2.42/projects/xcode/libpng.xcodeproj/project.pbxproj 2010-01-02 23:04:21.117778995 -0600 +++ libpng-1.2.43beta04/projects/xcode/libpng.xcodeproj/project.pbxproj 2010-02-07 22:33:32.069489764 -0600 @@ -221,9 +221,9 @@ buildSettings = { COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 3; DYLIB_CURRENT_VERSION = 3; - FRAMEWORK_VERSION = 1.2.42; + FRAMEWORK_VERSION = 1.2.43beta04; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; @@ -239,9 +239,9 @@ isa = XCBuildConfiguration; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 3; DYLIB_CURRENT_VERSION = 3; - FRAMEWORK_VERSION = 1.2.42; + FRAMEWORK_VERSION = 1.2.43beta04; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks";