Changeset: 761cb3a94a00 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=761cb3a94a00
Modified Files:
        monetdb5/mal/Tests/All
        monetdb5/mal/mal_exception.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_parser.c
        sql/backends/monet5/wlr.c
Branch: default
Log Message:

Coverity inspired minor issues.


diffs (75 lines):

diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -95,6 +95,7 @@ tst161
 tst163
 tst1604
 tst171
+tst180
 tst190
 tst191
 tst192
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -65,8 +65,8 @@ createExceptionInternal(enum malexceptio
        message = GDKmalloc(GDKMAXERRLEN);
        if (message == NULL){
                /* Leave a message behind in the logging system */
-               len = snprintf(local, GDKMAXERRLEN, "%s:%s:", 
exceptionNames[type], fcn);
-               len = vsnprintf(local + len, GDKMAXERRLEN, format, ap);
+               len = snprintf(local, GDKMAXERRLEN - 1, "%s:%s:", 
exceptionNames[type], fcn);
+               len = vsnprintf(local + len, GDKMAXERRLEN -1, format, ap);
                fprintf(stderr, "%s", local);
                return M5OutOfMemory;   /* last resort */
        }
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -1085,7 +1085,7 @@ defConstant(MalBlkPtr mb, int type, ValP
        } else if (cst->vtype != type && !isaBatType(type) && 
!isPolyType(type)) {
                int otype = cst->vtype;
                assert(type != TYPE_any);       /* help Coverity */
-               msg = convertConstant(type, cst);
+               msg = convertConstant(getBatType(type), cst);
                if (msg) {
                        str ft, tt;
 
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -869,8 +869,9 @@ term(Client cntxt, MalBlkPtr curBlk, Ins
        if ((i = cstToken(cntxt, &cst))) {
                advance(cntxt, i);
                if (currChar(cntxt) != ':' && cst.vtype == TYPE_dbl && 
cst.val.dval > FLT_MIN && cst.val.dval <= FLT_MAX) {
+                       float dummy = (flt) cst.val.dval;
                        cst.vtype = TYPE_flt;
-                       cst.val.fval = (flt) cst.val.dval;
+                       cst.val.fval = dummy;
                }
                cstidx = fndConstant(curBlk, &cst, MAL_VAR_WINDOW);
                if (cstidx >= 0) {
@@ -902,10 +903,10 @@ term(Client cntxt, MalBlkPtr curBlk, Ins
                        *curInstr = pushArgument(curBlk, *curInstr, cstidx);
                        return ret;
                } else {
-                       /* add a new constant */
+                       /* add a new constant literal, the :type could be 
erroneously be a coltype */
                        flag = currChar(cntxt) == ':';
                        tpe = typeElm(cntxt, cst.vtype);
-                       if (tpe < 0)
+                       if (tpe < 0 )
                                return 3;
                        cstidx = defConstant(curBlk, tpe, &cst);
                        if (cstidx < 0)
diff --git a/sql/backends/monet5/wlr.c b/sql/backends/monet5/wlr.c
--- a/sql/backends/monet5/wlr.c
+++ b/sql/backends/monet5/wlr.c
@@ -430,7 +430,6 @@ WLRprocessBatch(void *arg)
                        break;
        }
        (void) fflush(stderr);
-       close_stream(c->fdout);
        SQLexitClient(c);
        MCcloseClient(c);
        if(prev)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to