diff -ru4NwbB libpng-1.2.35/example.c libpng-1.2.36beta01/example.c --- libpng-1.2.35/example.c 2009-02-14 15:59:26.552153830 -0600 +++ libpng-1.2.36beta01/example.c 2009-02-28 06:09:33.628987051 -0600 @@ -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 [February 28, 2009] + * Last changed in libpng 1.2.35 [February 14, 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.36beta01/png.h --- libpng-1.2.35/png.h 2009-02-14 15:59:26.535979077 -0600 +++ libpng-1.2.36beta01/png.h 2009-02-28 06:09:33.612899671 -0600 @@ -221,8 +221,9 @@ * 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 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 @@ -2555,13 +2556,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 +2588,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 diff -ru4NwbB libpng-1.2.35/pngconf.h libpng-1.2.36beta01/pngconf.h --- libpng-1.2.35/pngconf.h 2009-02-14 15:59:26.544632620 -0600 +++ libpng-1.2.36beta01/pngconf.h 2009-02-28 06:09:33.621750220 -0600 @@ -1438,16 +1438,22 @@ # define CHECK 1 # define NOCHECK 0 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) +# define png_fileno _fileno # define png_snprintf _fsnprintf /* Added to v 1.2.19 */ # define png_strlen _fstrlen # define png_memcmp _fmemcmp /* SJT: added */ # define png_memcpy _fmemcpy # define png_memset _fmemset #else /* use the usual functions */ # define CVT_PTR(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr) +# ifdef _MSC_VER +# define png_fileno _fileno /* Added to v 1.2.36 */ +# else +# define png_fileno fileno +# endif # ifndef PNG_NO_SNPRINTF # ifdef _MSC_VER # define png_snprintf _snprintf /* Added to v 1.2.19 */ # define png_snprintf2 _snprintf @@ -1467,8 +1473,9 @@ # define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) # endif +# define png_fileno fileno /* Added to v 1.2.36 */ # define png_strlen strlen # define png_memcmp memcmp /* SJT: added */ # define png_memcpy memcpy # define png_memset memset diff -ru4NwbB libpng-1.2.35/pngrio.c libpng-1.2.36beta01/pngrio.c --- libpng-1.2.35/pngrio.c 2009-02-27 17:51:17.104471248 -0600 +++ libpng-1.2.36beta01/pngrio.c 2009-02-28 06:09:33.680349022 -0600 @@ -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/pngwio.c libpng-1.2.36beta01/pngwio.c --- libpng-1.2.35/pngwio.c 2009-02-27 17:50:49.640399946 -0600 +++ libpng-1.2.36beta01/pngwio.c 2009-02-28 06:09:33.739731751 -0600 @@ -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 [February 28, 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,9 @@ #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) + if (io_ptr != NULL && png_fileno(io_ptr) != -1) fflush(io_ptr); #endif } #endif @@ -155,18 +155,21 @@ 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. */ 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) {