Update of /cvsroot/monetdb/geom/src/monetdb5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2588/src/monetdb5
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/monetdb5/geom.mx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- geom.mx 2 Aug 2008 18:44:14 -0000 1.22
+++ geom.mx 25 Aug 2008 13:38:03 -0000 1.23
@@ -421,17 +421,17 @@
/* HASH: compute a hash value. */
/* returns a positive integer hash value */
-geom_export hash_t
+geom_export BUN
mbrHASH(
mbr* atom /* IN: to-be-hashed mbr. */
);
-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. */
@@ -536,12 +536,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. */
@@ -695,14 +696,14 @@
throw(MAL, "wkb.FromText", GDKerrbuf);
}
-geom_export hash_t
+geom_export BUN
wkbHASH(wkb *w);
-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];
@@ -815,7 +816,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;
}
@@ -905,7 +906,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