Changeset: dae9a6e866a0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dae9a6e866a0
Modified Files:
clients/mapilib/mapi.c
configure.ag
gdk/gdk_setop.mx
monetdb5/mal/mal_instruction.mx
sql/server/rel_schema.c
Branch: default
Log Message:
Merge with Apr2011 branch.
diffs (truncated from 833 to 300 lines):
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3287,19 +3287,19 @@
switch (hdl->params[i].intype) {
case MAPI_TINY:
checkSpace(5);
- sprintf(hdl->query + k, "%d", *(signed char *)
src);
+ sprintf(hdl->query + k, "%hhd", *(signed char
*) src);
break;
case MAPI_UTINY:
checkSpace(5);
- sprintf(hdl->query + k, "%u", *(unsigned char
*) src);
+ sprintf(hdl->query + k, "%hhu", *(unsigned char
*) src);
break;
case MAPI_SHORT:
checkSpace(10);
- sprintf(hdl->query + k, "%d", *(short *) src);
+ sprintf(hdl->query + k, "%hd", *(short *) src);
break;
case MAPI_USHORT:
checkSpace(10);
- sprintf(hdl->query + k, "%u", *(unsigned short
*) src);
+ sprintf(hdl->query + k, "%hu", *(unsigned short
*) src);
break;
case MAPI_INT:
checkSpace(20);
@@ -3336,7 +3336,7 @@
case MAPI_DATE:
checkSpace(50);
sprintf(hdl->query + k,
- "DATE '%04d-%02u-%02u'",
+ "DATE '%04hd-%02hu-%02hu'",
((MapiDate *) src)->year,
((MapiDate *) src)->month,
((MapiDate *) src)->day);
@@ -3344,7 +3344,7 @@
case MAPI_TIME:
checkSpace(60);
sprintf(hdl->query + k,
- "TIME '%02u:%02u:%02u'",
+ "TIME '%02hu:%02hu:%02hu'",
((MapiTime *) src)->hour,
((MapiTime *) src)->minute,
((MapiTime *) src)->second);
@@ -3352,7 +3352,7 @@
case MAPI_DATETIME:
checkSpace(110);
sprintf(hdl->query + k,
- "TIMESTAMP '%04d-%02u-%02u
%02u:%02u:%02u.%09u'",
+ "TIMESTAMP '%04hd-%02hu-%02hu
%02hu:%02hu:%02hu.%09u'",
((MapiDateTime *) src)->year,
((MapiDateTime *) src)->month,
((MapiDateTime *) src)->day,
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
@@ -2862,7 +2862,10 @@
}
/* fall through */
case SQL_C_TYPE_DATE:
- snprintf(data, sizeof(data), "DATE '%u-%02u-%02u'",
dval.year, dval.month, dval.day);
+ snprintf(data, sizeof(data), "DATE '%u-%02u-%02u'",
+ (unsigned int) dval.year,
+ (unsigned int) dval.month,
+ (unsigned int) dval.day);
assigns(buf, bufpos, buflen, data, stmt);
break;
default:
@@ -2961,7 +2964,7 @@
/* fall through */
case SQL_C_TYPE_TIMESTAMP:
snprintf(data, sizeof(data),
- "TIMESTAMP '%u-%02d-%02d %02u:%02u:%02u",
+ "TIMESTAMP '%u-%02u-%02u %02u:%02u:%02u",
(unsigned int) tsval.year,
(unsigned int) tsval.month,
(unsigned int) tsval.day,
diff --git a/clients/perl/Cimpl/Makefile.ag b/clients/perl/Cimpl/Makefile.ag
--- a/clients/perl/Cimpl/Makefile.ag
+++ b/clients/perl/Cimpl/Makefile.ag
@@ -24,14 +24,14 @@
# GCC_SWIG_CFLAGS and ICC_SWIG_CFLAGS, respectively, to disable only
# the problematic warnings/errors as locally as possible. See
# configure.ag for details.
-#CFLAGS = $(GCC_SWIG_CFLAGS) $(ICC_SWIG_CFLAGS) -D_GNU_SOURCE
+CFLAGS = $(GCC_SWIG_CFLAGS) $(ICC_SWIG_CFLAGS) -D_GNU_SOURCE
#
# However, at least with gcc 4.2.2 and swig 1.3.31 on Gentoo 1.12.9,
# we still get
# MapiLib.pm.c: In function 'boot_MapiLib':
# MapiLib.pm.c:6157: warning: passing argument 2 of '_swig_create_magic'
discards qualifiers from pointer target type
# Hence, we have to disable (override) our X_CFLAGS completely:
-X_CFLAGS = -D_GNU_SOURCE
+#X_CFLAGS = -D_GNU_SOURCE
# Likewise, we need to disable W_CFLAGS=-WX (i.e., treating warnings
# as errors) for swig-generated code on Windows
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -661,10 +661,18 @@
dnl Be rigid; MonetDB code is supposed to adhere to this... ;-)
dnl Let warning #266 "function declared implicitly" become an error.
X_CFLAGS="$X_CFLAGS -we266"
+ dnl Let remark #181 "argument is incompatible with corresponding
format string conversion" become an error.
+ X_CFLAGS="$X_CFLAGS -we181"
+ dnl Let remark #810 "conversion from "." to "." may lose significant
bits" become an error.
+ X_CFLAGS="$X_CFLAGS -we810"
+ dnl Let remark #111 "statement is unreachable" become an error.
+ X_CFLAGS="$X_CFLAGS -we111"
+ dnl Let remark #271: "trailing comma is nonstandard" become an error.
+ X_CFLAGS="$X_CFLAGS -we271"
X_CFLAGS="$X_CFLAGS -Werror"
dnl ... however, some things aren't solved, yet:
dnl (for the time being,) we need to disable some warnings (making
them remarks doesn't seem to work with -Werror):
- X_CFLAGS="$X_CFLAGS -wd1418,1419,981,810,193,111,1357"
+ X_CFLAGS="$X_CFLAGS -wd1418,1419,981,193,1357"
dnl ICC 11 warns about non-pointer conversion from "<type>" to
dnl "<smaller>" may lose significant bits, it does however, also for
dnl constants like short s = 1234, which is too much
@@ -680,12 +688,11 @@
dnl #1418: external definition with no prior declaration
dnl #1419: external declaration in primary source file
dnl # 981: operands are evaluated in unspecified order
- dnl # 810: conversion from "." to "." may lose significant bits
dnl # 193: zero used for undefined preprocessing identifier
- dnl # 111: statement is unreachable
dnl #1357: optimization disabled due to excessive resource
requirements; contact Intel Premier Support for assistance
dnl #1572: floating-point equality and inequality comparisons are
unreliable
dnl #1599: declaration hides variable
+ dnl #2259: non-pointer conversion from "." to "." may lose significant
bits
dnl (At least on Fedora Core 4,) bison 2.0 seems to generate code
dnl that icc does not like; since the problem only occurs with
diff --git a/gdk/gdk_setop.mx b/gdk/gdk_setop.mx
--- a/gdk/gdk_setop.mx
+++ b/gdk/gdk_setop.mx
@@ -437,20 +437,23 @@
h2 = hnil;
if (@4) { /* check for not-nil (nils don't
match anyway) */
BUN pb = p2;
+ int done = FALSE;
- for (;;) {
+ for (;!done;) {
if (EQUAL@5(t, BUNtail(ri,
pb))) {
HIT@1(h, t);
- break;
- }
- if ((++pb) >= q2) {
- MISS@1(h, t);
- break;
- }
- h2 = BUNh@2(ri, pb);
- if (@4) {
- MISS@1(h, t);
- break;
+ done = TRUE;
+ } else {
+ if ((++pb) >= q2) {
+ MISS@1(h, t);
+ done = TRUE;
+ } else {
+ h2 = BUNh@2(ri,
pb);
+ if (@4) {
+
MISS@1(h, t);
+ done =
TRUE;
+ }
+ }
}
}
continue;
diff --git a/geom/lib/libgeom.mx b/geom/lib/libgeom.mx
--- a/geom/lib/libgeom.mx
+++ b/geom/lib/libgeom.mx
@@ -102,7 +102,7 @@
wkbMultiPoint = 4,
wkbMultiLineString = 5,
wkbMultiPolygon = 6,
- wkbGeometryCollection = 7,
+ wkbGeometryCollection = 7
} wkb_type;
libgeom_export const char *geom_type2str(int t);
diff --git a/geom/monetdb5/geom.mx b/geom/monetdb5/geom.mx
--- a/geom/monetdb5/geom.mx
+++ b/geom/monetdb5/geom.mx
@@ -425,7 +425,8 @@
mbrHASH(mbr *atom /* IN: to-be-hashed mbr. */
)
{
- return (BUN) ((((int) atom->xmin) *((int) atom->ymin)) * (((int)
atom->xmax) *((int) atom->ymax)));
+ return (BUN) (((int) atom->xmin * (int) atom->ymin) *
+ ((int) atom->xmax * (int) atom->ymax));
}
/* COMP: compare two mbrs. */
@@ -862,11 +863,17 @@
flt *maxY /* IN. */
)
{
- *res = (mbr *) GDKmalloc(sizeof(mbr));
- (*res)->xmin = *minX;
- (*res)->ymin = *minY;
- (*res)->xmax = *maxX;
- (*res)->ymax = *maxY;
+ if ((*res = (mbr *) GDKmalloc(sizeof(mbr))) == NULL)
+ throw(MAL, "geom.mbr", MAL_MALLOC_FAIL);
+ if (*minX == flt_nil || *minY == flt_nil ||
+ *maxX == flt_nil || *maxY == flt_nil)
+ **res = *mbrNULL();
+ else {
+ (*res)->xmin = *minX;
+ (*res)->ymin = *minY;
+ (*res)->xmax = *maxX;
+ (*res)->ymax = *maxY;
+ }
return MAL_SUCCEED;
}
@@ -898,10 +905,17 @@
geos2wkb(GEOSGeom geosGeometry)
{
size_t wkbLen = 0;
- unsigned char *w = GEOSGeomToWKB_buf(geosGeometry, &wkbLen);
- wkb *atom = GDKmalloc(wkb_size(wkbLen));
+ unsigned char *w = NULL;
+ wkb *atom;
- if (!w) {
+ if (geosGeometry != NULL)
+ w = GEOSGeomToWKB_buf(geosGeometry, &wkbLen);
+
+ atom = GDKmalloc(wkb_size(wkbLen));
+ if (atom == NULL)
+ return NULL;
+
+ if (geosGeometry == NULL || w == NULL) {
*atom = *wkbNULL();
} else {
assert(wkbLen <= GDK_int_max);
@@ -952,16 +966,24 @@
@:getcoord(Y)@
@c
-geom_export str wkbcreatepoint(wkb **out, double *x, double *y);
+geom_export str wkbcreatepoint(wkb **out, dbl *x, dbl *y);
str
-wkbcreatepoint(wkb **out, double *x, double *y)
+wkbcreatepoint(wkb **out, dbl *x, dbl *y)
{
- GEOSCoordSeq pnt = GEOSCoordSeq_create(1, 2);
- GEOSCoordSeq_setX(pnt, 0, *x);
- GEOSCoordSeq_setY(pnt, 0, *y);
- *out = geos2wkb(GEOSGeom_createPoint(pnt));
- GEOSCoordSeq_destroy(pnt);
+ GEOSCoordSeq pnt;
+ if (*x == dbl_nil || *y == dbl_nil) {
+ if ((*out = GDKmalloc(sizeof(wkb))) != NULL)
+ **out = *wkbNULL();
+ } else {
+ pnt = GEOSCoordSeq_create(1, 2);
+ GEOSCoordSeq_setX(pnt, 0, *x);
+ GEOSCoordSeq_setY(pnt, 0, *y);
+ *out = geos2wkb(GEOSGeom_createPoint(pnt));
+ GEOSCoordSeq_destroy(pnt);
+ }
+ if (*out == NULL)
+ throw(MAL, "geom.point", MAL_MALLOC_FAIL);
return MAL_SUCCEED;
}
@@ -1041,10 +1063,13 @@
str
mbroverlaps(bit *out, mbr *b1, mbr *b2)
{
- *out = ((b1->ymax >= b2->ymax && b1->xmin <= b2->ymax) ||
- (b2->ymax >= b1->ymax && b2->xmin <= b1->ymax)) &&
- ((b1->xmax >= b2->xmax && b1->ymin <= b2->xmax) ||
- (b2->xmax >= b1->xmax && b2->ymin <= b1->xmax));
+ if (mbr_isnil(b1) || mbr_isnil(b2))
+ *out = 0;
+ else
+ *out = ((b1->ymax >= b2->ymax && b1->xmin <= b2->ymax) ||
+ (b2->ymax >= b1->ymax && b2->xmin <= b1->ymax)) &&
+ ((b1->xmax >= b2->xmax && b1->ymin <= b2->xmax) ||
+ (b2->xmax >= b1->xmax && b2->ymin <= b1->xmax));
return MAL_SUCCEED;
}
@@ -1097,8 +1122,6 @@
throw(MAL, "geom.@1", "wkb2geos(*b) failed");
}
if (!ga && !gb) {
- GEOSGeom_destroy(ga);
- GEOSGeom_destroy(gb);
throw(MAL, "geom.@1", "wkb2geos(*a) and wkb2geos(*b) both
failed");
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list