Changeset: 5fb7b6f4795c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5fb7b6f4795c
Modified Files:
        geom/monetdb5/geom.mx
Branch: Dec2011
Log Message:

geom: fixed compilation with clang 2.9

Replace x[i] by *(x+i) on variable size struct element
to keep clang 2.9 from complaining about

"
.../MonetDB/geom/monetdb5/geom.mx:692:15: error: array index of '1' indexes 
past the end of an array (that contains 1 elements) [-Werror,-Warray-bounds]
             (te = (((*w)->data[1]) & 0x0f)) == *tpe))
                     ^          ~
In file included from .../MonetDB/geom/monetdb5/geom.mx:272:
.../MonetDB/geom/monetdb5/../lib/libgeom.h:109:7: note: array 'data' declared 
here
        char data[1];
             ^
"


diffs (21 lines):

diff --git a/geom/monetdb5/geom.mx b/geom/monetdb5/geom.mx
--- a/geom/monetdb5/geom.mx
+++ b/geom/monetdb5/geom.mx
@@ -689,7 +689,7 @@ wkbFromText(wkb **w, str *wkt, int *tpe)
        *w = NULL;
        if (wkbFROMSTR(*wkt, &len, w) &&
            (wkb_isnil(*w) || *tpe == wkbGeometryCollection ||
-            (te = (((*w)->data[1]) & 0x0f)) == *tpe))
+            (te = *((*w)->data + 1) & 0x0f) == *tpe))
                return MAL_SUCCEED;
        if (!(*w))
                *w = (wkb *) GDKmalloc(sizeof(wkb));
@@ -721,7 +721,7 @@ wkbHASH(wkb *w)
        BUN h = 0;
 
        for (i = 0; i < (w->len - 1); i += 2) {
-               int a = w->data[i], b = w->data[i + 1];
+               int a = *(w->data + i), b = *(w->data + i + 1);
                h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
        }
        return h;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to