Changeset: 8db492fb5e83 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8db492fb5e83
Modified Files:
        clients/odbc/driver/ODBCConvert.c
        configure.ag
        monetdb5/mal/mal_atom.c
        monetdb5/mal/mal_profiler.c
        sql/backends/monet5/vaults/fits.c
        
sql/test/BugTracker-2015/Tests/insert_into_merge_table_crash.Bug-3703.stable.err
        
sql/test/BugTracker-2015/Tests/insert_into_merge_table_crash.Bug-3703.stable.out
        
sql/test/BugTracker-2015/Tests/local-remotetable-crash.Bug-3754.stable.err
        
sql/test/BugTracker-2015/Tests/local-remotetable-crash.Bug-3754.stable.out
Branch: default
Log Message:

Merge with Jul2015 branch.


diffs (truncated from 371 to 300 lines):

diff --git a/clients/odbc/driver/ODBCConvert.c 
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -511,7 +511,7 @@ parseoptionalbracketednumber(char **sval
                        return SQL_ERROR;
                slen -= (int) (eptr - sval);
                sval = eptr;
-               *val2p = val;
+               *val2p = (int) val;
        }
 
        if (slen == 0 || *sval != ')')
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2804,7 +2804,7 @@ AC_DEFINE([__hidden], [/* empty */],
 
 dnl     checks for library functions
 case $host in
-       *-darwin1[[01234]]*)
+       *-darwin1[[012345]]*)
                # OSX 10.6 (Snow Leopard) and up somehow makes configure believe
                # that fdatasync exists, in reality however, it does not on this
                # platform.
diff --git a/monetdb5/mal/mal_atom.c b/monetdb5/mal/mal_atom.c
--- a/monetdb5/mal/mal_atom.c
+++ b/monetdb5/mal/mal_atom.c
@@ -121,7 +121,7 @@ int malAtomProperty(MalBlkPtr mb, InstrP
                break;
        case 's':
                if (idcmp("storage", name) == 0 && pci->argc == 1) {
-                       BATatoms[tpe].storage = (*(long (*)(void))pci->fcn)();
+                       BATatoms[tpe].storage = (*(int (*)(void))pci->fcn)();
                        setAtomName(pci);
                        return 1;
                }
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -164,9 +164,6 @@ offlineProfilerEvent(MalBlkPtr mb, MalSt
        /* make basic profile event tuple  */
        lognew();
 
-       /* without this cast, compilation on Windows fails with
-        * argument of type "long *" is incompatible with parameter of type 
"const time_t={__time64_t={__int64}} *"
-        */
 #ifdef HAVE_CTIME_R3
        tbuf = ctime_r(&clk, ctm, sizeof(ctm));
 #else
@@ -177,7 +174,9 @@ offlineProfilerEvent(MalBlkPtr mb, MalSt
 #endif
 #endif
        tbuf[19]=0;
-       logadd("\"%s.%06ld\",\t", tbuf+11, (long)clock.tv_usec);
+       /* there should be less than 10^6 == 1M usecs in 1 sec */
+       assert(clock.tv_usec >= 0 && clock.tv_usec < 1000000);
+       logadd("\"%s.%06d\",\t", tbuf+11, (int) clock.tv_usec);
        if( alter){
                logadd("\"user.%s[0]0\",\t",alter);
        } else {
@@ -690,9 +689,6 @@ cachedProfilerEvent(MalBlkPtr mb, MalStk
        getModuleId(getInstrPtr(mb, 0)),
        getFunctionId(getInstrPtr(mb, 0)), getPC(mb, pci), stk->tag);
 
-       /* without this cast, compilation on Windows fails with
-        * argument of type "long *" is incompatible with parameter of type 
"const time_t={__time64_t={__int64}} *"
-        */
 #ifdef HAVE_CTIME_R3
        if (ctime_r(&clk, ctm, sizeof(ctm)) == NULL)
                strncpy(ctm, "", sizeof(ctm));
diff --git a/sql/backends/monet5/vaults/fits.c 
b/sql/backends/monet5/vaults/fits.c
--- a/sql/backends/monet5/vaults/fits.c
+++ b/sql/backends/monet5/vaults/fits.c
@@ -121,7 +121,7 @@ fits2mtype(int t)
 }
 
 static int
-fits2subtype(sql_subtype *tpe, int t, long rep, long wid)
+fits2subtype(sql_subtype *tpe, int t, long rep, long wid) /* type long used by 
fits library */
 {
        (void)rep;
        switch (t) {
@@ -176,19 +176,21 @@ str FITSexportTable(Client cntxt, MalBlk
        str type, name, *colname, *tform;
        fitsfile *fptr;
        char filename[BUFSIZ];
-       long nrows = 0, optimal;
+       size_t nrows = 0;
+       long optimal; /* type long used by fits library */
        rids * rs;
 
-       int tm0, texportboolean=0, texportchar=0, texportstring=0, 
texportshort=0, texportint=0, texportlong=0, texportfloat=0, texportdouble=0;
-       int numberrow = 0, cc = 0, status = 0, j = 0, columns, *fid, dimension 
= 0, block = 0;
-       int boolcols = 0, charcols = 0, strcols = 0, shortcols = 0, intcols = 
0, longcols = 0, floatcols = 0, doublecols = 0;
+       int tm0, texportboolean=0, texportchar=0, texportstring=0, 
texportshort=0, texportint=0, texportlng=0, texportfloat=0, texportdouble=0;
+       size_t numberrow = 0, dimension = 0;
+       int cc = 0, status = 0, j = 0, columns, *fid, block = 0;
+       int boolcols = 0, charcols = 0, strcols = 0, shortcols = 0, intcols = 
0, lngcols = 0, floatcols = 0, doublecols = 0;
        int hdutype;
 
        char *charvalue, *readcharrows;
        str strvalue; char **readstrrows;
        short *shortvalue, *readshortrows;
        int *intvalue, *readintrows;
-       long *longvalue, *readlongrows;
+       lng *lngvalue, *readlngrows;
        float *realvalue, *readfloatrows;
        double *doublevalue, *readdoublerows;
        _Bool *boolvalue, *readboolrows;
@@ -264,6 +266,7 @@ str FITSexportTable(Client cntxt, MalBlk
        col = mvc_bind_column(m, tbl, colname[0]);
 
        nrows = store_funcs.count_col(tr, col, 1);
+       assert(nrows <= (size_t) GDK_oid_max);
 
        snprintf(filename,BUFSIZ,"\n%s.fit",tname);
        fprintf(stderr, "Filename: %s\n", filename);
@@ -294,12 +297,12 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               boolvalue = (_Bool*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               boolvalue = (_Bool*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readboolrows[dimension] = *boolvalue;
                                GDKfree(boolvalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
@@ -324,12 +327,12 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               charvalue = (char*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               charvalue = (char*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readcharrows[dimension] = *charvalue;
                                GDKfree(charvalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
@@ -354,17 +357,17 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               strvalue = (char *) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               strvalue = (char *) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readstrrows[dimension] = strvalue;
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
                                        fits_write_col_str(fptr, cc+1, 
(optimal*block)+1, 1, optimal, readstrrows, &status);
                                        texportstring += GDKms() - tm0;
-                                       for (dimension = 0; dimension < 
optimal; dimension++)
+                                       for (dimension = 0; dimension < 
(size_t) optimal; dimension++)
                                                GDKfree(readstrrows[dimension]);
                                        dimension = 0;
                                        GDKfree(readstrrows);
@@ -388,12 +391,12 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               shortvalue = (short*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               shortvalue = (short*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readshortrows[dimension] = *shortvalue;
                                GDKfree(shortvalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
@@ -418,12 +421,12 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               intvalue = (int*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               intvalue = (int*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readintrows[dimension] = *intvalue;
                                GDKfree(intvalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
@@ -442,32 +445,32 @@ str FITSexportTable(Client cntxt, MalBlk
 
                if (strcmp(columntype,"bigint")==0)
                {
-                       longcols++; dimension = 0; block = 0;
+                       lngcols++; dimension = 0; block = 0;
                        fits_get_rowsize(fptr,&optimal,&status);
-                       readlongrows = (long *) GDKmalloc (sizeof(long) * 
optimal);
+                       readlngrows = (lng *) GDKmalloc (sizeof(lng) * optimal);
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               longvalue = (long*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
-                               readlongrows[dimension] = *longvalue;
-                               GDKfree(longvalue);
+                               lngvalue = (lng*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
+                               readlngrows[dimension] = *lngvalue;
+                               GDKfree(lngvalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
-                                       fits_write_col(fptr, TLONG, cc+1, 
(optimal*block)+1, 1, optimal, readlongrows, &status);
-                                       texportlong += GDKms() - tm0;
-                                       GDKfree(readlongrows);
-                                       readlongrows = (long *) GDKmalloc 
(sizeof(long) * optimal);
+                                       fits_write_col(fptr, TLONG, cc+1, 
(optimal*block)+1, 1, optimal, readlngrows, &status);
+                                       texportlng += GDKms() - tm0;
+                                       GDKfree(readlngrows);
+                                       readlngrows = (lng *) GDKmalloc 
(sizeof(lng) * optimal);
                                        block++;
                                }
                        } 
                        tm0 = GDKms();
-                       fits_write_col(fptr, TLONG, cc+1, (optimal*block)+1, 1, 
dimension, readlongrows, &status);
-                       texportlong += GDKms() - tm0;
-                       GDKfree(readlongrows);
+                       fits_write_col(fptr, TLONG, cc+1, (optimal*block)+1, 1, 
dimension, readlngrows, &status);
+                       texportlng += GDKms() - tm0;
+                       GDKfree(readlngrows);
                }
 
                if (strcmp(columntype,"real")==0)
@@ -478,12 +481,12 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               realvalue = (float*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               realvalue = (float*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readfloatrows[dimension] = *realvalue;
                                GDKfree(realvalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
@@ -508,12 +511,12 @@ str FITSexportTable(Client cntxt, MalBlk
 
                        for (numberrow = 0; numberrow < nrows ; numberrow++)
                        {
-                               doublevalue = (double*) 
table_funcs.column_find_value(m->session->tr, col, numberrow);
+                               doublevalue = (double*) 
table_funcs.column_find_value(m->session->tr, col, (oid) numberrow);
                                readdoublerows[dimension] = *doublevalue;
                                GDKfree(doublevalue);
                                dimension++;
 
-                               if (dimension == optimal)
+                               if (dimension == (size_t) optimal)
                                {
                                        dimension = 0;
                                        tm0 = GDKms();
@@ -539,7 +542,7 @@ str FITSexportTable(Client cntxt, MalBlk
        if (texportstring > 0)          fprintf(stderr, "%d String\tcolumn(s) 
exported in %d ms\n",  strcols,    texportstring);
        if (texportshort > 0)           fprintf(stderr, "%d Short\t\tcolumn(s) 
exported in %d ms\n",   shortcols,  texportshort);
        if (texportint > 0)             fprintf(stderr, "%d Integer\tcolumn(s) 
exported in %d ms\n", intcols,    texportint);
-       if (texportlong > 0)            fprintf(stderr, "%d Long\t\tcolumn(s) 
exported in %d ms\n",    longcols,   texportlong);
+       if (texportlng > 0)             fprintf(stderr, "%d Long\t\tcolumn(s) 
exported in %d ms\n",    lngcols,   texportlng);
        if (texportfloat > 0)           fprintf(stderr, "%d Float\t\tcolumn(s) 
exported in %d ms\n",   floatcols,  texportfloat);
        if (texportdouble > 0)          fprintf(stderr, "%d Double\tcolumn(s) 
exported in %d ms\n",  doublecols, texportdouble);
        */
@@ -658,7 +661,7 @@ str FITSattach(Client cntxt, MalBlkPtr m
        int status = 0, i, j, hdutype, hdunum = 1, cnum = 0, bitpixnumber = 0;
        oid fid, tid, cid, rid = oid_nil;
        char tname[BUFSIZ], *tname_low = NULL, *s, bname[BUFSIZ], stmt[BUFSIZ];
-       long tbcol;
+       long tbcol; /* type long used by fits library */
        char cname[BUFSIZ], tform[BUFSIZ], tunit[BUFSIZ], tnull[BUFSIZ], 
tdisp[BUFSIZ];
        double tscal, tzero;
        char xtensionname[BUFSIZ] = "", stilversion[BUFSIZ] = "";
@@ -829,9 +832,9 @@ str FITSloadTable(Client cntxt, MalBlkPt
        str fname;
        str msg = MAL_SUCCEED;
        oid rid = oid_nil, frid = oid_nil;
-       int status = 0, cnum = 0, *fid, *hdu, hdutype, i, j, anynull = 0, mtype;
+       int status = 0, cnum = 0, *fid, *hdu, hdutype, j, anynull = 0, mtype;
        int *tpcode = NULL;
-       long *rep = NULL, *wid = NULL, rows;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to