Changeset: 395c11e63fae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/395c11e63fae
Branch: simplify_scenario
Log Message:

merged with default


diffs (98 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -519,6 +519,9 @@ heapinit(BAT *b, const char *buf,
                return -1;
        }
 
+       if (strcmp(type, "wkba") == 0)
+               TRC_WARNING(GDK, "type wkba (SQL name: GeometryA) is 
deprecated\n");
+
        if (properties & ~0x0F81) {
                TRC_CRITICAL(GDK, "unknown properties are set: incompatible 
database on line %d of BBP.dir\n", lineno);
                return -1;
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -100,10 +100,11 @@ HASHclear(Hash *h)
        memset(h->Bckt, 0xFF, h->nbucket * h->width);
 }
 
-#define HASH_VERSION           4
-/* this is only for the change of hash function of the UUID type; if
- * HASH_VERSION is increased again from 4, the code associated with
- * HASH_VERSION_NOUUID must be deleted */
+#define HASH_VERSION           5
+/* this is only for the change of hash function of the UUID type and MBR
+ * type; if HASH_VERSION is increased again from 5, the code associated
+ * with HASH_VERSION_NOUUID and HASH_VERSION_NOMBR must be deleted */
+#define HASH_VERSION_NOMBR     4
 #define HASH_VERSION_NOUUID    3
 #define HASH_HEADER_SIZE       7       /* nr of size_t fields in header */
 
@@ -500,7 +501,17 @@ BATcheckhash(BAT *b)
                                                         ((size_t) 1 << 24) |
 #endif
                                                         HASH_VERSION_NOUUID) &&
-                                                strcmp(ATOMname(b->ttype), 
"uuid") != 0)
+                                                strcmp(ATOMname(b->ttype), 
"uuid") != 0 &&
+                                                strcmp(ATOMname(b->ttype), 
"mbr") != 0)
+#endif
+#ifdef HASH_VERSION_NOMBR
+                                            /* if not uuid, also allow 
previous version */
+                                            || (hdata[0] == (
+#ifdef PERSISTENTHASH
+                                                        ((size_t) 1 << 24) |
+#endif
+                                                        HASH_VERSION_NOMBR) &&
+                                                strcmp(ATOMname(b->ttype), 
"mbr") != 0)
 #endif
                                                    ) &&
                                            hdata[1] > 0 &&
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -5169,7 +5169,15 @@ wkbHASH(const void *W)
        BUN h = 0;
 
        for (i = 0; i < (w->len - 1); i += 2) {
-               int a = *(w->data + i), b = *(w->data + i + 1);
+               BUN a = ((unsigned char *) w->data)[i];
+               BUN b = ((unsigned char *) w->data)[i + 1];
+#if '\377' < 0                                 /* char is signed? */
+               /* maybe sign extend */
+               if (a & 0x80)
+                       a |= ~(BUN)0x7f;
+               if (b & 0x80)
+                       b |= ~(BUN)0x7f;
+#endif
                h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
        }
        return h;
@@ -5396,7 +5404,8 @@ static BUN
 mbrHASH(const void *ATOM)
 {
        const mbr *atom = ATOM;
-       return (BUN) (((int) atom->xmin * (int)atom->ymin) *((int) atom->xmax * 
(int)atom->ymax));
+       return ATOMhash(TYPE_flt, &atom->xmin) ^ ATOMhash(TYPE_flt, 
&atom->ymin) ^
+               ATOMhash(TYPE_flt, &atom->xmax) ^ ATOMhash(TYPE_flt, 
&atom->ymax);
 }
 
 static const void *
@@ -5622,7 +5631,15 @@ wkbaHASH(const void *WARRAY)
        for (j = 0; j < wArray->itemsNum; j++) {
                wkb *w = wArray->data[j];
                for (i = 0; i < (w->len - 1); i += 2) {
-                       int a = *(w->data + i), b = *(w->data + i + 1);
+                       BUN a = ((unsigned char *) w->data)[i];
+                       BUN b = ((unsigned char *) w->data)[i + 1];
+#if '\377' < 0                                 /* char is signed? */
+                       /* maybe sign extend */
+                       if (a & 0x80)
+                               a |= ~(BUN)0x7f;
+                       if (b & 0x80)
+                               b |= ~(BUN)0x7f;
+#endif
                        h = (h << 3) ^ (h >> 11) ^ (h >> 17) ^ (b << 8) ^ a;
                }
        }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to