Update of /cvsroot/monetdb/geom/src/monetdb5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26120

Modified Files:
        geom.mx 
Log Message:
- GDKerrbuf can be NULL.
- If GDKerrbuf is not NULL, it could contain stuff which is
  interpreted as formatting instructions (i.e. % symbols), so don't pass
  it off as a format string.
- If GDKerrbuf starts with "!ERROR ", remove that string from the
  error message that we throw.
- Clear GDKerrbuf when we throw an error so that the error doesn't get
  reported twice.

(All of this three times.)


U geom.mx
Index: geom.mx
===================================================================
RCS file: /cvsroot/monetdb/geom/src/monetdb5/geom.mx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- geom.mx     10 Oct 2008 08:48:15 -0000      1.24
+++ geom.mx     3 Nov 2008 16:34:37 -0000       1.25
@@ -515,10 +515,18 @@
 mbrFromString(mbr **w, str *src)
 {
        int len = 0;
+       char *errbuf;
 
        if (mbrFROMSTR(*src, &len, w))
                return MAL_SUCCEED;
-       throw(MAL, "mbr.FromString", GDKerrbuf);
+       errbuf = GDKerrbuf;
+       if (errbuf) {
+               if (strncmp(errbuf, "!ERROR: ", 8) == 0)
+                       errbuf += 8;
+               errbuf = strcpy(alloca(strlen(errbuf) + 1), errbuf);
+               GDKerrbuf[0] = 0;
+       }
+       throw(MAL, "mbr.FromString", "%s", errbuf ? errbuf : "cannot parse 
string");
 }
 
 geom_export str
@@ -653,10 +661,18 @@
 wkbFromString(wkb **w, str *wkt)
 {
        int len = 0;
+       char *errbuf;
 
        if (wkbFROMSTR(*wkt, &len, w))
                return MAL_SUCCEED;
-       throw(MAL, "wkb.FromString", GDKerrbuf);
+       errbuf = GDKerrbuf;
+       if (errbuf) {
+               if (strncmp(errbuf, "!ERROR: ", 8) == 0)
+                       errbuf += 8;
+               errbuf = strcpy(alloca(strlen(errbuf) + 1), errbuf);
+               GDKerrbuf[0] = 0;
+       }
+       throw(MAL, "wkb.FromString", "%s", errbuf ? errbuf : "cannot parse 
string");
 }
 
 geom_export str
@@ -683,6 +699,7 @@
 wkbFromText(wkb **w, str *wkt, int *tpe)
 {
        int len = 0, te = *tpe;
+       char *errbuf;
 
        *w = NULL;
        if (wkbFROMSTR(*wkt, &len, w) && 
@@ -694,7 +711,14 @@
        **w = *wkbNULL();
        if (te != *tpe) 
                throw(MAL, "wkb.FromText", "Geometry type '%s' not found", 
geom_type2str(*tpe));
-       throw(MAL, "wkb.FromText", GDKerrbuf);
+       errbuf = GDKerrbuf;
+       if (errbuf) {
+               if (strncmp(errbuf, "!ERROR: ", 8) == 0)
+                       errbuf += 8;
+               errbuf = strcpy(alloca(strlen(errbuf) + 1), errbuf);
+               GDKerrbuf[0] = 0;
+       }
+       throw(MAL, "wkb.FromText", "%s", errbuf ? errbuf : "cannot parse 
string");
 }
 
 geom_export BUN


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to