Grads on Slackware 11 - segmentation faults due to a severe case of versionitis
Patrice Dumas
pertusus at FREE.FR
Sat Oct 28 05:54:20 EDT 2006
On Sat, Oct 28, 2006 at 08:25:34AM +0200, Jean Pierre Arabonis wrote:
> Thanks Pat, with your and Jennifers' input I am starting to actually
> understand what is happening.
> The patch would be much appreciated.
Here it is.
--
Pat
-------------- next part --------------
diff -Naur grads-1.9b4/src/gacfg.c grads-1.9b4_new/src/gacfg.c
--- grads-1.9b4/src/gacfg.c 2005-05-18 14:29:17.000000000 +0000
+++ grads-1.9b4_new/src/gacfg.c 2005-11-03 13:18:45.000000000 +0000
@@ -32,6 +32,7 @@
*/
#include <stdio.h>
+#include <string.h>
#include "grads.h"
#include "buildinfo.h"
diff -Naur grads-1.9b4/src/gaexpr.c grads-1.9b4_new/src/gaexpr.c
--- grads-1.9b4/src/gaexpr.c 2005-05-18 14:48:36.000000000 +0000
+++ grads-1.9b4_new/src/gaexpr.c 2005-11-03 11:22:27.000000000 +0000
@@ -13,6 +13,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include <math.h>
#include "grads.h"
diff -Naur grads-1.9b4/src/gaio.c grads-1.9b4_new/src/gaio.c
--- grads-1.9b4/src/gaio.c 2005-05-23 17:59:01.000000000 +0000
+++ grads-1.9b4_new/src/gaio.c 2005-11-03 11:37:35.000000000 +0000
@@ -22,6 +22,7 @@
#include "grads.h"
#include <math.h>
#include <stdio.h>
+#include <string.h>
#if USESDF == 1
#include <netcdf.h>
#if USEHDF == 1
diff -Naur grads-1.9b4/src/gasdf.c grads-1.9b4_new/src/gasdf.c
--- grads-1.9b4/src/gasdf.c 2005-05-18 14:29:17.000000000 +0000
+++ grads-1.9b4_new/src/gasdf.c 2005-11-04 10:02:05.000000000 +0000
@@ -5785,7 +5785,11 @@
/* Turn off automatic error handling. */
ncopts = 0;
+#if USEHDF == 1
if (ncattname (cdfid, varid, attnum, name) == -1) {
+#else
+ if (nc_inq_attname(cdfid, varid, attnum, name) == -1) {
+#endif
ncopts = oldncopts ;
return Failure;
}
@@ -5813,10 +5817,23 @@
/* Turn off automatic error handling. */
ncopts = 0;
+#if USEHDF == 1
if (ncattinq (cdfid, varid, aname, atype, alen) == -1) {
ncopts = oldncopts ;
return Failure;
}
+#else
+ if (nc_inq_atttype(cdfid, varid, aname, atype) != NC_NOERR) {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ size_t templen;
+ if (nc_inq_attlen(cdfid, varid, aname, &templen) != NC_NOERR) {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ *alen = (int) templen;
+#endif
/* Allocate space for values. */
if ((*atype == NC_BYTE) || (*atype == NC_CHAR)) {
@@ -5831,6 +5848,7 @@
*adata = (double *) malloc (sizeof (double) * *alen);
} else {
ncopts = oldncopts ;
+ printf("UNKNOWN TYPE HERE !\n");
return Failure;
}
@@ -5840,10 +5858,65 @@
}
/* Retrieve values. */
+#if USEHDF == 1
if (ncattget (cdfid, varid, aname, (void *) (*adata)) == -1) {
ncopts = oldncopts ;
return Failure;
}
+#else
+ switch (*atype)
+ {
+ case NC_BYTE:
+ if (nc_get_att_uchar(cdfid, varid, aname, (unsigned char *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ case NC_CHAR:
+ if (nc_get_att_text(cdfid, varid, aname, (char *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ case NC_SHORT:
+ if (nc_get_att_short(cdfid, varid, aname, (short *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ case NC_LONG:
+ if (nc_get_att_int(cdfid, varid, aname, (int *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ case NC_FLOAT:
+ if (nc_get_att_float(cdfid, varid, aname, (float *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ case NC_DOUBLE:
+ if (nc_get_att_double(cdfid, varid, aname, (double *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ default:
+ if (nc_get_att_text(cdfid, varid, aname, (char *) *adata) != NC_NOERR)
+ {
+ ncopts = oldncopts ;
+ return Failure;
+ }
+ break;
+ }
+#endif
/* If character, set last byte to null. */
if (*atype == NC_CHAR) {
diff -Naur grads-1.9b4/src/gxdxwd.c grads-1.9b4_new/src/gxdxwd.c
--- grads-1.9b4/src/gxdxwd.c 2002-10-28 19:08:33.000000000 +0000
+++ grads-1.9b4_new/src/gxdxwd.c 2005-11-03 13:37:45.000000000 +0000
@@ -7,6 +7,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <X11/Xos.h>
@@ -92,6 +91,7 @@
int bw;
Window dummywin;
XWDFileHeader header;
+ char mytmp[64];
/*
@@ -232,7 +232,8 @@
* Write out the color maps, if any
*/
- if (debug) outl("xwd: Dumping %d colors.\n", ncolors);
+ sprintf(mytmp, "xwd: Dumping %d colors.\n", ncolors);
+ if (debug) outl(mytmp);
/*
{
int icineca=0;
diff -Naur grads-1.9b4/src/gxeps.c grads-1.9b4_new/src/gxeps.c
--- grads-1.9b4/src/gxeps.c 2004-02-27 14:42:11.000000000 +0000
+++ grads-1.9b4_new/src/gxeps.c 2005-11-03 14:45:16.000000000 +0000
@@ -6,6 +6,8 @@
#include <config.h>
#endif
+#include <stdlib.h>
+
/***********************************************************
* GXEPS a grads metafile to PostScript converter
* Copyright (c) 1999 - 2001 Matthias Munnich
diff -Naur grads-1.9b4/src/gxhpng.c grads-1.9b4_new/src/gxhpng.c
--- grads-1.9b4/src/gxhpng.c 2004-03-12 16:14:04.000000000 +0000
+++ grads-1.9b4_new/src/gxhpng.c 2005-11-03 11:56:53.000000000 +0000
@@ -6,7 +6,6 @@
#include <config.h>
#endif
-
/* Rasterize current metafile buffer via gd library. Loosly based
on the gxpng utility:
@@ -455,7 +452,7 @@
im->polyInts[ints++] = (y-y1) * (x2-x1) / (y2-y1) + x1;
}
}
- qsort(im->polyInts, ints, sizeof(int), gdCompareInt);
+ qsort(im->polyInts, ints, sizeof(int), (void *) gdCompareInt);
for (i=0; (i < (ints)); i+=2) {
gdImageLne(im, im->polyInts[i], y,
diff -Naur grads-1.9b4/src/gxX.c grads-1.9b4_new/src/gxX.c
--- grads-1.9b4/src/gxX.c 2005-05-18 14:29:17.000000000 +0000
+++ grads-1.9b4_new/src/gxX.c 2005-11-03 11:28:15.000000000 +0000
@@ -270,7 +270,7 @@
/* Set up icon pixmap */
- icon_pixmap = XCreateBitmapFromData(display, win, icon_bitmap_bits,
+ icon_pixmap = XCreateBitmapFromData(display, win, (char *) icon_bitmap_bits,
icon_bitmap_width, icon_bitmap_height);
/* Set standard properties */
@@ -402,7 +402,7 @@
if (xfnam) flist = XListFonts (display, xfnam, 1, &i);
else flist = NULL;
if (flist==NULL) {
- flist = XListFonts (display, "-adobe-helvetica-bold-r-normal--??-100*", 1, &i);
+ flist = XListFonts (display, "-adobe-helvetica-bold-r-normal-*-100*", 1, &i);
}
if (flist==NULL) {
flist = XListFonts (display, "-adobe-helvetica-bold-r-normal-*-120*", 1, &i);
@@ -418,7 +418,7 @@
if (xfnam) flist = XListFonts (display, xfnam, 1, &i);
else flist = NULL;
if (flist==NULL) {
- flist = XListFonts (display, "-adobe-helvetica-bold-o-normal--??-100*", 1, &i);
+ flist = XListFonts (display, "-adobe-helvetica-bold-o-normal-*-100*", 1, &i);
}
if (flist==NULL) {
flist = XListFonts (display, "-adobe-helvetica-bold-o-normal-*-120*", 1, &i);
@@ -3267,7 +3267,7 @@
}
if (typ>1) {
- stipple_pixmap = XCreateBitmapFromData(display, win, bitmap_bits,
+ stipple_pixmap = XCreateBitmapFromData(display, win, (char *) bitmap_bits,
bitmap_width, bitmap_height);
XSetStipple(display, gc, stipple_pixmap);
XSetFillStyle(display, gc, FillStippled);
More information about the gradsusr
mailing list