Changeset: ae731b040654 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ae731b040654
Modified Files:
        configure.ag
        monetdb5/mal/mal.c
Branch: default
Log Message:

Merged from Aug2011


diffs (185 lines):

diff --git a/clients/odbc/driver/SQLBindParameter.c 
b/clients/odbc/driver/SQLBindParameter.c
--- a/clients/odbc/driver/SQLBindParameter.c
+++ b/clients/odbc/driver/SQLBindParameter.c
@@ -200,7 +200,7 @@ SQLBindParameter_(ODBCStmt *stmt,
 /*     case SQL_WVARCHAR: */
 /*     case SQL_WLONGVARCHAR: */
        case SQL_BIT:
-/*     case SQL_TINYINT: */
+       case SQL_TINYINT:
        case SQL_SMALLINT:
        case SQL_INTEGER:
        case SQL_BIGINT:
@@ -229,7 +229,6 @@ SQLBindParameter_(ODBCStmt *stmt,
        case SQL_WCHAR:
        case SQL_WVARCHAR:
        case SQL_WLONGVARCHAR:
-       case SQL_TINYINT:
        case SQL_GUID:
                /* Optional feature not implemented */
                addStmtError(stmt, "HYC00", NULL, 0);
diff --git a/clients/odbc/driver/SQLExecute.c b/clients/odbc/driver/SQLExecute.c
--- a/clients/odbc/driver/SQLExecute.c
+++ b/clients/odbc/driver/SQLExecute.c
@@ -61,7 +61,7 @@ static struct msql_types {
        {"table", 0},
        {"time", SQL_TYPE_TIME},
        {"timestamp", SQL_TYPE_TIMESTAMP},
-/*     {"tinyint", SQL_TINYINT}, */
+       {"tinyint", SQL_TINYINT},
 /*     {"ubyte", SQL_TINYINT}, */
        {"varchar", SQL_VARCHAR},
        {"wrd", SQL_BIGINT},
diff --git a/clients/odbc/samples/odbcsample1.c 
b/clients/odbc/samples/odbcsample1.c
--- a/clients/odbc/samples/odbcsample1.c
+++ b/clients/odbc/samples/odbcsample1.c
@@ -157,7 +157,7 @@ main(int argc, char **argv)
                        check(ret, SQL_HANDLE_STMT, stmt, "SQLFetch");
                        switch (colno) {
                        case 1:
-                               SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, 
SQL_C_SSHORT, coltype, 0, 0, &f1, sizeof(f1), NULL);
+                               ret = SQLBindParameter(stmt, 1, 
SQL_PARAM_INPUT, SQL_C_SSHORT, coltype, 0, 0, &f1, sizeof(f1), NULL);
                                check(ret, SQL_HANDLE_STMT, stmt, 
"SQLBindParameter 1");
                                break;
                        case 2:
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -519,11 +519,15 @@ AC_DEFUN([MCHECK_ADD_FLAG],
        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 
-int main(void) {
+int main(int argc, char **av) {
        char buf[24];
        double d = atof("4.2");
-       snprintf(buf, sizeof(buf), "%f", d);
+       if (argc == 0 || strchr(av[0], av[0][0]) != NULL)
+               snprintf(buf, sizeof(buf), "%f", d);
        return 0;
 }
                                          ]])],
diff --git a/gdk/gdk_atoms.mx b/gdk/gdk_atoms.mx
--- a/gdk/gdk_atoms.mx
+++ b/gdk/gdk_atoms.mx
@@ -782,45 +782,45 @@ ATOMnil(int t)
        } while (0)
 
 #define ATOMreplace(type, heap, dst, src)                              \
-do {                                                                   \
-       int t_ = (type);                                                \
-       ptr d_ = (ptr) (dst);                                           \
-       ptr s_ = (ptr) (src);                                           \
+       do {                                                            \
+               int t_ = (type);                                        \
+               ptr d_ = (ptr) (dst);                                   \
+               ptr s_ = (ptr) (src);                                   \
                                                                        \
-       if (BATatoms[t_].atomPut) {                                     \
-               var_t loc_ = * (var_t *) d_;                            \
-               Heap *h_ = (heap);                                      \
+               if (BATatoms[t_].atomPut) {                             \
+                       var_t loc_ = * (var_t *) d_;                    \
+                       Heap *h_ = (heap);                              \
                                                                        \
-               if ((*BATatoms[t_].atomPut)(h_, &loc_, s_) == 0)        \
-                       goto bunins_failed;                             \
-               ATOMunfix(t_, d_);                                      \
-               ATOMdel(t_, h_, d_);                                    \
-               * (var_t *) d_ = loc_;                                  \
-               ATOMfix(t_, s_);                                        \
-       } else {                                                        \
-               ATOMfix(t_, s_);                                        \
-               ATOMunfix(t_, d_);                                      \
-               switch (BATatoms[t_].size) {                            \
-               case 0:         /* void */                              \
-                       break;                                          \
-               case 1:                                                 \
-                       * (bte *) d_ = * (bte *) s_;                    \
-                       break;                                          \
-               case 2:                                                 \
-                       * (sht *) d_ = * (sht *) s_;                    \
-                       break;                                          \
-               case 4:                                                 \
-                       * (int *) d_ = * (int *) s_;                    \
-                       break;                                          \
-               case 8:                                                 \
-                       * (lng *) d_ = * (lng *) s_;                    \
-                       break;                                          \
-               default:                                                \
-                       memcpy(d_, s_, (size_t) BATatoms[t_].size);     \
-                       break;                                          \
+                       if ((*BATatoms[t_].atomPut)(h_, &loc_, s_) == 0) \
+                               goto bunins_failed;                     \
+                       ATOMunfix(t_, d_);                              \
+                       ATOMdel(t_, h_, d_);                            \
+                       * (var_t *) d_ = loc_;                          \
+                       ATOMfix(t_, s_);                                \
+               } else {                                                \
+                       ATOMfix(t_, s_);                                \
+                       ATOMunfix(t_, d_);                              \
+                       switch (BATatoms[t_].size) {                    \
+                       case 0:         /* void */                      \
+                               break;                                  \
+                       case 1:                                         \
+                               * (bte *) d_ = * (bte *) s_;            \
+                               break;                                  \
+                       case 2:                                         \
+                               * (sht *) d_ = * (sht *) s_;            \
+                               break;                                  \
+                       case 4:                                         \
+                               * (int *) d_ = * (int *) s_;            \
+                               break;                                  \
+                       case 8:                                         \
+                               * (lng *) d_ = * (lng *) s_;            \
+                               break;                                  \
+                       default:                                        \
+                               memcpy(d_, s_, (size_t) BATatoms[t_].size); \
+                               break;                                  \
+                       }                                               \
                }                                                       \
-       }                                                               \
-} while (0)
+       } while (0)
 
 /* string heaps:
  * - strings are 8 byte aligned
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -206,6 +206,7 @@ MT_Lock     mal_copyLock;
 static
 void tstAligned(void)
 {
+#ifdef STRUCT_ALIGNED
        int allAligned=0;
        ValRecord v;
        ptr val, base;
@@ -221,7 +222,6 @@ void tstAligned(void)
        val= (ptr) & v.val.dval; if(val != base){ allAligned = -1; }
        val= (ptr) & v.val.lval; if(val != base){ allAligned = -1; }
        val= (ptr) & v.val.sval; if(val != base){ allAligned = -1; }
-#ifdef STRUCT_ALIGNED
        if(allAligned<0)
            GDKfatal("Recompile with STRUCT_ALIGNED flag disabled\n");
 #endif
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1365,7 +1365,11 @@ sqltypeinit(void)
                        sql_create_func("scale_up", "calc", "*", *u, *t, *t, 
SCALE_NONE);
        }
 
-       for (t = dates-1; t >= floats; t--) {
+       /* initial assignment to t is on purpose like this, such that the
+        * compiler (as of gcc-4.6) "sees" that we never go below the
+        * initial pointer, and hence don't get a
+        * error: array subscript is below array bounds */
+       for (t = floats + (dates - floats - 1); t >= floats; t--) {
                sql_create_func("power", "mmath", "pow", *t, *t, *t, SCALE_FIX);
                sql_create_func("floor", "mmath", "floor", *t, NULL, *t, 
SCALE_FIX);
                sql_create_func("ceil", "mmath", "ceil", *t, NULL, *t, 
SCALE_FIX);
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to