Code

prepare for the release of rrdtool-1.2.30
[rrdtool-all.git] / program / src / pngsize.c
index 2a429c46388e88970b3bb7cc93831a85cdb47d60..057ce0933a5ccdf5f11b8aa069df531ead0f574b 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.2.2  Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.30  Copyright by Tobi Oetiker, 1997-2009
  *****************************************************************************
  * pngsize.c  determine the size of a PNG image
  *****************************************************************************/
@@ -25,11 +25,19 @@ PngSize(FILE *fd, long *width, long *height)
 /* this is to make compile on aix work since they seem to define jmpbuf
    to be _jmpbuf which breaks compilation */
 
+
+#ifndef png_jmpbuf
+#ifdef PNG_SETJMP_SUPPORTED
+#  define png_jmpbuf(png_ptr)   ((png_ptr)->PNG_jmpbuf)
+#else
 #ifdef jmpbuf
 #undef jmpbuf
+#endif
+#  define png_jmpbuf(png_ptr)   ((png_ptr)->jmpbuf)
+#endif
 #endif
 
-  if (setjmp(png_read_ptr->jmpbuf)){
+  if (setjmp(png_jmpbuf(png_read_ptr))){
     png_destroy_read_struct(&png_read_ptr, &info_ptr, (png_infopp)NULL);
     return 0;
   }