]> granicus.if.org Git - postgis/commitdiff
Fix for GBT#73: ST_Force_Collection crashes with CIRCULARSTRING. This is basically...
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Mon, 24 Nov 2008 11:04:44 +0000 (11:04 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Mon, 24 Nov 2008 11:04:44 +0000 (11:04 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3325 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_functions_basic.c

index 7d2359f3b626daf3727c5c1085a6718ea25c6aae..b3df58045c0e2e255f69ffcf705bf092b742e916 100644 (file)
@@ -1460,7 +1460,7 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
        lwgeom = lwgeom_deserialize(SERIALIZED_FORM(geom));
 
        /* alread a multi*, just make it a collection */
-       if ( TYPE_GETTYPE(lwgeom->type) >= MULTIPOINTTYPE )
+       if ( lwgeom_contains_subgeoms(TYPE_GETTYPE(lwgeom->type)) )
        {
                TYPE_SETTYPE(lwgeom->type, COLLECTIONTYPE);
        }
@@ -1506,7 +1506,7 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
         * in input. If bbox cache is not there we'll need to handle
         * automatic bbox addition FOR_COMPLEX_GEOMS.
         */
-       if ( TYPE_GETTYPE(geom->type) >= MULTIPOINTTYPE &&
+       if ( lwgeom_contains_subgeoms(TYPE_GETTYPE(geom->type)) &&
                        TYPE_HASBBOX(geom->type) )
        {
                PG_RETURN_POINTER(geom);
@@ -1517,7 +1517,7 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
        type = TYPE_GETTYPE(lwgeom->type);
 
        /* single geom, make it a multi */
-       if ( type < MULTIPOINTTYPE )
+       if ( ! lwgeom_contains_subgeoms(type) )
        {
                type += 3;
                SRID = lwgeom->SRID;