diff --git a/png.h b/png.h index c736df079..851db0af5 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.0beta27 - July 14, 2012 + * libpng version 1.6.0beta27 - August 10, 2012 * Copyright (c) 1998-2012 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.) @@ -11,7 +11,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.6.0beta27 - July 14, 2012: Glenn + * libpng versions 0.97, January 1998, through 1.6.0beta27 - August 10, 2012: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -198,7 +198,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.6.0beta27, July 14, 2012, are + * libpng versions 1.2.6, August 15, 2004, through 1.6.0beta27, August 10, 2012, are * Copyright (c) 2004, 2006-2012 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: @@ -310,7 +310,7 @@ * Y2K compliance in libpng: * ========================= * - * July 14, 2012 + * August 10, 2012 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -378,7 +378,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.6.0beta27" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.6.0beta27 - July 14, 2012\n" + " libpng version 1.6.0beta27 - August 10, 2012\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -1034,7 +1034,7 @@ PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr, PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); # define png_jmpbuf(png_ptr) \ - (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf))) + (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf)))) #else # define png_jmpbuf(png_ptr) \ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) @@ -2008,9 +2008,11 @@ PNG_EXPORT(113, void, png_set_rows, (png_const_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers)); #endif +#ifdef PNG_READ_SUPPORTED /* Returns number of color channels in image. */ PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr, png_const_inforp info_ptr)); +#endif #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ @@ -2067,9 +2069,11 @@ PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, #endif /* PNG_EASY_ACCESS_SUPPORTED */ +#ifdef PNG_READ_SUPPORTED /* Returns pointer to signature string read from PNG header */ PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr, png_const_inforp info_ptr)); +#endif #ifdef PNG_bKGD_SUPPORTED PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr, diff --git a/pngget.c b/pngget.c index 1d27e4d6d..e33afcf2f 100644 --- a/pngget.c +++ b/pngget.c @@ -422,6 +422,8 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr, #endif /* PNG_EASY_ACCESS_SUPPORTED */ + +#ifdef PNG_READ_SUPPORTED png_byte PNGAPI png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr) { @@ -439,6 +441,7 @@ png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr) return (NULL); } +#endif #ifdef PNG_bKGD_SUPPORTED png_uint_32 PNGAPI diff --git a/pnginfo.h b/pnginfo.h index ee1947491..6d196ae69 100644 --- a/pnginfo.h +++ b/pnginfo.h @@ -55,7 +55,7 @@ struct png_info_def { - /* 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) */ @@ -70,13 +70,10 @@ struct png_info_def png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */ png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ -#ifdef PNG_READ_SUPPORTED - /* The following is informational only on read, and not used on writes. */ png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */ png_byte pixel_depth; /* number of bits per pixel */ png_byte spare_byte; /* to align the data, and for future use */ png_byte signature[8]; /* magic bytes read by libpng from start of file */ -#endif /* The rest of the data is optional. If you are reading, check the * valid field to see if the information in these are valid. If you diff --git a/pngrutil.c b/pngrutil.c index 703d09254..771facf48 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -312,8 +312,16 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn) else if (warn < 2) /* else silent */ { - (warn ? png_chunk_warning : png_chunk_error)(png_ptr, - "insufficient memory to read chunk"); +#ifdef PNG_WARNINGS_SUPPORTED + if (warn) + png_chunk_warning(png_ptr, "insufficient memory to read chunk"); + else +#endif + { +#ifdef PNG_ERROR_TEXT_SUPPORTED + png_chunk_error(png_ptr, "insufficient memory to read chunk"); +#endif + } } } diff --git a/pngset.c b/pngset.c index 7adc1758e..6679bdece 100644 --- a/pngset.c +++ b/pngset.c @@ -1297,7 +1297,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size) } # endif -# ifdef PNG_WRITE_SUPPORTED +#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED if (!(png_ptr->mode & PNG_IS_READ_STRUCT)) { if (png_ptr->zowner != 0) diff --git a/pngwrite.c b/pngwrite.c index f7b0f5c50..83cc3abde 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -872,7 +872,9 @@ png_write_destroy(png_structrp png_ptr) deflateEnd(&png_ptr->zstream); /* Free our memory. png_free checks NULL for us. */ +#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list); +#endif png_free(png_ptr, png_ptr->row_buf); #ifdef PNG_WRITE_FILTER_SUPPORTED png_free(png_ptr, png_ptr->prev_row); diff --git a/pngwutil.c b/pngwutil.c index f9cb950b7..c475745dd 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1033,8 +1033,10 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, png_ptr->zbuffer_list->next = NULL; } +#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED else png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list->next); +#endif /* It is a terminal error if we can't claim the zstream. */ if (png_deflate_claim(png_ptr, png_IDAT, png_image_size(png_ptr)) != Z_OK)