Code

prepare for the release of rrdtool-1.2.26
[rrdtool-all.git] / program / src / pngsize.c
index 121ae66ed9b8249ca75742c98ce51a5f1dfa7f0f..6b8b264e7fe9594219407fc5672363c39b5655ce 100644 (file)
@@ -1,10 +1,11 @@
 /*****************************************************************************
- * RRDtool 1.0.33  Copyright Tobias Oetiker, 1997 - 2000
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
  *****************************************************************************
  * pngsize.c  determine the size of a PNG image
  *****************************************************************************/
 
 #include <png.h>
+#include "rrd_tool.h"
 
 int
 PngSize(FILE *fd, long *width, long *height)
@@ -21,7 +22,18 @@ PngSize(FILE *fd, long *width, long *height)
   (*width)=0;
   (*height)=0;
 
-  if (setjmp(png_read_ptr->jmpbuf)){
+/* this is to make compile on aix work since they seem to define jmpbuf
+   to be _jmpbuf which breaks compilation */
+
+#ifdef jmpbuf
+#undef jmpbuf
+#endif
+
+#ifndef png_jmpbuf
+#  define png_jmpbuf(png_ptr)   ((png_ptr)->jmpbuf)
+#endif
+
+  if (setjmp(png_jmpbuf(png_read_ptr))){
     png_destroy_read_struct(&png_read_ptr, &info_ptr, (png_infopp)NULL);
     return 0;
   }