From: glennrp Date: Sat, 19 Feb 2011 04:56:17 +0000 (+0000) Subject: Make it possible to build with libpng-1.4.x when png_set_longjmp_fn is X-Git-Tag: 7.0.1-0~8156 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5023d3b1db35339952ba418a8ee02601b02c9aef;p=imagemagick Make it possible to build with libpng-1.4.x when png_set_longjmp_fn is not exported. --- diff --git a/ChangeLog b/ChangeLog index fe844811d..126a3b971 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-02-18 6.6.7-8 Glenn Randers-Pehrson + * Use setjmp() instead of png_setjmp() when building with libpng-1.4.x + because png_setjmp() references png_set_longjmp_fn() which was not + exported by libpng-1.4.x. + 2011-02-15 6.6.7-8 Cristy * New version 6.6.7-8. diff --git a/coders/png.c b/coders/png.c index 05f28ca17..f002d8378 100644 --- a/coders/png.c +++ b/coders/png.c @@ -91,7 +91,9 @@ /* #define PNG_USE_RESULT The result of this function must be checked */ /* #define PNG_NORETURN This function does not return */ /* #define PNG_ALLOCATED The result of the function is new memory */ -/* #define PNG_DEPSTRUCT Access to this struct member is deprecated */ +#if (PNG_LIBPNG_VER >= 10400 && PNG_LIBPNG_VER < 10500) + #define PNG_DEPSTRUCT /* Access to this struct member is deprecated */ +#endif #include "png.h" #include "zlib.h" @@ -1731,7 +1733,12 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, ping_pixels=(unsigned char *) NULL; +#if (PNG_LIBPNG_VER < 10400 || PNG_LIBPNG_VER >= 10500) if (setjmp(png_jmpbuf(ping))) +#else + /* Warning is unavoidable if #define PNG_DEPSTRUCT is not defined */ + if (setjmp(ping->jmpbuf)) +#endif { /* PNG image is corrupt. @@ -2392,7 +2399,12 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, /* Convert PNG pixels to pixel packets. */ +#if (PNG_LIBPNG_VER < 10400 || PNG_LIBPNG_VER >= 10500) if (setjmp(png_jmpbuf(ping))) +#else + /* Warning is unavoidable if #define PNG_DEPSTRUCT is not defined */ + if (setjmp(ping->jmpbuf)) +#endif { /* PNG image is corrupt. @@ -7439,7 +7451,12 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, png_set_write_fn(ping,image,png_put_data,png_flush_data); ping_pixels=(unsigned char *) NULL; +#if (PNG_LIBPNG_VER < 10400 || PNG_LIBPNG_VER >= 10500) if (setjmp(png_jmpbuf(ping))) +#else + /* Warning is unavoidable if #define PNG_DEPSTRUCT is not defined */ + if (setjmp(ping->jmpbuf)) +#endif { /* PNG write failed. @@ -8732,7 +8749,12 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, /* Initialize image scanlines. */ +#if (PNG_LIBPNG_VER < 10400 || PNG_LIBPNG_VER >= 10500) if (setjmp(png_jmpbuf(ping))) +#else + /* Warning is unavoidable if #define PNG_DEPSTRUCT is not defined */ + if (setjmp(ping->jmpbuf)) +#endif { /* PNG write failed.