]> granicus.if.org Git - postgis/commitdiff
Fixed bugs in TYPE_ macro usage
authorSandro Santilli <strk@keybit.net>
Thu, 7 Oct 2004 20:39:30 +0000 (20:39 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 7 Oct 2004 20:39:30 +0000 (20:39 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@956 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_api.c
lwgeom/lwgeom_functions_basic.c

index a5940d879d115d0f9a7da8a182a23c81db924a93..1843813aa4b8a2d3da14faf0dcf89b0a21ecfc7a 100644 (file)
@@ -2275,7 +2275,8 @@ lwexploded_serialize_buf(LWGEOM_EXPLODED *exploded, int wantbbox,
                // Now compute the bounding box and write it
                if ( wantbbox && ! lwgeom_hasBBOX(loc[0]) )
                {
-                       buf[0] = TYPE_SETHASBBOX(loc[0], 1);
+                       buf[0] = loc[0];
+                       TYPE_SETHASBBOX(buf[0], 1);
                        box3d = lw_geom_getBB_simple(loc);
                        box2d = box3d_to_box2df(box3d);
                        loc = buf+1;
index 4fe05a7e888feee7fbf1fad9b35add0f740f13af..19b11a06c2e06b37227c065e5611a5479888dd99 100644 (file)
@@ -1974,7 +1974,8 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
        {
                result = (PG_LWGEOM *)lwalloc(geom->size);
                result->size = geom->size;
-               result->type = TYPE_SETTYPE(geom->type, COLLECTIONTYPE);
+               result->type = geom->type;
+               TYPE_SETTYPE(result->type, COLLECTIONTYPE);
                memcpy(result->data, geom->data, geom->size-5);
                PG_RETURN_POINTER(result);
        }
@@ -1987,7 +1988,8 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
        result = (PG_LWGEOM *)lwalloc(size); // 4 for numgeoms, 1 for type
        result->size = size;
 
-       result->type = TYPE_SETTYPE(geom->type, COLLECTIONTYPE);
+       result->type = geom->type;
+       TYPE_SETTYPE(result->type, COLLECTIONTYPE);
        iptr = geom->data;
        optr = result->data;
 
@@ -2017,8 +2019,9 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
        optr+=4;
 
        // write type of first geometry w/out BBOX and SRID
-       optr[0] = TYPE_SETHASSRID(geom->type, 0);
-       optr[0] = TYPE_SETHASBBOX(optr[0], 0);
+       optr[0] = geom->type;
+       TYPE_SETHASSRID(optr[0], 0);
+       TYPE_SETHASBBOX(optr[0], 0);
        optr++;
 
        // write remaining stuff
@@ -2053,7 +2056,8 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
        result = (PG_LWGEOM *)lwalloc(size); // 4 for numgeoms, 1 for type
        result->size = size;
 
-       result->type = TYPE_SETTYPE(geom->type, newtype);
+       result->type = geom->type;
+       TYPE_SETTYPE(result->type, newtype);
        iptr = geom->data;
        optr = result->data;
 
@@ -2083,8 +2087,9 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
        optr+=4;
 
        // write type of first geometry w/out BBOX and SRID
-       optr[0] = TYPE_SETHASSRID(geom->type, 0);
-       optr[0] = TYPE_SETHASBBOX(optr[0], 0);
+       optr[0] = geom->type;
+       TYPE_SETHASSRID(optr[0], 0);
+       TYPE_SETHASBBOX(optr[0], 0);
        optr++;
 
        // write remaining stuff