Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17827/src/backends/monet5

Modified Files:
        sql.mx 
Log Message:

Tyring to fix the code that triggers some of the 120
"conversion from <type1> to <type2>, possible loss of data"
warnings with the Microsoft compiler on Windows (cf.,
http://monetdb.cwi.nl/testing/projects/monetdb/Current/sql/.Mic.32.32.d.1-Windows5.1..2008.08.29_00-09-02/make.out.html
):

in HEX, the lowest 31 BITs are represented by "0x7FFFFFFF", NOT "0xEFFFFFFF"

(Check the effect tomorrow at
http://monetdb.cwi.nl/testing/projects/monetdb/Current/sql/.Mic.32.32.d.1-Windows5.1/make.out.html
and
http://monetdb.cwi.nl/testing/projects/monetdb/Current/sql/.Mic.64.64.d.1-Windows5.2/make.out.html
)

Most of the remaining warnings are due to the fact that
member "ival" of struct "symbdata" in src/server/sql_symbol.mx
is defined as "lng" but often used as / assigned to "int"
(without cast or overflow check).
I will try to find a proper solution for this together with
Niels and/or Sjoerd...


U sql.mx
Index: sql.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql.mx,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -d -r1.279 -r1.280
--- sql.mx      31 Aug 2008 15:53:15 -0000      1.279
+++ sql.mx      31 Aug 2008 21:57:58 -0000      1.280
@@ -1993,7 +1993,7 @@
 zero_or_one(ptr ret, int *bid) 
 {
        BAT *b;
-       int c, _s;
+       BUN c, _s;
        ptr p;
 
        if ((b = BATdescriptor(*bid)) == NULL) {
@@ -2009,7 +2009,7 @@
                char buf[BUFSIZ];
 
                p = NULL;
-                snprintf(buf, BUFSIZ, "cardinality violation (%d>1)", c);
+                snprintf(buf, BUFSIZ, "cardinality violation (" BUNFMT ">1)", 
c);
                throw(SQL, "zero_or_one", buf);
        }
        _s = ATOMsize(ATOMtype(b->ttype));
@@ -2092,14 +2092,14 @@
 
                BATloop(b,p,q) {
                        ptr v = BUNtail(bi,p);
-                       *r++ = (hash(v)) & 0xEFFFFFFF;
+                       *r++ = (int) ((hash(v)) & 0x7FFFFFFF);
                }
        } else {
                char *v = BUNtail(bi,BUNfirst(b)), *e = BUNtail(bi,BUNlast(b));
                int sz = Tsize(b);
 
                for(; v < e; v+=sz) {
-                       *r++ = (hash(v)) & 0xEFFFFFFF;
+                       *r++ = (int) ((hash(v)) & 0x7FFFFFFF);
                }
        }
        BATsetcount(dst, (BUN) (r-f));
@@ -2138,7 +2138,7 @@
 
                BATloop(b,p,q){
                        ptr v = BUNtail(bi,p);
-                       int h = (hash(v)) & 0xEFFFFFFF;
+                       int h = (int) ((hash(v)) & 0x7FFFFFFF);
                        BUNins(dst, BUNhead(bi,p), &h, FALSE);
                }
        } else {
@@ -2146,7 +2146,7 @@
 
                BATloop(b,p,q){
                        ptr v = BUNtail(bi,p);
-                       int h = (hash(v)) & 0xEFFFFFFF;
+                       int h = (int) ((hash(v)) & 0x7FFFFFFF);
                        BUNins(dst, BUNhead(bi,p), &h, FALSE);
                }
        }
@@ -2171,9 +2171,9 @@
                return bathash_wrap(res, (int*)v); 
 
        if (ATOMextern(tpe)) /* ugh */
-               *res = (ATOMhash(tpe, *(char**)v)) & 0xEFFFFFFF;
+               *res = (int) ((ATOMhash(tpe, *(char**)v)) & 0x7FFFFFFF);
        else
-               *res = (ATOMhash(tpe, v)) & 0xEFFFFFFF;
+               *res = (int) ((ATOMhash(tpe, v)) & 0x7FFFFFFF);
        return NULL;
 }
 


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