Changeset: 844668702550 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=844668702550 Modified Files: monetdb5/optimizer/Tests/dataflow4.stable.err monetdb5/optimizer/Tests/dataflow4.stable.out sql/backends/monet5/UDF/Makefile.ag Branch: default Log Message:
Merge with Aug2011 branch. diffs (truncated from 1066 to 300 lines): diff --git a/buildtools/Mx/MxFcnDef.h b/buildtools/Mx/MxFcnDef.h --- a/buildtools/Mx/MxFcnDef.h +++ b/buildtools/Mx/MxFcnDef.h @@ -150,7 +150,7 @@ extern void ofile_printf(_In_z_ _Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 1, 2))); extern void Fatal(const char *, _In_z_ _Printf_format_string_ const char *, ...) - __attribute__((__format__(__printf__, 2, 3))); + __attribute__((__format__(__printf__, 2, 3), __noreturn__)); extern void Error(_In_z_ _Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 1, 2))); extern void Message(_In_z_ _Printf_format_string_ const char *, ...) diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2350,6 +2350,9 @@ return errseen; } +static void usage(const char *prog, int xit) + __attribute__((__noreturn__)); + static void usage(const char *prog, int xit) { diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c --- a/clients/mapiclient/msqldump.c +++ b/clients/mapiclient/msqldump.c @@ -50,6 +50,9 @@ #include "msqldump.h" #include "mprompt.h" +static void usage(const char *prog, int xit) + __attribute__((__noreturn__)); + static void usage(const char *prog, int xit) { diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -1854,12 +1854,17 @@ struct icstream *ic = (struct icstream *) s->stream_data.p; ICONV_CONST char *inbuf = (ICONV_CONST char *) buf; size_t inbytesleft = elmsize * cnt; + char *bf = NULL; /* if unconverted data from a previous call remains, add it to the start of the new data, using temporary space */ if (ic->buflen > 0) { - char *bf = alloca(ic->buflen + inbytesleft); - + bf = malloc(ic->buflen + inbytesleft); + if (bf == NULL) { + /* cannot allocate memory */ + s->errnr = MNSTR_WRITE_ERROR; + return -1; + } memcpy(bf, ic->buffer, ic->buflen); memcpy(bf + ic->buflen, buf, inbytesleft); buf = bf; @@ -1875,6 +1880,8 @@ case EILSEQ: /* invalid multibyte sequence encountered */ s->errnr = MNSTR_WRITE_ERROR; + if (bf) + free(bf); return -1; case EINVAL: /* incomplete multibyte sequence encountered */ @@ -1885,10 +1892,14 @@ if (inbytesleft > sizeof(ic->buffer)) { /* ridiculously long multibyte sequence, so return error */ s->errnr = MNSTR_WRITE_ERROR; + if (bf) + free(bf); return -1; } memcpy(ic->buffer, inbuf, inbytesleft); ic->buflen = inbytesleft; + if (bf) + free(bf); return (ssize_t) cnt; case E2BIG: /* not enough space in output buffer */ @@ -1896,11 +1907,15 @@ default: /* cannot happen (according to manual) */ s->errnr = MNSTR_WRITE_ERROR; + if (bf) + free(bf); return -1; } } mnstr_write(ic->s, ic->buffer, 1, sizeof(ic->buffer) - outbytesleft); } + if (bf) + free(bf); return (ssize_t) cnt; } diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h --- a/gdk/gdk_system.h +++ b/gdk/gdk_system.h @@ -108,8 +108,10 @@ enum MT_thr_detach { MT_THR_JOINABLE, MT_THR_DETACHED }; gdk_export int MT_create_thread(MT_Id *t, void (*function) (void *), void *arg, enum MT_thr_detach d); -gdk_export void MT_exit_thread(int status); -gdk_export void MT_global_exit(int status); +gdk_export void MT_exit_thread(int status) + __attribute__((__noreturn__)); +gdk_export void MT_global_exit(int status) + __attribute__((__noreturn__)); gdk_export MT_Id MT_getpid(void); gdk_export int MT_join_thread(MT_Id t); gdk_export int MT_kill_thread(MT_Id t); diff --git a/geom/ChangeLog.Aug2011 b/geom/ChangeLog.Aug2011 --- a/geom/ChangeLog.Aug2011 +++ b/geom/ChangeLog.Aug2011 @@ -1,3 +1,8 @@ # ChangeLog file for geom # This file is updated with Maddlog +* Fri Jul 29 2011 Sjoerd Mullender <sjo...@acm.org> +- Implemented NULL checks in the geom module. Now when given NULL + as input, the module functions return NULL instead of an exception. + This fixes bug 2814. + diff --git a/geom/monetdb5/geom.mx b/geom/monetdb5/geom.mx --- a/geom/monetdb5/geom.mx +++ b/geom/monetdb5/geom.mx @@ -24,29 +24,29 @@ @mal module geom; -@' overwrite lng needed for fixed size! Sizes are fixed in geom.prelude +@' overwrite lng needed for fixed size! Sizes are fixed in geom.prelude @mal -atom mbr:lng; +atom mbr:lng; -command tostr() :str address mbrTOSTR; +command tostr() :str address mbrTOSTR; command fromstr() :mbr address mbrFROMSTR; -command hash() :int address mbrHASH; -command null() :int address mbrNULL; +command hash() :int address mbrHASH; +command null() :int address mbrNULL; command cmp() :int address mbrCOMP; -command read() address mbrREAD; -command write() address mbrWRITE; +command read() address mbrREAD; +command write() address mbrWRITE; command mbr(v:str) :mbr address mbrFromString; atom wkb; -command tostr() :str address wkbTOSTR; +command tostr() :str address wkbTOSTR; command fromstr() :wkb address wkbFROMSTR; -command hash() :int address wkbHASH; -command null() :int address wkbNULL; +command hash() :int address wkbHASH; +command null() :int address wkbNULL; command cmp() :int address wkbCOMP; -command read() address wkbREAD; -command write() address wkbWRITE; +command read() address wkbREAD; +command write() address wkbWRITE; command put() :int address wkbPUT; command del() :int address wkbDEL; @@ -84,11 +84,11 @@ command AsText(w:wkb) :str address wkbAsText; -command mbr(:flt,:flt,:flt,:flt) :mbr +command mbr(:flt,:flt,:flt,:flt) :mbr address ordinatesMBR comment "Creates the mbr for the given (xmin,ymin) and (xmax,ymax)."; - -command mbr(:wkb) :mbr + +command mbr(:wkb) :mbr address wkbMBR comment "Creates the mbr for the given wkb."; @@ -228,9 +228,9 @@ comment "Returns a geometry that represents the point set semmetric difference of Geometry a with b."; -command prelude():void address geom_prelude; +command prelude():void address geom_prelude; command epilogue():void address geom_epilogue; - + geom.prelude(); module calc; @@ -264,12 +264,20 @@ address wkbIsnil comment "Nil test for wkb value"; -@h -#ifndef GEOM_H -#define GEOM_H +@c +#include <monetdb_config.h> +#include <mal.h> +#include <mal_atom.h> +#include <mal_exception.h> #include "libgeom.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <time.h> + #ifdef WIN32 #ifndef LIBGEOM #define geom_export extern __declspec(dllimport) @@ -280,26 +288,10 @@ #define geom_export extern #endif +int TYPE_mbr; + geom_export wkb *wkbNULL(void); -#endif /* GEOM_H */ - -@c - -#include <monetdb_config.h> -#include <mal.h> -#include <mal_atom.h> -#include <mal_exception.h> -#include "geom.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <time.h> - -int TYPE_mbr; - geom_export bat *geom_prelude(void); bat * @@ -485,7 +477,7 @@ for (i = 0; i < cnt; i++, c++) { /* use binary writeInt (as sizeof (flt) == sizeof(int)); */ - /* We want to write nil's here too. + /* We want to write nil's here too. So no overflow checking needed */ if (!mnstr_writeInt(s, (int) c->xmin) || !mnstr_writeInt(s, (int) c->ymin) || @@ -940,8 +932,10 @@ const GEOSCoordSeq gcs; #endif - if (!geosGeometry) - throw(MAL, "geom.wkbgetcoord@1", "wkb2geos failed"); + if (!geosGeometry) { + *out = dbl_nil; + return MAL_SUCCEED; + } gcs = GEOSGeom_getCoordSeq(geosGeometry); @@ -949,7 +943,7 @@ throw(MAL, "geom.wkbgetcoord@1", "GEOSGeom_getCoordSeq failed"); /* we could also check if geom is a - LineString, LinearRing or Point */ + LineString, LinearRing or Point */ if (GEOSCoordSeq_get@1(gcs, 0, out) == 0) ret = "GEOSCoordSeq_get@1 failed"; @@ -1081,8 +1075,10 @@ { GEOSGeom geosGeometry = wkb2geos(*geom); - if (!geosGeometry) - throw(MAL, "geom.@1", "wkb2geos failed"); + if (!geosGeometry) { + @7; + return MAL_SUCCEED; + } *out = @4(@3(geosGeometry)); @@ -1096,13 +1092,13 @@ _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list