Changeset: ae903f4597e4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ae903f4597e4
Modified Files:
        sql/src/backends/monet5/sql_result.mx
Branch: Oct2010
Log Message:

"fixing" (?) compilation with MSVC on Windows:
The Microsoft compiler correctly found the following

sql_result.mx:371: '=' : conversion from 'ssize_t' to 'int', possible loss of 
data

371   } else if ((len = GDKstrFromStr(c->data, (unsigned char *) s, (ssize_t) 
(e - s))) < 0) {


For now, we blindly cast the ssize_t result of GDKstrFromStr() to int,
hoping no string exceed 2 GB length.
While GDKstrFromStr() returns ssize_t, other related functions
like atomFromStr() and strLength()
appear to simply treat string length as int,
emposing an implicit 2 GB upper limit.


diffs (22 lines):

diff -r 9c237560f639 -r ae903f4597e4 sql/src/backends/monet5/sql_result.mx
--- a/sql/src/backends/monet5/sql_result.mx     Sun Dec 12 10:37:17 2010 +0100
+++ b/sql/src/backends/monet5/sql_result.mx     Sun Dec 12 23:20:53 2010 +0100
@@ -359,6 +359,7 @@
        if (type == TYPE_str) {
                sql_column *col = (sql_column*)c->extra;
                int len = (int) (e - s + 1); /* 64bit: should check for 
overflow */
+               /* or shouldn't len rather be ssize_t, here? */
 
                if (c->len < len){
                        c->len = len;
@@ -368,7 +369,9 @@
                if (s == e) {
                        len = -1;
                        *(char*)c->data = 0;
-               } else if ((len = GDKstrFromStr(c->data, (unsigned char *) s, 
(ssize_t) (e - s))) < 0) {
+               } else if ((len = (int)GDKstrFromStr(c->data, (unsigned char *) 
s, (ssize_t) (e - s))) < 0) {
+                       /* 64bit: should check for overflow */
+                       /* or shouldn't len rather be ssize_t, here? */
                        return NULL;
                }
                if (col->type.digits > 0 && len > 0 && len > 
(int)col->type.digits) { 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to