[libpng16] Attempt to detect configuration issues with pngdeflate,

which requires both the correct libpng and the correct zlib to function
correctly.
This commit is contained in:
John Bowler 2013-05-08 14:21:46 -05:00 committed by Glenn Randers-Pehrson
parent 34b7d62488
commit 9afb90f885
7 changed files with 30 additions and 14 deletions

View File

@ -69,6 +69,8 @@ Version 1.6.3beta05 [May 8, 2013]
Added a call to png_set_packing()
Initialize dimension values so if sscanf fails at least we have known
invalid values.
Attempt to detect configuration issues with pngdeflate, which requires
both the correct libpng and the correct zlib to function correctly.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4552,6 +4552,8 @@ Version 1.6.3beta05 [May 8, 2013]
Added a call to png_set_packing()
Initialize dimension values so if sscanf fails at least we have known
invalid values.
Attempt to detect configuration issues with pngdeflate, which requires
both the correct libpng and the correct zlib to function correctly.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -188,7 +188,8 @@ endif
$(srcdir)/scripts/pnglibconf.h.prebuilt:
@echo "Attempting to build $@" >&2
@echo "This is a machine generated file, but if you want to make" >&2
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
@echo "a new one simply make 'scripts/pnglibconf.out', copy that" >&2
@echo "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)" >&2
@exit 1
# The following is necessary to ensure that the local pnglibconf.h is used, not

View File

@ -25,20 +25,19 @@
# include "../../png.h"
#endif
#if PNG_LIBPNG_VER < 10600 /* 1.6.0 */
# error pngdeflate will not work with libpng versions prior to 1.6
#if PNG_LIBPNG_VER < 10603 /* 1.6.3 */
# error pngdeflate will not work with libpng versions prior to 1.6.3
#endif
#ifdef PNG_READ_SUPPORTED
#include <zlib.h>
#ifndef PNG_MAXIMUM_INFLATE_WINDOW
# if PNG_LIBPNG_VER != 10600 && PNG_LIBPNG_VER != 10601 && \
PNG_LIBPNG_VER != 10602
# error pngdeflate not supported in this libpng version
# endif
#endif
#if PNG_ZLIB_VERNUM >= 0x1240
/* Copied from pngpriv.h */
#ifdef __cplusplus
# define png_voidcast(type, value) static_cast<type>(value)
@ -726,8 +725,8 @@ fix_one(FILE *fp, FILE *fpIn, IDAT_info *info, png_uint_32 max_IDAT, int strip)
break;
/* Fall trhough */
default: /* Keep only IHDR, PLTE */
if (tag == png_IHDR || tag == png_PLTE)
default: /* Keep only IHDR, PLTE, tRNS */
if (tag == png_IHDR || tag == png_PLTE || tag == png_tRNS)
break;
skip = 1;
@ -994,8 +993,8 @@ usage(const char *prog, int rc)
# endif
" --optimize (-o): Find the smallest deflate window size for the file.\n"
" Also outputs a summary for each file.\n"
" --strip (-s): Remove chunks except for IHDR, PLTE, IEND, gAMA, sRGB.\n"
" If given twice remove gAMA and sRGB as well.\n"
" --strip (-s): Remove chunks except for IHDR, PLTE, IEND, tRNS, gAMA,\n"
" sRGB. If given twice remove gAMA and sRGB as well.\n"
" --errors (-e): Output errors from libpng (except too-far-back).\n");
fprintf(stderr,
" --warnings (-w): Output warnings from libpng.\n"
@ -1169,6 +1168,16 @@ main(int argc, const char **argv)
return err != 0;
}
#else /* PNG_ZLIB_VERNUM < 0x1240 */
int
main(void)
{
fprintf(stderr, "pngdeflate needs libpng with a zlib >=1.2.4 (not 0x%x)\n",
PNG_ZLIB_VERNUM);
return 77;
}
#endif /* PNG_ZLIB_VERNUM */
#else /* No read support */
int

View File

@ -367,7 +367,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
*/
{
int ret; /* zlib return code */
# if ZLIB_VERNUM >= 0x1240
# if PNG_ZLIB_VERNUM >= 0x1240
# if defined(PNG_SET_OPTION_SUPPORTED) && \
defined(PNG_MAXIMUM_INFLATE_WINDOW)
@ -394,7 +394,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
{
# if ZLIB_VERNUM < 0x1240
# if PNG_ZLIB_VERNUM < 0x1240
ret = inflateReset(&png_ptr->zstream);
# else
ret = inflateReset2(&png_ptr->zstream, window_bits);
@ -403,7 +403,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
else
{
# if ZLIB_VERNUM < 0x1240
# if PNG_ZLIB_VERNUM < 0x1240
ret = inflateInit(&png_ptr->zstream);
# else
ret = inflateInit2(&png_ptr->zstream, window_bits);

View File

@ -238,6 +238,7 @@ option ARM_NEON_CHECK disabled enables ARM_NEON
setting Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
setting Z_DEFAULT_STRATEGY default @Z_FILTERED
setting Z_DEFAULT_NOFILTER_STRATEGY default @Z_DEFAULT_STRATEGY
setting ZLIB_VERNUM default @ZLIB_VERNUM
setting TEXT_Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
setting TEXT_Z_DEFAULT_STRATEGY default @Z_DEFAULT_STRATEGY

View File

@ -202,6 +202,7 @@
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
#define PNG_WEIGHT_SHIFT 8
#define PNG_ZBUF_SIZE 8192
#define PNG_ZLIB_VERNUM 0 /* unknown */
#define PNG_Z_DEFAULT_COMPRESSION (-1)
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
#define PNG_Z_DEFAULT_STRATEGY 1