--- plotutils-2.6.old/libplot/z_write.c +++ plotutils-2.6/libplot/z_write.c @@ -65,6 +65,26 @@ #endif #endif +/* starting from libpng version 1.5 it is not possible + * to access inside the PNG struct directly + */ + +#ifdef PNG_SETJMP +#undef PNG_SETJMP +#endif + +#ifdef PNG_LONGJMP +#undef PNG_LONGJMP +#endif + +#if (defined(PNG_LIBPNG_VER) && PNG_LIBPNG_VER >= 10500) +#define PNG_SETJMP(ptr) setjmp(png_jmpbuf(ptr)) +#define PNG_LONGJMP(ptr) longjmp(png_jmpbuf(ptr), 1) +#else +#define PNG_SETJMP(ptr) setjmp(ptr->jmpbuf) +#define PNG_LONGJMP(ptr) longjmp(ptr->jmpbuf, 1) +#endif + static const char _short_months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -164,7 +184,7 @@ } /* cleanup after libpng errors (error handler does a longjmp) */ - if (setjmp (png_ptr->jmpbuf)) + if (PNG_SETJMP(png_ptr)) { png_destroy_write_struct (&png_ptr, (png_info **)NULL); return -1; @@ -444,7 +464,7 @@ #endif } - longjmp (png_ptr->jmpbuf, 1); + PNG_LONGJMP(png_ptr); } static void @@ -515,7 +535,7 @@ #endif } - longjmp (png_ptr->jmpbuf, 1); + longjmp (png_jmpbuf (png_ptr), 1); } static void