]> granicus.if.org Git - postgis/commitdiff
Cleanups for older compilers and PG verisons.
authorSandro Santilli <strk@keybit.net>
Tue, 5 Oct 2004 21:42:22 +0000 (21:42 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 5 Oct 2004 21:42:22 +0000 (21:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@934 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_debug.c
lwgeom/lwgeom_ogc.c
lwgeom/lwgeom_spheroid.c

index 1ab7fff7b7c47ed8a56776f81a91cf72ff901fd6..071eb7ccac609065d12ff09688f8146f286cb845 100644 (file)
@@ -47,11 +47,13 @@ char *
 lwpoint_summary(LWPOINT *point, int offset)
 {
        char *result;
-       result = lwalloc(128+offset);
        char pad[offset+1];
+
        memset(pad, ' ', offset);
        pad[offset] = '\0';
 
+       result = lwalloc(128+offset);
+
        sprintf(result, "%s%s[%s]\n",
                pad, lwgeom_typename(TYPE_GETTYPE(point->type)),
                lwgeom_typeflags(point->type));
@@ -62,11 +64,13 @@ char *
 lwline_summary(LWLINE *line, int offset)
 {
        char *result;
-       result = lwalloc(128+offset);
        char pad[offset+1];
+
        memset(pad, ' ', offset);
        pad[offset] = '\0';
 
+       result = lwalloc(128+offset);
+
        sprintf(result, "%s%s[%s] with %d points\n",
                pad, lwgeom_typename(TYPE_GETTYPE(line->type)),
                lwgeom_typeflags(line->type),
index cf59b09354672915039b2882f297a190ee55d70a..0980c781bc341c2ccee8197f25363b23638cfcec 100644 (file)
@@ -710,7 +710,11 @@ Datum LWGEOM_from_text(PG_FUNCTION_ARGS)
        PG_LWGEOM *result = NULL;
 
        // read user-requested SRID if any
+#if USE_VERSION < 73
+       if ( fcinfo->nargs > 1 )
+#else
        if ( PG_NARGS() > 1 )
+#endif
        {
                SRID = PG_GETARG_INT32(1);
                if ( SRID != lwgeom_getSRID(geom) )
@@ -730,15 +734,14 @@ Datum LWGEOM_asText(PG_FUNCTION_ARGS)
        char *lwgeom;
        char *result_cstring;
        int len;
+        char *result,*loc_wkt;
+       char *semicolonLoc;
 
        init_pg_func();
 
        lwgeom = (char *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
        result_cstring =  unparse_WKT(lwgeom,lwalloc,lwfree);
 
-        char *result,*loc_wkt;
-       char *semicolonLoc;
-
        semicolonLoc = strchr(result_cstring,';');
 
        //loc points to start of wkt
index 470518d8d203557d91b219689f0d7ada2f4744aa..026511fa43032cad3fdb04b7f9534e4e3aea2998 100644 (file)
@@ -293,10 +293,12 @@ double lwgeom_pointarray_length_ellipse(POINTARRAY *pts, SPHEROID *sphere)
        {
                POINT3DZ frm;
                POINT3DZ to;
+               double distellips;
+
                getPoint3dz_p(pts, i, &frm);
                getPoint3dz_p(pts, i+1, &to);
 
-               double distellips = distance_ellipse(
+               distellips = distance_ellipse(
                        frm.y*M_PI/180.0, frm.x*M_PI/180.0,
                        to.y*M_PI/180.0, to.x*M_PI/180.0, sphere);
                dist += sqrt(distellips*distellips + (frm.z*frm.z));