Changeset: 5a127d2a5309 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5a127d2a5309
Added Files:
        sql/test/BugTracker-2015/Tests/incorrect_result_type.Bug-3687.sql
        sql/test/BugTracker-2015/Tests/incorrect_result_type.Bug-3687.stable.err
        sql/test/BugTracker-2015/Tests/incorrect_result_type.Bug-3687.stable.out
        sql/test/BugTracker-2015/Tests/operator-priority.Bug-3686.sql
        sql/test/BugTracker-2015/Tests/operator-priority.Bug-3686.stable.err
        sql/test/BugTracker-2015/Tests/operator-priority.Bug-3686.stable.out
Modified Files:
        clients/Tests/SQL-dump_all.stable.out
        clients/Tests/SQL-dump_all.stable.out.int128
        clients/Tests/SQL-dump_all.stable.out.oid32
        clients/Tests/SQL-dump_all.stable.out.oid32.int128
        clients/Tests/SQL-dump_geom.stable.out
        clients/Tests/SQL-dump_geom.stable.out.32bit
        clients/Tests/SQL-dump_geom.stable.out.64bit.oid32
        clients/Tests/SQL-dump_none.stable.out
        clients/mapilib/mapi.c
        clients/odbc/driver/SQLBrowseConnect.c
        clients/odbc/driver/SQLGetDescField.c
        clients/odbc/driver/SQLGetInfo.c
        clients/odbc/driver/SQLGetStmtAttr.c
        gdk/gdk_atoms.c
        gdk/gdk_bbp.c
        gdk/gdk_storage.c
        gdk/gdk_utils.c
        monetdb5/mal/mal_session.c
        monetdb5/modules/mal/mal_mapi.c
        sql/benchmarks/ATIS/Tests/select_group.stable.out
        sql/benchmarks/ssbm/Tests/01-explain.stable.out
        sql/benchmarks/ssbm/Tests/01-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/02-explain.stable.out
        sql/benchmarks/ssbm/Tests/02-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/03-explain.stable.out
        sql/benchmarks/ssbm/Tests/03-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/04-explain.stable.out
        sql/benchmarks/ssbm/Tests/04-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/05-explain.stable.out
        sql/benchmarks/ssbm/Tests/05-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/06-explain.stable.out
        sql/benchmarks/ssbm/Tests/06-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/07-explain.stable.out
        sql/benchmarks/ssbm/Tests/07-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/08-explain.stable.out
        sql/benchmarks/ssbm/Tests/08-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/09-explain.stable.out
        sql/benchmarks/ssbm/Tests/09-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/10-explain.stable.out
        sql/benchmarks/ssbm/Tests/10-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/11-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/12-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/13-explain.stable.out.int128
        sql/benchmarks/tpch/14.sql
        sql/benchmarks/tpch/Tests/01-explain.stable.out
        sql/benchmarks/tpch/Tests/01-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/12-explain.stable.out
        sql/benchmarks/tpch/Tests/12-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/14-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/14-plan.stable.out.int128
        sql/benchmarks/tpch/Tests/18-explain.stable.out
        sql/benchmarks/tpch/Tests/18-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/20-explain.stable.out
        sql/benchmarks/tpch/Tests/20-explain.stable.out.32bit
        sql/benchmarks/tpch/Tests/20-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/20-plan.stable.out
        sql/benchmarks/tpch/Tests/20-plan.stable.out.int128
        sql/common/sql_types.c
        
sql/test/BugTracker-2009/Tests/case_evaluates_all_branches.SF-2893484.stable.out
        sql/test/BugTracker-2015/Tests/All
        tools/merovingian/daemon/client.c
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (truncated from 2758 to 300 lines):

diff --git a/clients/Tests/SQL-dump_all.stable.out.int128 
b/clients/Tests/SQL-dump_all.stable.out.int128
--- a/clients/Tests/SQL-dump_all.stable.out.int128
+++ b/clients/Tests/SQL-dump_all.stable.out.int128
@@ -1642,10 +1642,10 @@ 6999    "sorted"        "boolean"       1       0       
7000    NULL    tr
 7002   "schema"        "clob"  0       0       7010    NULL    true    0       
NULL
 7003   "table" "clob"  0       0       7010    NULL    true    1       NULL
 7004   "count" "bigint"        64      0       7010    NULL    true    2       
NULL
-7005   "columnsize"    "hugeint"       64      0       7010    NULL    true    
3       NULL
-7006   "heapsize"      "hugeint"       64      0       7010    NULL    true    
4       NULL
-7007   "hashes"        "hugeint"       64      0       7010    NULL    true    
5       NULL
-7008   "imprints"      "hugeint"       64      0       7010    NULL    true    
6       NULL
+7005   "columnsize"    "hugeint"       128     0       7010    NULL    true    
3       NULL
+7006   "heapsize"      "hugeint"       128     0       7010    NULL    true    
4       NULL
+7007   "hashes"        "hugeint"       128     0       7010    NULL    true    
5       NULL
+7008   "imprints"      "hugeint"       128     0       7010    NULL    true    
6       NULL
 7009   "auxiliary"     "hugeint"       128     0       7010    NULL    true    
7       NULL
 7012   "column_id"     "int"   32      0       7023    NULL    true    0       
NULL
 7013   "type"  "clob"  0       0       7023    NULL    true    1       NULL
diff --git a/clients/Tests/SQL-dump_all.stable.out.oid32.int128 
b/clients/Tests/SQL-dump_all.stable.out.oid32.int128
--- a/clients/Tests/SQL-dump_all.stable.out.oid32.int128
+++ b/clients/Tests/SQL-dump_all.stable.out.oid32.int128
@@ -1647,10 +1647,10 @@ 6999    "sorted"        "boolean"       1       0       
7000    NULL    tr
 7002   "schema"        "clob"  0       0       7010    NULL    true    0       
NULL
 7003   "table" "clob"  0       0       7010    NULL    true    1       NULL
 7004   "count" "bigint"        64      0       7010    NULL    true    2       
NULL
-7005   "columnsize"    "hugeint"       64      0       7010    NULL    true    
3       NULL
-7006   "heapsize"      "hugeint"       64      0       7010    NULL    true    
4       NULL
-7007   "hashes"        "hugeint"       64      0       7010    NULL    true    
5       NULL
-7008   "imprints"      "hugeint"       64      0       7010    NULL    true    
6       NULL
+7005   "columnsize"    "hugeint"       128     0       7010    NULL    true    
3       NULL
+7006   "heapsize"      "hugeint"       128     0       7010    NULL    true    
4       NULL
+7007   "hashes"        "hugeint"       128     0       7010    NULL    true    
5       NULL
+7008   "imprints"      "hugeint"       128     0       7010    NULL    true    
6       NULL
 7009   "auxiliary"     "hugeint"       128     0       7010    NULL    true    
7       NULL
 7012   "column_id"     "int"   32      0       7023    NULL    true    0       
NULL
 7013   "type"  "clob"  0       0       7023    NULL    true    1       NULL
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -4278,8 +4278,11 @@ mapi_query_part(MapiHdl hdl, const char 
                char *q;
 
                if (sz < 512 &&
-                   (q = realloc(hdl->query, sz + size + 1)) != NULL)
-                       hdl->query = strncat(q, query, size);
+                   (q = realloc(hdl->query, sz + size + 1)) != NULL) {
+                       strncpy(q + sz, query, size);
+                       q[sz + size] = 0;
+                       hdl->query = q;
+               }
        }
 
        if (mid->trace == MAPI_TRACE) {
diff --git a/clients/odbc/driver/SQLBrowseConnect.c 
b/clients/odbc/driver/SQLBrowseConnect.c
--- a/clients/odbc/driver/SQLBrowseConnect.c
+++ b/clients/odbc/driver/SQLBrowseConnect.c
@@ -55,8 +55,10 @@ MNDBBrowseConnect(ODBCDbc *dbc,
        SQLSMALLINT len = 0;
        char buf[256];
        int n;
+       SQLRETURN rc;
+#ifdef ODBCDEBUG
        int allocated = 0;
-       SQLRETURN rc;
+#endif
 
        fixODBCstring(InConnectionString, StringLength1, SQLSMALLINT, 
addDbcError, dbc, return SQL_ERROR);
 
@@ -71,32 +73,37 @@ MNDBBrowseConnect(ODBCDbc *dbc,
                return SQL_ERROR;
        }
 
-       dsn = dbc->dsn;
-       uid = dbc->uid;
-       pwd = dbc->pwd;
-       host = dbc->host;
+       dsn = dbc->dsn ? strdup(dbc->dsn) : NULL;
+       uid = dbc->uid ? strdup(dbc->uid) : NULL;
+       pwd = dbc->pwd ? strdup(dbc->pwd) : NULL;
+       host = dbc->host ? strdup(dbc->host) : NULL;
        port = dbc->port;
-       dbname = dbc->dbname;
+       dbname = dbc->dbname ? strdup(dbc->dbname) : NULL;
 
        while ((n = ODBCGetKeyAttr(&InConnectionString, &StringLength1, &key, 
&attr)) > 0) {
                if (strcasecmp(key, "dsn") == 0 && dsn == NULL) {
+                       if (dsn)
+                               free(dsn);
                        dsn = attr;
-                       allocated |= 1;
                } else if (strcasecmp(key, "uid") == 0 && uid == NULL) {
+                       if (uid)
+                               free(uid);
                        uid = attr;
-                       allocated |= 2;
                } else if (strcasecmp(key, "pwd") == 0 && pwd == NULL) {
+                       if (pwd)
+                               free(pwd);
                        pwd = attr;
-                       allocated |= 4;
                } else if (strcasecmp(key, "host") == 0 && host == NULL) {
+                       if (host)
+                               free(host);
                        host = attr;
-                       allocated |= 8;
                } else if (strcasecmp(key, "port") == 0 && port == 0) {
                        port = atoi(attr);
                        free(attr);
                } else if (strcasecmp(key, "database") == 0 && dbname == NULL) {
+                       if (dbname)
+                               free(dbname);
                        dbname = attr;
-                       allocated |= 16;
 #ifdef ODBCDEBUG
                } else if (strcasecmp(key, "logfile") == 0 &&
                           getenv("ODBCDEBUG") == NULL) {
@@ -104,7 +111,7 @@ MNDBBrowseConnect(ODBCDbc *dbc,
                        if (ODBCdebug)
                                free((void *) ODBCdebug); /* discard const */
                        ODBCdebug = attr;
-                       allocated |= 32;
+                       allocated = 1;
 #endif
                } else
                        free(attr);
@@ -120,7 +127,6 @@ MNDBBrowseConnect(ODBCDbc *dbc,
                                uid = strdup(buf);
                                if (uid == NULL)
                                        goto nomem;
-                               allocated |= 2;
                        }
                }
                if (pwd == NULL) {
@@ -129,7 +135,6 @@ MNDBBrowseConnect(ODBCDbc *dbc,
                                pwd = strdup(buf);
                                if (pwd == NULL)
                                        goto nomem;
-                               allocated |= 4;
                        }
                }
                if (host == NULL) {
@@ -138,7 +143,6 @@ MNDBBrowseConnect(ODBCDbc *dbc,
                                host = strdup(buf);
                                if (host == NULL)
                                        goto nomem;
-                               allocated |= 8;
                        }
                }
                if (port == 0) {
@@ -153,11 +157,10 @@ MNDBBrowseConnect(ODBCDbc *dbc,
                                dbname = strdup(buf);
                                if (dbname == NULL)
                                        goto nomem;
-                               allocated |= 16;
                        }
                }
 #ifdef ODBCDEBUG
-               if ((allocated & 32) == 0 && getenv("ODBCDEBUG") == NULL) {
+               if (!allocated && getenv("ODBCDEBUG") == NULL) {
                        /* if not set from InConnectionString argument
                         * or environment, look in profile */
                        n = SQLGetPrivateProfileString(dsn, "logfile", "", buf, 
sizeof(buf), "odbc.ini");
@@ -229,15 +232,15 @@ MNDBBrowseConnect(ODBCDbc *dbc,
        }
 
   bailout:
-       if (allocated & 1)
+       if (dsn)
                free(dsn);
-       if (allocated & 2)
+       if (uid)
                free(uid);
-       if (allocated & 4)
+       if (pwd)
                free(pwd);
-       if (allocated & 8)
+       if (host)
                free(host);
-       if (allocated & 16)
+       if (dbname)
                free(dbname);
        return rc;
 
diff --git a/clients/odbc/driver/SQLGetDescField.c 
b/clients/odbc/driver/SQLGetDescField.c
--- a/clients/odbc/driver/SQLGetDescField.c
+++ b/clients/odbc/driver/SQLGetDescField.c
@@ -126,8 +126,12 @@ MNDBGetDescField(ODBCDesc *desc,
                WriteData(ValuePtr, rec->sql_desc_concise_type, SQLSMALLINT);
                return SQL_SUCCESS;
        case SQL_DESC_DATA_PTR:                 /* SQLPOINTER */
+#ifndef STATIC_CODE_ANALYSIS
+               /* Coverity doesn't like the debug print in WriteData,
+                * so we hide this whole thing */
                if (!isIRD(desc))
                        WriteData(ValuePtr, rec->sql_desc_data_ptr, SQLPOINTER);
+#endif
                return SQL_SUCCESS;
        case SQL_DESC_DATETIME_INTERVAL_CODE:   /* SQLSMALLINT */
                WriteData(ValuePtr, rec->sql_desc_datetime_interval_code, 
SQLSMALLINT);
diff --git a/clients/odbc/driver/SQLGetInfo.c b/clients/odbc/driver/SQLGetInfo.c
--- a/clients/odbc/driver/SQLGetInfo.c
+++ b/clients/odbc/driver/SQLGetInfo.c
@@ -1677,6 +1677,7 @@ SQLGetInfoW(SQLHDBC ConnectionHandle,
        if (ptr != InfoValuePtr) {
                if (rc == SQL_SUCCESS_WITH_INFO) {
                        clearDbcErrors(dbc);
+                       free(ptr);
                        ptr = malloc(++n); /* add one for NULL byte */
                        if (ptr == NULL) {
                                /* Memory allocation error */
diff --git a/clients/odbc/driver/SQLGetStmtAttr.c 
b/clients/odbc/driver/SQLGetStmtAttr.c
--- a/clients/odbc/driver/SQLGetStmtAttr.c
+++ b/clients/odbc/driver/SQLGetStmtAttr.c
@@ -41,12 +41,16 @@ MNDBGetStmtAttr(ODBCStmt *stmt,
         * StringLengthPtr */
 
        switch (Attribute) {
+#ifndef STATIC_CODE_ANALYSIS
+       /* Coverity doesn't like the debug print in WriteData, so we
+        * hide this whole thing */
        case SQL_ATTR_APP_PARAM_DESC:           /* SQLHANDLE */
                WriteData(ValuePtr, stmt->ApplParamDescr, SQLHANDLE);
                return SQL_SUCCESS;
        case SQL_ATTR_APP_ROW_DESC:             /* SQLHANDLE */
                WriteData(ValuePtr, stmt->ApplRowDescr, SQLHANDLE);
                return SQL_SUCCESS;
+#endif
        case SQL_ATTR_ASYNC_ENABLE:             /* SQLULEN */
                /* SQL_ASYNC_ENABLE */
                WriteData(ValuePtr, SQL_ASYNC_ENABLE_OFF, SQLULEN);
@@ -65,12 +69,16 @@ MNDBGetStmtAttr(ODBCStmt *stmt,
                /* SQL_CURSOR_TYPE */
                WriteData(ValuePtr, stmt->cursorType, SQLULEN);
                break;
+#ifndef STATIC_CODE_ANALYSIS
+       /* Coverity doesn't like the debug print in WriteData, so we
+        * hide this whole thing */
        case SQL_ATTR_IMP_PARAM_DESC:           /* SQLHANDLE */
                WriteData(ValuePtr, stmt->ImplParamDescr, SQLHANDLE);
                return SQL_SUCCESS;
        case SQL_ATTR_IMP_ROW_DESC:             /* SQLHANDLE */
                WriteData(ValuePtr, stmt->ImplRowDescr, SQLHANDLE);
                return SQL_SUCCESS;
+#endif
        case SQL_ATTR_MAX_LENGTH:               /* SQLULEN */
                /* SQL_MAX_LENGTH */
                WriteData(ValuePtr, 0, SQLULEN);
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -894,8 +894,6 @@ fltFromStr(const char *src, int *len, fl
                errno = 0;
                f = strtof(src, &pe);
                p = pe;
-               while (GDKisspace(*p))
-                       p++;
                n = (int) (p - src);
                if (n == 0 || (errno == ERANGE && (f < -1 || f > 1))
 #ifdef INFINITY
@@ -922,8 +920,11 @@ fltFromStr(const char *src, int *len, fl
                {
                        **dst = flt_nil; /* default return value is nil */
                        n = 0;
-               } else
+               } else {
+                       while (src[n] && GDKisspace(src[n]))
+                               n++;
                        **dst = (flt) f;
+               }
        }
        return n;
 }
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1501,7 +1501,7 @@ BBPdir(int cnt, bat *subcommit)
        }
        if (fclose(fp) == EOF) {
                GDKsyserror("BBPdir: Closing BBP.dir file failed\n");
-               goto bailout;
+               return -1;
        }
 
        IODEBUG fprintf(stderr, "#BBPdir end\n");
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -435,7 +435,13 @@ GDKload(int farmid, const char *nme, con
                                 * only accepts int */
                                for (n_expected = (ssize_t) size; n_expected > 
0; n_expected -= n) {
                                        n = read(fd, dst, (unsigned) MIN(1 << 
30, n_expected));
+#ifndef STATIC_CODE_ANALYSIS
+                                       /* Coverity doesn't seem to
+                                        * recognize that we're just
+                                        * printing the value of ptr,
+                                        * not its contents */
                                        IODEBUG fprintf(stderr, "#read(dst " 
PTRFMT ", n_expected " SSZFMT ", fd %d) = " SSZFMT "\n", PTRFMTCAST(void *)dst, 
n_expected, fd, n);
+#endif
 
                                        if (n <= 0)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to