]> granicus.if.org Git - postgis/commitdiff
Fix more compiler warnings
authorSandro Santilli <strk@keybit.net>
Fri, 10 May 2013 07:51:19 +0000 (07:51 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 10 May 2013 07:51:19 +0000 (07:51 +0000)
There are still some that would be nice to fix, but it's mostly
the array subscript is above array bounds one

git-svn-id: http://svn.osgeo.org/postgis/trunk@11400 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwlinearreferencing.c
liblwgeom/lwsegmentize.c
libpgcommon/lwgeom_pg.c
postgis/lwgeom_export.c
postgis/lwgeom_geos.c
postgis/lwgeom_in_geohash.c

index 772951648519c8aea99012e70392ece10f54c314..a6795433b68ff7bf6d407638aa38cd3575129b09 100644 (file)
@@ -526,7 +526,7 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
        POINTARRAY *pa_in = NULL;
        LWCOLLECTION *lwgeom_out = NULL;
        POINTARRAY *dp = NULL;
-       int i, rv;
+       int i;
        int added_last_point = 0;
        POINT4D *p = NULL, *q = NULL, *r = NULL;
        double ordinate_value_p = 0.0, ordinate_value_q = 0.0;
@@ -579,7 +579,7 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
                        *q = *p;
                        ordinate_value_q = ordinate_value_p;
                }
-               rv = getPoint4d_p(pa_in, i, p);
+               getPoint4d_p(pa_in, i, p);
                ordinate_value_p = lwpoint_get_ordinate(p, ordinate);
                LWDEBUGF(4, " ordinate_value_p %g (current)", ordinate_value_p);
                LWDEBUGF(4, " ordinate_value_q %g (previous)", ordinate_value_q);
@@ -607,13 +607,13 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
                                {
                                        double interpolation_value;
                                        (ordinate_value_q > to) ? (interpolation_value = to) : (interpolation_value = from);
-                                       rv = point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
-                                       rv = ptarray_append_point(dp, r, LW_FALSE);
+                                       point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
+                                       ptarray_append_point(dp, r, LW_FALSE);
                                        LWDEBUGF(4, "[0] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
                                }
                        }
                        /* Add the current vertex to the point array. */
-                       rv = ptarray_append_point(dp, p, LW_FALSE);
+                       ptarray_append_point(dp, p, LW_FALSE);
                        if ( ordinate_value_p == from || ordinate_value_p == to )
                        {
                                added_last_point = 2; /* Added on boundary. */
@@ -633,8 +633,8 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
                                *  to the point array at the range boundary. */
                                double interpolation_value;
                                (ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
-                               rv = point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
-                               rv = ptarray_append_point(dp, r, LW_FALSE);
+                               point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
+                               ptarray_append_point(dp, r, LW_FALSE);
                                LWDEBUGF(4, " [1] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
                        }
                        else if ( added_last_point == 2 )
@@ -648,8 +648,8 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
                                {
                                        double interpolation_value;
                                        (ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
-                                       rv = point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
-                                       rv = ptarray_append_point(dp, r, LW_FALSE);
+                                       point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
+                                       ptarray_append_point(dp, r, LW_FALSE);
                                        LWDEBUGF(4, " [2] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
                                }
                        }
@@ -659,10 +659,10 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
                                *  so we need to add *two* interpolated points! */
                                dp = ptarray_construct(hasz, hasm, 2);
                                /* Interpolate lower point. */
-                               rv = point_interpolate(p, q, r, hasz, hasm, ordinate, from);
+                               point_interpolate(p, q, r, hasz, hasm, ordinate, from);
                                ptarray_set_point4d(dp, 0, r);
                                /* Interpolate upper point. */
-                               rv = point_interpolate(p, q, r, hasz, hasm, ordinate, to);
+                               point_interpolate(p, q, r, hasz, hasm, ordinate, to);
                                ptarray_set_point4d(dp, 1, r);
                        }
                        else if ( i && ordinate_value_q > to && ordinate_value_p < from )
@@ -671,10 +671,10 @@ lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, do
                                *  so we need to add *two* interpolated points! */
                                dp = ptarray_construct(hasz, hasm, 2);
                                /* Interpolate upper point. */
-                               rv = point_interpolate(p, q, r, hasz, hasm, ordinate, to);
+                               point_interpolate(p, q, r, hasz, hasm, ordinate, to);
                                ptarray_set_point4d(dp, 0, r);
                                /* Interpolate lower point. */
-                               rv = point_interpolate(p, q, r, hasz, hasm, ordinate, from);
+                               point_interpolate(p, q, r, hasz, hasm, ordinate, from);
                                ptarray_set_point4d(dp, 1, r);
                        }
                        /* We have an extant point-array, save it out to a multi-line. */
index ad91b2cc73770d495d4a9b97093beec4716ee1b6..bc350fad169ab0bed8cc97d24106c1151cc5c13a 100644 (file)
@@ -110,7 +110,6 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad)
        double increment; /* Angle per segment */
        double a1, a2, a3, angle;
        POINTARRAY *pa;
-       int result;
        int is_circle = LW_FALSE;
 
        LWDEBUG(2, "lwcircle_calculate_gbox called.");
@@ -179,7 +178,7 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad)
                pt.y = center.y + radius * sin(angle);
                pt.z = interpolate_arc(angle, a1, a2, a3, p1->z, p2->z, p3->z);
                pt.m = interpolate_arc(angle, a1, a2, a3, p1->m, p2->m, p3->m);
-               result = ptarray_append_point(pa, &pt, LW_FALSE);
+               ptarray_append_point(pa, &pt, LW_FALSE);
        }       
        return pa;
 }
index 80cd3c9ee85e582fee0d91f34660ef36a80ad41c..09d3ecc9de8beac07ade29998967b98a968f0d2f 100644 (file)
@@ -106,7 +106,7 @@ pg_unparser_errhint(LWGEOM_UNPARSER_RESULT *lwg_unparser_result)
 }
 
 
-void *
+static void *
 pg_alloc(size_t size)
 {
        void * result;
@@ -127,7 +127,7 @@ pg_alloc(size_t size)
        return result;
 }
 
-void *
+static void *
 pg_realloc(void *mem, size_t size)
 {
        void * result;
@@ -143,13 +143,13 @@ pg_realloc(void *mem, size_t size)
        return result;
 }
 
-void
+static void
 pg_free(void *ptr)
 {
        pfree(ptr);
 }
 
-void
+static void
 pg_error(const char *fmt, va_list ap)
 {
 #define ERRMSG_MAXLEN 256
@@ -162,7 +162,7 @@ pg_error(const char *fmt, va_list ap)
        ereport(ERROR, (errmsg_internal("%s", errmsg)));
 }
 
-void
+static void
 pg_notice(const char *fmt, va_list ap)
 {
        char *msg;
index 644d4e797fe2151111f5db55460965fec7dd8bf0..72abf7ab54f09254c9b6accde4cbb15ae45bbe76 100644 (file)
@@ -487,8 +487,6 @@ Datum LWGEOM_asX3D(PG_FUNCTION_ARGS)
        char *srs;
        int srid;
        int option = 0;
-       int is_deegree = 0;
-       int is_dims = 1;
        int precision = DBL_DIG;
        static const char* default_defid = "x3d:"; /* default defid */
        char *defidbuf;
@@ -547,12 +545,8 @@ Datum LWGEOM_asX3D(PG_FUNCTION_ARGS)
        else if (option & 1) srs = getSRSbySRID(srid, false);
        else                 srs = getSRSbySRID(srid, true);
 
-       if (option & 2)  is_dims = 0;
-       if (option & 16) is_deegree = 1;
-
        lwgeom = lwgeom_from_gserialized(geom);
 
-
        x3d = lwgeom_to_x3d3(lwgeom, srs, precision,option, defid);
 
        lwgeom_free(lwgeom);
index 474248fc6e3055d43286b832862c8b7b8b1ec6b2..eac9a015dd7782ddc2e5df559ca321f346722a45 100644 (file)
@@ -892,6 +892,7 @@ Datum boundary(PG_FUNCTION_ARGS)
        GSERIALIZED     *geom1;
        GEOSGeometry *g1, *g3;
        GSERIALIZED *result;
+       LWGEOM *lwgeom;
        int srid;
 
 
@@ -903,10 +904,10 @@ Datum boundary(PG_FUNCTION_ARGS)
 
        srid = gserialized_get_srid(geom1);
 
-       LWGEOM *lwgeom = lwgeom_from_gserialized(geom1);
+       lwgeom = lwgeom_from_gserialized(geom1);
        if ( ! lwgeom ) {
                lwerror("POSTGIS2GEOS: unable to deserialize input");
-               return NULL;
+               PG_RETURN_NULL();
        }
 
        /* GEOS doesn't do triangle type, so we special case that here */
index c1163a8cce02e5b05c6f5031f0a25a83c3e08d3d..703686172690781e45b30bfe49c66ed502951f7d 100644 (file)
@@ -15,6 +15,7 @@
 #include "../postgis_config.h"
 #include "lwgeom_pg.h"
 #include "liblwgeom.h"
+#include "liblwgeom_internal.h"/* for decode_geohash_bbox */
 
 Datum box2d_from_geohash(PG_FUNCTION_ARGS);
 Datum point_from_geohash(PG_FUNCTION_ARGS);
@@ -27,7 +28,7 @@ static void geohash_lwerror(char *msg, int error_code)
 
 #include "lwgeom_export.h"
 
-GBOX*
+static GBOX*
 parse_geohash(char *geohash, int precision)
 {
        GBOX *box = NULL;