diff -ru4NwbB libpng-1.2.35/contrib/pngminim/decoder/gather.sh libpng-1.2.36rc01/contrib/pngminim/decoder/gather.sh --- libpng-1.2.35/contrib/pngminim/decoder/gather.sh 2007-12-07 12:22:01.000000000 -0600 +++ libpng-1.2.36rc01/contrib/pngminim/decoder/gather.sh 2009-04-13 10:40:06.656290000 -0500 @@ -1,8 +1,8 @@ cp ../../pngminus/png2pnm.c pngm2pnm.c cp ../../../*.h . cp ../../../*.c . -rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.c +rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.c pngw*.c # change the following 2 lines if zlib is somewhere else cp ../../../../zlib/*.h . cp ../../../../zlib/*.c . rm minigzip.c example.c compress.c deflate.c diff -ru4NwbB libpng-1.2.35/contrib/pngminim/decoder/pngusr.h libpng-1.2.36rc01/contrib/pngminim/decoder/pngusr.h --- libpng-1.2.35/contrib/pngminim/decoder/pngusr.h 2007-08-19 22:30:16.000000000 -0500 +++ libpng-1.2.36rc01/contrib/pngminim/decoder/pngusr.h 2009-03-24 11:47:00.236362000 -0500 @@ -6,8 +6,12 @@ #ifndef MINRDPNGCONF_H #define MINRDPNGCONF_H +#ifdef NJET + /* No 16-bit support beyond reading with strip_16 */ +#endif + #define PNG_NO_GLOBAL_ARRAYS #define PNG_NO_WARNINGS #define png_warning(s1,s2) "" diff -ru4NwbB libpng-1.2.35/contrib/pngminim/encoder/gather.sh libpng-1.2.36rc01/contrib/pngminim/encoder/gather.sh --- libpng-1.2.35/contrib/pngminim/encoder/gather.sh 2007-12-07 12:22:16.000000000 -0600 +++ libpng-1.2.36rc01/contrib/pngminim/encoder/gather.sh 2009-04-13 10:40:16.994507000 -0500 @@ -1,8 +1,8 @@ cp ../../pngminus/pnm2png.c pnm2pngm.c cp ../../../*.h . cp ../../../*.c . -rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c +rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c pngpread.c # Change the next 2 lines if zlib is somewhere else. cp ../../../../zlib/*.h . cp ../../../../zlib/*.c . rm inf*.[ch] diff -ru4NwbB libpng-1.2.35/contrib/pngminim/encoder/pngusr.h libpng-1.2.36rc01/contrib/pngminim/encoder/pngusr.h --- libpng-1.2.35/contrib/pngminim/encoder/pngusr.h 2007-08-27 23:31:31.000000000 -0500 +++ libpng-1.2.36rc01/contrib/pngminim/encoder/pngusr.h 2009-03-20 08:13:44.702495000 -0500 @@ -50,8 +50,9 @@ #define PNG_NO_WRITE_OPT_PLTE #define PNG_NO_WRITE_FILTER #define PNG_NO_WRITE_WEIGHTED_FILTER #define PNG_NO_WRITE_INTERLACING_SUPPORTED +#define PNG_NO_WRITE_FLUSH #define PNG_NO_INFO_IMAGE #define PNG_NO_USER_MEM #define PNG_NO_FIXED_POINT_SUPPORTED diff -ru4NwbB libpng-1.2.35/example.c libpng-1.2.36rc01/example.c --- libpng-1.2.35/example.c 2009-02-14 15:59:26.552153830 -0600 +++ libpng-1.2.36rc01/example.c 2009-04-30 06:02:34.408437599 -0500 @@ -1,9 +1,9 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.2.35 [April 30, 2009] + * Last changed in libpng 1.2.36 [April 30, 2009] * This file has been placed in the public domain by the authors. * Maintained 1998-2009 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -598,9 +598,9 @@ * error handling functions in the png_create_write_struct() call. */ if (setjmp(png_jmpbuf(png_ptr))) { - /* If we get here, we had a problem reading the file */ + /* If we get here, we had a problem writing the file */ fclose(fp); png_destroy_write_struct(&png_ptr, &info_ptr); return (ERROR); } @@ -693,9 +693,9 @@ * png_write_info_before_PLTE(write_ptr, write_info_ptr); * write_my_chunk(); * png_write_info(png_ptr, info_ptr); * - * However, given the level of known- and unknown-chunk support in 1.1.0 + * However, given the level of known- and unknown-chunk support in 1.2.0 * and up, this should no longer be necessary. */ /* Once we write out the header, the compression type on the text diff -ru4NwbB libpng-1.2.35/png.h libpng-1.2.36rc01/png.h --- libpng-1.2.35/png.h 2009-02-14 15:59:26.535979077 -0600 +++ libpng-1.2.36rc01/png.h 2009-04-30 06:02:34.392443125 -0500 @@ -221,8 +221,10 @@ * 1.0.43rc01-02 10 10043 10.so.0.43[.0] * 1.2.35rc01-02 13 10235 12.so.0.35[.0] * 1.0.43 10 10043 10.so.0.43[.0] * 1.2.35 13 10235 12.so.0.35[.0] + * 1.2.36beta01-05 13 10236 12.so.0.36[.0] + * 1.2.36rc01 13 10236 12.so.0.36[.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 @@ -251,9 +253,9 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * * libpng versions 1.2.6, August 15, 2004, through 1.2.36rc01, April 30, 2009, are - * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and 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: * * Cosmin Truta @@ -1986,8 +1988,13 @@ /* Replace the default data output functions with a user supplied one(s). * If buffered output is not used, then output_flush_fn can be set to NULL. * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time * output_flush_fn will be ignored (and thus can be NULL). + * It is probably a mistake to use NULL for output_flush_fn if + * write_data_fn is not also NULL unless you have built libpng with + * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's + * default flush function, which uses the standard *FILE structure, will + * be used. */ extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); @@ -2555,13 +2562,14 @@ #else /* PNG_DEBUG_FILE || !_MSC_VER */ #ifndef PNG_DEBUG_FILE #define PNG_DEBUG_FILE stderr #endif /* PNG_DEBUG_FILE */ + #if (PNG_DEBUG > 1) -#ifndef png_debug /* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on * non-ISO compilers */ #ifdef __STDC__ +# ifndef png_debug #define png_debug(l,m) \ { \ int num_tabs=l; \ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ @@ -2586,35 +2594,42 @@ #endif #else /* __STDC __ */ #ifndef png_debug #define png_debug(l,m) \ + { \ int num_tabs=l; \ char format[256]; \ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ m,PNG_STRING_NEWLINE); \ - fprintf(PNG_DEBUG_FILE,format); + fprintf(PNG_DEBUG_FILE,format); \ + } #endif #ifndef png_debug1 #define png_debug1(l,m,p1) \ + { \ int num_tabs=l; \ char format[256]; \ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ m,PNG_STRING_NEWLINE); \ - fprintf(PNG_DEBUG_FILE,format,p1); + fprintf(PNG_DEBUG_FILE,format,p1); \ + } #endif #ifndef png_debug2 #define png_debug2(l,m,p1,p2) \ + { \ int num_tabs=l; \ char format[256]; \ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ m,PNG_STRING_NEWLINE); \ - fprintf(PNG_DEBUG_FILE,format,p1,p2); + fprintf(PNG_DEBUG_FILE,format,p1,p2); \ + } #endif #endif /* __STDC __ */ #endif /* (PNG_DEBUG > 1) */ + #endif /* _MSC_VER */ #endif /* (PNG_DEBUG > 0) */ #endif /* PNG_DEBUG */ #ifndef png_debug @@ -2707,8 +2722,9 @@ #if !defined(PNG_1_0_X) /* png.c, pnggccrd.c, or pngvcrd.c */ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); +#endif /* PNG_1_0_X */ #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ /* Strip the prepended error numbers ("#nnn ") from error and warning * messages before passing them to the error or warning handler. */ @@ -2716,10 +2732,8 @@ extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp png_ptr, png_uint_32 strip_mode)); #endif -#endif /* PNG_1_0_X */ - /* Added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); diff -ru4NwbB libpng-1.2.35/pngconf.h libpng-1.2.36rc01/pngconf.h --- libpng-1.2.35/pngconf.h 2009-02-14 15:59:26.544632620 -0600 +++ libpng-1.2.36rc01/pngconf.h 2009-04-30 06:02:34.401097801 -0500 @@ -313,10 +313,17 @@ #ifdef PNG_SETJMP_SUPPORTED /* This is an attempt to force a single setjmp behaviour on Linux. If * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. + * + * You can bypass this test if you know that your application uses exactly + * the same setjmp.h that was included when libpng was built. Only define + * PNG_SKIP_SETJMP_CHECK while building your application, prior to the + * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK + * while building a separate libpng library for general use. */ +# ifndef PNG_SKIP_SETJMP_CHECK # ifdef __linux__ # ifdef _BSD_SOURCE # define PNG_SAVE_BSD_SOURCE # undef _BSD_SOURCE @@ -324,12 +331,13 @@ # ifdef _SETJMP_H /* If you encounter a compiler error here, see the explanation * near the end of INSTALL. */ - __pngconf.h__ already includes setjmp.h; + __pngconf.h__ in libpng already includes setjmp.h; __dont__ include it again.; # endif # endif /* __linux__ */ +# endif /* PNG_SKIP_SETJMP_CHECK */ /* include setjmp.h for error handling */ # include diff -ru4NwbB libpng-1.2.35/pngerror.c libpng-1.2.36rc01/pngerror.c --- libpng-1.2.35/pngerror.c 2009-02-14 15:59:26.564665362 -0600 +++ libpng-1.2.36rc01/pngerror.c 2009-04-30 06:02:34.421540610 -0500 @@ -1,10 +1,10 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * 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.) * * This file provides a location for all error handling. Users who @@ -216,9 +216,9 @@ #ifndef PNG_NO_CONSOLE_IO #ifdef PNG_ERROR_NUMBERS_SUPPORTED if (*error_message == '#') { - /* Strip "#nnnn " from beginning of warning message. */ + /* Strip "#nnnn " from beginning of error message. */ int offset; char error_number[16]; for (offset = 0; offset<15; offset++) { @@ -228,17 +228,23 @@ } if ((offset > 1) && (offset < 15)) { error_number[offset - 1] = '\0'; - fprintf(stderr, "libpng error no. %s: %s\n", error_number, - error_message + offset + 1); + fprintf(stderr, "libpng error no. %s: %s", + error_number, error_message + offset + 1); + fprintf(stderr, PNG_STRING_NEWLINE); } else - fprintf(stderr, "libpng error: %s, offset=%d\n", error_message, offset); + fprintf(stderr, "libpng error: %s, offset=%d", + error_message, offset); + fprintf(stderr, PNG_STRING_NEWLINE); } else #endif - fprintf(stderr, "libpng error: %s\n", error_message); + { + fprintf(stderr, "libpng error: %s", error_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } #endif #ifdef PNG_SETJMP_SUPPORTED if (png_ptr) @@ -284,17 +290,25 @@ } if ((offset > 1) && (offset < 15)) { warning_number[offset + 1] = '\0'; - fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, - warning_message + offset); + fprintf(stderr, "libpng warning no. %s: %s", + warning_number, warning_message + offset); + fprintf(stderr, PNG_STRING_NEWLINE); } else - fprintf(stderr, "libpng warning: %s\n", warning_message); + { + fprintf(stderr, "libpng warning: %s", + warning_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } } else # endif - fprintf(stderr, "libpng warning: %s\n", warning_message); + { + fprintf(stderr, "libpng warning: %s", warning_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } #else warning_message = warning_message; /* make compiler happy */ #endif png_ptr = png_ptr; /* make compiler happy */ diff -ru4NwbB libpng-1.2.35/pngread.c libpng-1.2.36rc01/pngread.c --- libpng-1.2.35/pngread.c 2009-02-27 17:49:09.184770384 -0600 +++ libpng-1.2.36rc01/pngread.c 2009-04-30 06:02:34.457561861 -0500 @@ -1433,13 +1433,13 @@ if (info_ptr->row_pointers == NULL) { info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, info_ptr->height * png_sizeof(png_bytep)); + png_memset(info_ptr->row_pointers, 0, info_ptr->height + * png_sizeof(png_bytep)); #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_ROWS; #endif - png_memset(info_ptr->row_pointers, 0, info_ptr->height - * png_sizeof(png_bytep)); for (row = 0; row < (int)info_ptr->height; row++) info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); } diff -ru4NwbB libpng-1.2.35/pngrio.c libpng-1.2.36rc01/pngrio.c --- libpng-1.2.35/pngrio.c 2009-02-27 17:51:17.104471248 -0600 +++ libpng-1.2.36rc01/pngrio.c 2009-04-30 06:02:34.462814779 -0500 @@ -2,9 +2,9 @@ /* pngrio.c - functions for data input * * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * 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.) * * This file provides a location for all input. Users who need @@ -131,9 +131,11 @@ arguments a pointer to a png_struct, a pointer to a location where input data can be stored, and a 32-bit unsigned int that is the number of bytes to be read. To exit and output any fatal error messages the new write - function should call png_error(png_ptr, "Error msg"). */ + function should call png_error(png_ptr, "Error msg"). + May be NULL, in which case libpng's default function will + be used. */ void PNGAPI png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn) { diff -ru4NwbB libpng-1.2.35/pngrtran.c libpng-1.2.36rc01/pngrtran.c --- libpng-1.2.35/pngrtran.c 2009-02-27 17:51:00.108616289 -0600 +++ libpng-1.2.36rc01/pngrtran.c 2009-04-30 06:02:34.477413043 -0500 @@ -4124,16 +4122,15 @@ g = 1.0; png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p))); + png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p)); if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND)) { double fin, fout; png_uint_32 last, max; - png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p)); - for (i = 0; i < num; i++) { png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, (png_uint_32)(256 * png_sizeof(png_uint_16))); diff -ru4NwbB libpng-1.2.35/pngrutil.c libpng-1.2.36rc01/pngrutil.c --- libpng-1.2.35/pngrutil.c 2009-02-14 15:59:26.630905530 -0600 +++ libpng-1.2.36rc01/pngrutil.c 2009-04-30 06:02:34.489119862 -0500 @@ -1,10 +1,10 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * 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.) * * This file contains routines that are only called from within @@ -3187,8 +3187,10 @@ if (row_bytes + 64 > png_ptr->old_big_row_buf_size) { png_free(png_ptr, png_ptr->big_row_buf); png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64); + if (png_ptr->interlaced) + png_memset(png_ptr->big_row_buf, 0, png_ptr->rowbytes + 64); png_ptr->row_buf = png_ptr->big_row_buf+32; png_ptr->old_big_row_buf_size = row_bytes+64; } diff -ru4NwbB libpng-1.2.35/pngset.c libpng-1.2.36rc01/pngset.c --- libpng-1.2.35/pngset.c 2009-02-27 17:50:44.248728306 -0600 +++ libpng-1.2.36rc01/pngset.c 2009-04-30 06:02:34.497289436 -0500 @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h * 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.) @@ -107,63 +107,63 @@ #ifdef PNG_FLOATING_POINT_SUPPORTED void PNGAPI png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) { - double gamma; + double png_gamma; png_debug1(1, "in %s storage function", "gAMA"); if (png_ptr == NULL || info_ptr == NULL) return; /* Check for overflow */ if (file_gamma > 21474.83) { png_warning(png_ptr, "Limiting gamma to 21474.83"); - gamma=21474.83; + png_gamma=21474.83; } else - gamma = file_gamma; - info_ptr->gamma = (float)gamma; + png_gamma = file_gamma; + info_ptr->gamma = (float)png_gamma; #ifdef PNG_FIXED_POINT_SUPPORTED - info_ptr->int_gamma = (int)(gamma*100000.+.5); + info_ptr->int_gamma = (int)(png_gamma*100000.+.5); #endif info_ptr->valid |= PNG_INFO_gAMA; - if (gamma == 0.0) + if (png_gamma == 0.0) png_warning(png_ptr, "Setting gamma=0"); } #endif void PNGAPI png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point int_gamma) { - png_fixed_point gamma; + png_fixed_point png_gamma; png_debug1(1, "in %s storage function", "gAMA"); if (png_ptr == NULL || info_ptr == NULL) return; if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX) { png_warning(png_ptr, "Limiting gamma to 21474.83"); - gamma=PNG_UINT_31_MAX; + png_gamma=PNG_UINT_31_MAX; } else { if (int_gamma < 0) { png_warning(png_ptr, "Setting negative gamma to zero"); - gamma = 0; + png_gamma = 0; } else - gamma = int_gamma; + png_gamma = int_gamma; } #ifdef PNG_FLOATING_POINT_SUPPORTED - info_ptr->gamma = (float)(gamma/100000.); + info_ptr->gamma = (float)(png_gamma/100000.); #endif #ifdef PNG_FIXED_POINT_SUPPORTED - info_ptr->int_gamma = gamma; + info_ptr->int_gamma = png_gamma; #endif info_ptr->valid |= PNG_INFO_gAMA; - if (gamma == 0) + if (png_gamma == 0) png_warning(png_ptr, "Setting gamma=0"); } #endif @@ -382,12 +382,8 @@ png_warning(png_ptr, "Insufficient memory for pCAL params."); return; } -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_PCAL; -#endif - png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp)); for (i = 0; i < nparams; i++) { @@ -403,8 +399,11 @@ png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length); } info_ptr->valid |= PNG_INFO_pCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PCAL; +#endif } #endif #if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) diff -ru4NwbB libpng-1.2.35/pngtest.c libpng-1.2.36rc01/pngtest.c --- libpng-1.2.35/pngtest.c 2009-02-14 15:59:26.647524575 -0600 +++ libpng-1.2.36rc01/pngtest.c 2009-04-30 06:02:34.506140028 -0500 @@ -1,10 +1,10 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.2.32 [September 18, 2008] + * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * 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.) * * This program reads in a PNG image, writes it out again, and then @@ -361,14 +361,10 @@ #if defined(PNG_WRITE_FLUSH_SUPPORTED) static void pngtest_flush(png_structp png_ptr) { -#if !defined(_WIN32_WCE) - png_FILE_p io_ptr; - io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL) - fflush(io_ptr); -#endif + /* Do nothing; fflush() is said to be just a waste of energy. */ + png_ptr = png_ptr; /* stifle compiler warning */ } #endif /* This is the function that does the actual writing of data. If you are @@ -610,9 +606,9 @@ static int read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk) { png_uint_32 - *user_chunk_data; + *my_user_chunk_data; /* Return one of the following: */ /* return (-n); chunk had an error */ /* return (0); did not recognize */ @@ -633,10 +629,10 @@ if (chunk->size != 1) return (-1); /* Error return */ if (chunk->data[0] != 0 && chunk->data[0] != 1) return (-1); /* Invalid mode */ - user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); - user_chunk_data[0]=chunk->data[0]+1; + my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); + my_user_chunk_data[0]=chunk->data[0]+1; return (1); } if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */ chunk->name[2] != 65 || chunk->name[3] != 103) /* A g */ @@ -646,13 +642,13 @@ if (chunk->size != 9) return (-1); /* Error return */ - user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); + my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); - user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data); - user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4); - user_chunk_data[3]=(png_uint_32)chunk->data[8]; + my_user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data); + my_user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4); + my_user_chunk_data[3]=(png_uint_32)chunk->data[8]; return (1); } @@ -1160,9 +1156,9 @@ unsigned char ster_chunk_data[1]; if (verbose) - fprintf(STDERR, "stereo mode = %lu\n", + fprintf(STDERR, "\n stereo mode = %lu\n", (unsigned long)(user_chunk_data[0] - 1)); ster_chunk_data[0]=(unsigned char)(user_chunk_data[0] - 1); png_write_chunk(write_ptr, png_sTER, ster_chunk_data, 1); } @@ -1317,9 +1313,9 @@ { png_uint_32 iwidth, iheight; iwidth = png_get_image_width(write_ptr, write_info_ptr); iheight = png_get_image_height(write_ptr, write_info_ptr); - fprintf(STDERR, "Image width = %lu, height = %lu\n", + fprintf(STDERR, "\n Image width = %lu, height = %lu\n", (unsigned long)iwidth, (unsigned long)iheight); } #endif @@ -1438,9 +1434,9 @@ { int multiple = 0; int ierror = 0; - fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); + fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); fprintf(STDERR, "%s", png_get_copyright(NULL)); /* Show the version of libpng used in building the library */ fprintf(STDERR, " library (%lu):%s", @@ -1526,9 +1522,9 @@ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) int k; #endif int kerror; - fprintf(STDERR, "Testing %s:", argv[i]); + fprintf(STDERR, "\n Testing %s:", argv[i]); kerror = test_one_file(argv[i], outname); if (kerror == 0) { #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) @@ -1596,9 +1592,9 @@ #endif if (i == 1) status_dots_requested = 1; else if (verbose == 0)status_dots_requested = 0; if (i == 0 || verbose == 1 || ierror != 0) - fprintf(STDERR, "Testing %s:", inname); + fprintf(STDERR, "\n Testing %s:", inname); kerror = test_one_file(inname, outname); if (kerror == 0) { if (verbose == 1 || i == 2) @@ -1627,9 +1623,9 @@ } else { if (verbose == 0 && i != 2) - fprintf(STDERR, "Testing %s:", inname); + fprintf(STDERR, "\n Testing %s:", inname); fprintf(STDERR, " FAIL\n"); ierror += kerror; } #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG diff -ru4NwbB libpng-1.2.35/pngwio.c libpng-1.2.36rc01/pngwio.c --- libpng-1.2.35/pngwio.c 2009-02-27 17:50:49.640399946 -0600 +++ libpng-1.2.36rc01/pngwio.c 2009-04-30 06:02:34.522938015 -0500 @@ -1,8 +1,8 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h * 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.) @@ -136,9 +136,8 @@ #endif if (png_ptr == NULL) return; #if !defined(_WIN32_WCE) io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL && fileno(io_ptr) != -1) fflush(io_ptr); #endif } #endif @@ -155,18 +154,24 @@ arguments a pointer to a png_struct, a pointer to data to be written, and a 32-bit unsigned int that is the number of bytes to be written. The new write function should call png_error(png_ptr, "Error msg") - to exit and output any fatal error messages. + to exit and output any fatal error messages. May be + NULL, in which case libpng's default function will + be used. flush_data_fn - pointer to a new flush function that takes as its arguments a pointer to a png_struct. After a call to the flush function, there should be no data in any buffers or pending transmission. If the output method doesn't do any buffering of ouput, a function prototype must still be supplied although it doesn't have to do anything. If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time, output_flush_fn will be ignored, although it must be - supplied for compatibility. */ + supplied for compatibility. May be NULL, in which case + libpng's default function will be used, if + PNG_WRITE_FLUSH_SUPPORTED is defined. This is not + a good idea if io_ptr does not point to a standard + *FILE structure. */ void PNGAPI png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) { diff -ru4NwbB libpng-1.2.35/pngwutil.c libpng-1.2.36rc01/pngwutil.c --- libpng-1.2.35/pngwutil.c 2009-02-14 15:59:26.688440709 -0600 +++ libpng-1.2.36rc01/pngwutil.c 2009-04-30 06:02:34.549320936 -0500 @@ -1,10 +1,10 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.36 [April 30, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * 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.) */ @@ -784,8 +784,9 @@ if (profile_len < embedded_profile_len) { png_warning(png_ptr, "Embedded profile length too large in iCCP chunk"); + png_free(png_ptr, new_name); return; } if (profile_len > embedded_profile_len) diff -ru4NwbB libpng-1.2.35/scripts/pngw32.def libpng-1.2.36rc01/scripts/pngw32.def --- libpng-1.2.35/scripts/pngw32.def 2009-02-14 15:59:28.203583743 -0600 +++ libpng-1.2.36rc01/scripts/pngw32.def 2009-04-30 06:02:36.396293925 -0500 @@ -188,8 +188,9 @@ png_set_invalid @173 ; Added at version 1.0.12 ; For compatibility with 1.0.7-1.0.11 ; png_info_init @174 +; png_read_init_3, png_info_init_3, and png_write_init_3 are deprecated. png_read_init_3 @175 png_write_init_3 @176 png_info_init_3 @177 png_destroy_struct @178