Update of /cvsroot/monetdb/geom/src/monetdb4
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2588/src/monetdb4

Modified Files:
        geom.mx 
Log Message:
Type cleanup.

Counting and indexing BUNs in a BAT is now done exclusively using the
type BUN.  This means that e.g. the BATcount function now returns a
BUN instead of a size_t (with many more similar changes).  It also
means that all uses of the hash_t type have been replaced by BUN.

vheaps are now exclusively indexed using the type var_t.

A few new constants have been introduced:
VAR_MAX - maximum allowed value of a value of type var_t.
BUN_MAX - maximum allowed value of a value of type BUN.
OIDFMT (existed already) - format string to print a value of type oid.
BUNFMT - format string to print a value of type BUN.
VARFMT - format string to print a value of type var_t.


U geom.mx
Index: geom.mx
===================================================================
RCS file: /cvsroot/monetdb/geom/src/monetdb4/geom.mx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- geom.mx     2 Aug 2008 18:36:56 -0000       1.10
+++ geom.mx     25 Aug 2008 13:38:03 -0000      1.11
@@ -1,4 +1,4 @@
-@' tHE COntents of this file are subject to the MonetDB Public License
+@' The contents of this file are subject to the MonetDB Public License
 @' Version 1.1 (the "License"); you may not use this file except in
 @' compliance with the License. You may obtain a copy of the License at
 @' http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
@@ -302,12 +302,12 @@
 
 /* HASH: compute a hash value. */
 /* returns a positive integer hash value */
-hash_t
+BUN
 mbrHASH(
    mbr*        atom    /* IN: to-be-hashed mbr. */
 )
 {
-       return (hash_t) ( (((int) atom->xmin) * ((int) atom->ymin)) * (((int) 
atom->xmax) * ((int) atom->ymax)) );
+       return (BUN) ( (((int) atom->xmin) * ((int) atom->ymin)) * (((int) 
atom->xmax) * ((int) atom->ymax)) );
 }
 
 /* COMP: compare two mbrs. */
@@ -375,12 +375,13 @@
  * Implementation of variable-sized atom wkb.
  */
 
-static size_t
+static var_t
 wkb_size(size_t len)
 {
        if (len == ~(size_t) 0)
                len = 0;
-       return sizeof(wkb) - 1 + len;
+       assert(sizeof(wkb) - 1 + len <= VAR_MAX);
+       return (var_t) (sizeof(wkb) - 1 + len);
 }
 
 /* TOSTR: print atom in a string. */
@@ -486,11 +487,11 @@
        return GDK_FAIL;
 }
 
-hash_t
+BUN
 wkbHASH(wkb *w)
 {
        int i;
-       hash_t h = 0;
+       BUN h = 0;
 
        for (i = 0; i<(w->len-1); i+=2) {
                int a = w->data[i], b = w->data[i+1];
@@ -568,7 +569,7 @@
 int
 wkbLENGTH(wkb *p)
 {
-       size_t len = wkb_size(p->len);
+       var_t len = wkb_size(p->len);
        assert(len <= GDK_int_max);
        return (int) len;
 }
@@ -629,7 +630,7 @@
 {
        size_t wkbLen = 0; 
        unsigned char *w = GEOSGeomToWKB_buf(geosGeometry, &wkbLen);
-       wkb *atom = GDKmalloc((int)wkb_size(wkbLen));
+       wkb *atom = GDKmalloc(wkb_size(wkbLen));
 
        if (!w) {
                *atom = *wkbNULL();


-------------------------------------------------------------------------
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