From 11b18fe20c0a8572b564486b0889159a10199e0b Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 7 Oct 2004 20:39:30 +0000 Subject: [PATCH] Fixed bugs in TYPE_ macro usage git-svn-id: http://svn.osgeo.org/postgis/trunk@956 b70326c6-7e19-0410-871a-916f4a2858ee --- lwgeom/lwgeom_api.c | 3 ++- lwgeom/lwgeom_functions_basic.c | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lwgeom/lwgeom_api.c b/lwgeom/lwgeom_api.c index a5940d879..1843813aa 100644 --- a/lwgeom/lwgeom_api.c +++ b/lwgeom/lwgeom_api.c @@ -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; diff --git a/lwgeom/lwgeom_functions_basic.c b/lwgeom/lwgeom_functions_basic.c index 4fe05a7e8..19b11a06c 100644 --- a/lwgeom/lwgeom_functions_basic.c +++ b/lwgeom/lwgeom_functions_basic.c @@ -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 -- 2.40.0