[devel] Only compile the new zlib re-initializing code when text or iCCP

is supported.
This commit is contained in:
Glenn Randers-Pehrson 2011-04-01 08:12:24 -05:00
parent bef60dc624
commit 3bb8683a79
4 changed files with 7 additions and 3 deletions

View File

@ -32,6 +32,7 @@ Version 1.5.3beta01 [April 1, 2011]
Version 1.5.3beta02 [April 1, 2011] Version 1.5.3beta02 [April 1, 2011]
Updated scripts/symbols.def with new API functions. 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: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -3293,6 +3293,7 @@ Version 1.5.3beta01 [April 1, 2011]
Version 1.5.3beta02 [April 1, 2011] Version 1.5.3beta02 [April 1, 2011]
Updated scripts/symbols.def with new API functions. 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 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -70,11 +70,14 @@ struct png_struct_def
int zlib_mem_level; /* holds zlib compression memory level */ int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */ int zlib_strategy; /* holds zlib compression strategy */
/* Added at libpng 1.5.3 */ /* 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_level; /* holds zlib compression level */
int zlib_text_method; /* holds zlib compression method */ int zlib_text_method; /* holds zlib compression method */
int zlib_text_window_bits; /* holds zlib compression window bits */ int zlib_text_window_bits; /* holds zlib compression window bits */
int zlib_text_mem_level; /* holds zlib compression memory level */ int zlib_text_mem_level; /* holds zlib compression memory level */
int zlib_text_strategy; /* holds zlib compression strategy */ int zlib_text_strategy; /* holds zlib compression strategy */
#endif
/* End of material added at libpng 1.5.3 */ /* End of material added at libpng 1.5.3 */
png_uint_32 width; /* width of image in pixels */ png_uint_32 width; /* width of image in pixels */

View File

@ -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; png_ptr->zlib_text_method = 8;
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */ #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 */ /* Initialize the zlib compressor */
ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
png_ptr->zlib_method, png_ptr->zlib_window_bits, 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; int ret;
unsigned int z_cmf; /* zlib compression method and flags */ 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) if (png_ptr->mode & PNG_ZLIB_READY_FOR_ZTXT)
{ {
/* png_warning(png_ptr, "Initialize compressor for IDAT"); */ /* 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 */ 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.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;