diff --git a/ANNOUNCE b/ANNOUNCE index 3d462aff6..64da7b50f 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -32,6 +32,7 @@ Version 1.5.3beta01 [April 1, 2011] Version 1.5.3beta02 [April 1, 2011] Updated scripts/symbols.def with new API functions. + Only compile the new zlib re-initializing code when text or iCCP is supported. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index 0a98aa771..03f0c1fcb 100644 --- a/CHANGES +++ b/CHANGES @@ -3293,6 +3293,7 @@ Version 1.5.3beta01 [April 1, 2011] Version 1.5.3beta02 [April 1, 2011] Updated scripts/symbols.def with new API functions. + Only compile the new zlib re-initializing code when text or iCCP is supported. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngstruct.h b/pngstruct.h index e6d9f8fe8..6959d6112 100644 --- a/pngstruct.h +++ b/pngstruct.h @@ -70,11 +70,14 @@ struct png_struct_def int zlib_mem_level; /* holds zlib compression memory level */ int zlib_strategy; /* holds zlib compression strategy */ /* Added at libpng 1.5.3 */ +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) || \ + defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION) int zlib_text_level; /* holds zlib compression level */ int zlib_text_method; /* holds zlib compression method */ int zlib_text_window_bits; /* holds zlib compression window bits */ int zlib_text_mem_level; /* holds zlib compression memory level */ int zlib_text_strategy; /* holds zlib compression strategy */ +#endif /* End of material added at libpng 1.5.3 */ png_uint_32 width; /* width of image in pixels */ diff --git a/pngwutil.c b/pngwutil.c index 957789bd0..25d714cf9 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -687,9 +687,6 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, png_ptr->zlib_text_method = 8; #endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */ - /* png_warning(png_ptr, "Initialize compressor for IDAT"); */ - /* Free memory from previously opened zstream */ - deflateEnd(&png_ptr->zstream); /* Initialize the zlib compressor */ ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, png_ptr->zlib_method, png_ptr->zlib_window_bits, @@ -788,6 +785,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) int ret; unsigned int z_cmf; /* zlib compression method and flags */ +#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) if (png_ptr->mode & PNG_ZLIB_READY_FOR_ZTXT) { /* png_warning(png_ptr, "Initialize compressor for IDAT"); */ @@ -817,6 +815,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) } png_ptr->mode &= ~PNG_ZLIB_READY_FOR_ZTXT; /* Ready for IDAT */ } +#endif /* PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED */ png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;