Move liblwgeom logging functions outside of public header (#1220)
authorSandro Santilli <strk@keybit.net>
Thu, 11 Jun 2015 11:03:03 +0000 (11:03 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 11 Jun 2015 11:03:03 +0000 (11:03 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13652 b70326c6-7e19-0410-871a-916f4a2858ee

26 files changed:
NEWS
liblwgeom/liblwgeom.h.in
liblwgeom/liblwgeom_internal.h
liblwgeom/lwgeom_log.h
libpgcommon/lwgeom_pg.c
libpgcommon/lwgeom_pg.h
postgis/geography_inout.c
postgis/geography_measurement_trees.c
postgis/lwgeom_backend_api.c
postgis/lwgeom_functions_analytic.c
postgis/lwgeom_functions_basic.c
postgis/lwgeom_functions_lrs.c
postgis/lwgeom_geos.c
postgis/lwgeom_geos_clean.c
postgis/lwgeom_geos_prepared.c
postgis/lwgeom_geos_relatematch.c
postgis/lwgeom_in_geohash.c
postgis/lwgeom_in_gml.c
postgis/lwgeom_in_kml.c
postgis/lwgeom_inout.c
postgis/lwgeom_ogc.c
postgis/lwgeom_rtree.c
postgis/lwgeom_sfcgal.c
raster/rt_core/rt_geometry.c
raster/rt_core/rt_raster.c
raster/rt_core/rt_spatial_relationship.c

diff --git a/NEWS b/NEWS
index 64d9d92c47e71453024199603303fea52bd4b3d1..2cefa9146beb2915a589e19d45ec838d50ee4b90 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -119,6 +119,7 @@ PostGIS 2.2.0
 
   - Split raster/rt_core/rt_api.c and raster/rt_pg/rt_pg.c files into
     smaller files for ease of long-term maintenance and development
+  - #1220, lwerror and lwnotice function became internal to liblwgeom
 
 PostGIS 2.1.6
 2015/03/20
index f2d456d0175e592737235a3b9c00fa7939f874cf..ef0b7cbc0350822fd5b50dcb9b16cc8855625311 100644 (file)
@@ -239,36 +239,6 @@ extern void lwgeom_cancel_interrupt(void);
 typedef void (lwinterrupt_callback)();
 extern lwinterrupt_callback *lwgeom_register_interrupt_callback(lwinterrupt_callback *);
 
-/**
- * Write a notice out to the notice handler.
- *
- * Uses standard printf() substitutions.
- * Use for messages you always want output.
- * For debugging, use LWDEBUG() or LWDEBUGF().
- * @ingroup logging
- */
-void lwnotice(const char *fmt, ...);
-
-/**
- * Write a notice out to the error handler.
- *
- * Uses standard printf() substitutions.
- * Use for errors you always want output.
- * For debugging, use LWDEBUG() or LWDEBUGF().
- * @ingroup logging
- */
-void lwerror(const char *fmt, ...);
-
-/**
- * Write a debug message out. 
- * Don't call this function directly, use the 
- * macros, LWDEBUG() or LWDEBUGF(), for
- * efficiency.
- * @ingroup logging
- */
-void lwdebug(int level, const char *fmt, ...);
-
-
 /******************************************************************/
 
 typedef struct {
index ed91bbe04885f5f558d675ec5ca82dc8b4ca97c3..e2f3def2205bf29e0430a37087855262ef5d48fc 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "../postgis_config.h"
 
+#include "lwgeom_log.h"
+
 #include <assert.h>
 #include <stdarg.h>
 #include <stdint.h>
index 438be696f4259e84e08363de6ac1fb878574467d..f26b65e9d046a21d5399476c468e49408479d3d8 100644 (file)
 
 #endif /* POSTGIS_DEBUG_LEVEL <= 0 */
 
+/**
+ * Write a notice out to the notice handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for messages you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
+void lwnotice(const char *fmt, ...);
+
+/**
+ * Write a notice out to the error handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for errors you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
+void lwerror(const char *fmt, ...);
+
+/**
+ * Write a debug message out. 
+ * Don't call this function directly, use the 
+ * macros, LWDEBUG() or LWDEBUGF(), for
+ * efficiency.
+ * @ingroup logging
+ */
+void lwdebug(int level, const char *fmt, ...);
+
+
+
 #endif /* LWGEOM_LOG_H */
index 740a66d418d6db8ad2125e9afa41927c31ee6d0a..5983af0e7f7f7c307b2e3a7424325c267db3e4b9 100644 (file)
@@ -211,7 +211,7 @@ GSERIALIZED* geography_serialize(LWGEOM *lwgeom)
        GSERIALIZED *g = NULL;
 
        g = gserialized_from_lwgeom(lwgeom, is_geodetic, &ret_size);
-       if ( ! g ) lwerror("Unable to serialize lwgeom.");
+       if ( ! g ) lwpgerror("Unable to serialize lwgeom.");
        SET_VARSIZE(g, ret_size);
        return g;
 }
@@ -228,7 +228,31 @@ GSERIALIZED* geometry_serialize(LWGEOM *lwgeom)
        GSERIALIZED *g = NULL;
 
        g = gserialized_from_lwgeom(lwgeom, is_geodetic, &ret_size);
-       if ( ! g ) lwerror("Unable to serialize lwgeom.");
+       if ( ! g ) lwpgerror("Unable to serialize lwgeom.");
        SET_VARSIZE(g, ret_size);
        return g;
 }
+
+void
+lwpgnotice(const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+
+  pg_notice(fmt, ap);
+
+       va_end(ap);
+}
+
+void
+lwpgerror(const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+
+  pg_error(fmt, ap);
+
+       va_end(ap);
+}
index c734a54e682766aaa23a7cc2717a85119657fe92..789e2deb3f0e681caad959b2043d8f228e507123 100644 (file)
@@ -170,4 +170,7 @@ Datum LWGEOM_getBBOX(PG_FUNCTION_ARGS);
 Datum LWGEOM_addBBOX(PG_FUNCTION_ARGS);
 Datum LWGEOM_dropBBOX(PG_FUNCTION_ARGS);
 
+void lwpgerror(const char *fmt, ...);
+void lwpgnotice(const char *fmt, ...);
+
 #endif /* !defined _LWGEOM_PG_H */
index dc85dc5d1a1478eef9c069b3ef3e5ee2f9f68a1a..e615327c526b4b4e107022911d6bf8a316e3f3ae 100644 (file)
@@ -555,7 +555,7 @@ Datum geography_from_binary(PG_FUNCTION_ARGS)
        LWGEOM *lwgeom = lwgeom_from_wkb(wkb, wkb_size, LW_PARSER_CHECK_NONE);
        
        if ( ! lwgeom )
-               lwerror("Unable to parse WKB");
+               lwpgerror("Unable to parse WKB");
                
        gser = gserialized_geography_from_lwgeom(lwgeom, -1);
        lwgeom_free(lwgeom);
index 59f537ef2b80857cbb8772976b865a3b907988cb..cf0d411eab9a08e61fb18ce31709667202b9606c 100644 (file)
@@ -180,7 +180,7 @@ geography_distance_cache_tolerance(FunctionCallInfoData* fcinfo, const GSERIALIZ
                }
                else
                {
-                       lwerror("geography_distance_cache this cannot happen!");
+                       lwpgerror("geography_distance_cache this cannot happen!");
                        return LW_FAILURE;
                }
                
index 2d3c3a1c3f100794fa68d9741a23e24fce2d60ce..621a25fb4ef78f906d6ce7ab6b7b7c62cbe1da34 100644 (file)
@@ -91,7 +91,7 @@ static void lwgeom_backend_switch( const char* newvalue, void* extra )
            return;
        }
     }
-    lwerror("Can't find %s geometry backend", newvalue );
+    lwpgerror("Can't find %s geometry backend", newvalue );
 }
 
 void lwgeom_init_backend()
index 09003d816d408764c4ff7cb0a57bce0998eabdc6..2f6c055db35865df668a6a0d4e9061186902aba8 100644 (file)
@@ -345,7 +345,7 @@ Datum LWGEOM_snaptogrid(PG_FUNCTION_ARGS)
 static void
 grid_print(const gridspec *grid)
 {
-       lwnotice("GRID(%g %g %g %g, %g %g %g %g)",
+       lwpgnotice("GRID(%g %g %g %g, %g %g %g %g)",
                 grid->ipx, grid->ipy, grid->ipz, grid->ipm,
                 grid->xsize, grid->ysize, grid->zsize, grid->msize);
 }
@@ -376,7 +376,7 @@ Datum LWGEOM_snaptogrid_pointoff(PG_FUNCTION_ARGS)
        in_lwpoint = lwgeom_as_lwpoint(lwgeom_from_gserialized(in_point));
        if ( in_lwpoint == NULL )
        {
-               lwerror("Offset geometry must be a point");
+               lwpgerror("Offset geometry must be a point");
        }
 
        grid.xsize = PG_GETARG_FLOAT8(2);
index 7b99320ce4cfaa573eb5f4fa152b51c06befa073..c88673a1dd46a9c1326d841a53a69b68e8400837 100644 (file)
@@ -1561,7 +1561,7 @@ Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
        pglwg1 = PG_GETARG_GSERIALIZED_P(0);
        if ( gserialized_get_type(pglwg1) != LINETYPE )
        {
-               lwerror("Shell is not a line");
+               lwpgerror("Shell is not a line");
        }
        shell = lwgeom_as_lwline(lwgeom_from_gserialized(pglwg1));
 
@@ -1578,7 +1578,7 @@ Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
                        offset += INTALIGN(VARSIZE(g));
                        if ( gserialized_get_type(g) != LINETYPE )
                        {
-                               lwerror("Hole %d is not a line", i);
+                               lwpgerror("Hole %d is not a line", i);
                        }
                        hole = lwgeom_as_lwline(lwgeom_from_gserialized(g));
                        holes[i] = hole;
@@ -2394,14 +2394,14 @@ Datum LWGEOM_azimuth(PG_FUNCTION_ARGS)
        if ( ! lwpoint )
        {
                PG_FREE_IF_COPY(geom, 0);
-               lwerror("Argument must be POINT geometries");
+               lwpgerror("Argument must be POINT geometries");
                PG_RETURN_NULL();
        }
        srid = lwpoint->srid;
        if ( ! getPoint2d_p(lwpoint->point, 0, &p1) )
        {
                PG_FREE_IF_COPY(geom, 0);
-               lwerror("Error extracting point");
+               lwpgerror("Error extracting point");
                PG_RETURN_NULL();
        }
        lwpoint_free(lwpoint);
@@ -2413,19 +2413,19 @@ Datum LWGEOM_azimuth(PG_FUNCTION_ARGS)
        if ( ! lwpoint )
        {
                PG_FREE_IF_COPY(geom, 1);
-               lwerror("Argument must be POINT geometries");
+               lwpgerror("Argument must be POINT geometries");
                PG_RETURN_NULL();
        }
        if ( lwpoint->srid != srid )
        {
                PG_FREE_IF_COPY(geom, 1);
-               lwerror("Operation on mixed SRID geometries");
+               lwpgerror("Operation on mixed SRID geometries");
                PG_RETURN_NULL();
        }
        if ( ! getPoint2d_p(lwpoint->point, 0, &p2) )
        {
                PG_FREE_IF_COPY(geom, 1);
-               lwerror("Error extracting point");
+               lwpgerror("Error extracting point");
                PG_RETURN_NULL();
        }
        lwpoint_free(lwpoint);
@@ -2661,7 +2661,7 @@ Datum ST_RemoveRepeatedPoints(PG_FUNCTION_ARGS)
        LWGEOM *lwgeom_in = lwgeom_from_gserialized(input);
        LWGEOM *lwgeom_out;
 
-       /* lwnotice("ST_RemoveRepeatedPoints got %p", lwgeom_in); */
+       /* lwpgnotice("ST_RemoveRepeatedPoints got %p", lwgeom_in); */
 
        lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in);
        output = geometry_serialize(lwgeom_out);
@@ -2695,7 +2695,7 @@ static LWORD ordname2ordval(char n)
   if ( n == 'y' || n == 'y' ) return LWORD_Y;
   if ( n == 'z' || n == 'Z' ) return LWORD_Z;
   if ( n == 'm' || n == 'M' ) return LWORD_M;
-  lwerror("Invalid ordinate name '%c'. Expected x,y,z or m", n);
+  lwpgerror("Invalid ordinate name '%c'. Expected x,y,z or m", n);
   return (LWORD)-1;
 }
 
@@ -2712,7 +2712,7 @@ Datum ST_SwapOrdinates(PG_FUNCTION_ARGS)
   ospec = PG_GETARG_CSTRING(1);
   if ( strlen(ospec) != 2 )
   {
-    lwerror("Invalid ordinate specification. "
+    lwpgerror("Invalid ordinate specification. "
             "Need two letters from the set (x,y,z,m). "
             "Got '%s'", ospec);
     PG_RETURN_NULL();
@@ -2725,12 +2725,12 @@ Datum ST_SwapOrdinates(PG_FUNCTION_ARGS)
   /* Check presence of given ordinates */
   if ( ( o1 == LWORD_M || o2 == LWORD_M ) && ! gserialized_has_m(in) )
   {
-    lwerror("Geometry does not have an M ordinate");
+    lwpgerror("Geometry does not have an M ordinate");
     PG_RETURN_NULL();
   }
   if ( ( o1 == LWORD_Z || o2 == LWORD_Z ) && ! gserialized_has_z(in) )
   {
-    lwerror("Geometry does not have a Z ordinate");
+    lwpgerror("Geometry does not have a Z ordinate");
     PG_RETURN_NULL();
   }
 
index 9157fc091fc113cdd78870839ff4008fb34e2e52..55ed1320901454fdf161131d4ac5aa2634b581aa 100644 (file)
@@ -38,7 +38,7 @@ Datum ST_AddMeasure(PG_FUNCTION_ARGS)
        /* Raise an error if input is not a linestring or multilinestring */
        if ( type != LINETYPE && type != MULTILINETYPE )
        {
-               lwerror("Only LINESTRING and MULTILINESTRING are supported");
+               lwpgerror("Only LINESTRING and MULTILINESTRING are supported");
                PG_RETURN_NULL();
        }
 
@@ -497,7 +497,7 @@ ptarray_locate_between_m(POINTARRAY *ipa, double m0, double m1)
         * if dpa!=NULL it means we didn't close it yet.
         * this should never happen.
         */
-       if ( dpa != NULL ) lwerror("Something wrong with algorithm");
+       if ( dpa != NULL ) lwpgerror("Something wrong with algorithm");
 
        return ret;
 }
@@ -592,7 +592,7 @@ lwline_locate_between_m(LWLINE *lwline_in, double m0, double m1)
                /* This is a bug */
                else
                {
-                       lwerror("ptarray_locate_between_m returned a POINARRAY set containing POINTARRAY with 0 points");
+                       lwpgerror("ptarray_locate_between_m returned a POINARRAY set containing POINTARRAY with 0 points");
                }
 
        }
@@ -673,11 +673,11 @@ lwgeom_locate_between_m(LWGEOM *lwin, double m0, double m1)
                /* Polygon types are not supported */
        case POLYGONTYPE:
        case MULTIPOLYGONTYPE:
-               lwerror("Areal geometries are not supported by locate_between_measures");
+               lwpgerror("Areal geometries are not supported by locate_between_measures");
                return NULL;
        }
 
-       lwerror("Unkonwn geometry type (%s:%d)", __FILE__, __LINE__);
+       lwpgerror("Unkonwn geometry type (%s:%d)", __FILE__, __LINE__);
        return NULL;
 }
 
@@ -706,7 +706,7 @@ Datum LWGEOM_locate_between_m(PG_FUNCTION_ARGS)
 
        if ( end_measure < start_measure )
        {
-               lwerror("locate_between_m: 2nd arg must be bigger then 1st arg");
+               lwpgerror("locate_between_m: 2nd arg must be bigger then 1st arg");
                PG_RETURN_NULL();
        }
        
@@ -715,7 +715,7 @@ Datum LWGEOM_locate_between_m(PG_FUNCTION_ARGS)
         */
        if ( ! hasm )
        {
-               lwerror("Geometry argument does not have an 'M' ordinate");
+               lwpgerror("Geometry argument does not have an 'M' ordinate");
                PG_RETURN_NULL();
        }
 
@@ -727,7 +727,7 @@ Datum LWGEOM_locate_between_m(PG_FUNCTION_ARGS)
 
        if ( type == POLYGONTYPE || type == MULTIPOLYGONTYPE || type == COLLECTIONTYPE )
        {
-               lwerror("Areal or Collection types are not supported");
+               lwpgerror("Areal or Collection types are not supported");
                PG_RETURN_NULL();
        }
 
index 1a6d7457ef7318f39bc1c21deeb94863904ef351..779f254bdb633ea5b0d63654589a3b6733655dc0 100644 (file)
@@ -43,7 +43,7 @@
  */
 #define HANDLE_GEOS_ERROR(label) { \
   if ( ! strstr(lwgeom_geos_errmsg, "InterruptedException") ) \
-    lwerror(label": %s", lwgeom_geos_errmsg); \
+    lwpgerror(label": %s", lwgeom_geos_errmsg); \
   PG_RETURN_NULL(); \
 }
 
@@ -114,7 +114,7 @@ PG_FUNCTION_INFO_V1(hausdorffdistance);
 Datum hausdorffdistance(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 32
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'ST_HausdorffDistance' function (3.2.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -135,7 +135,7 @@ Datum hausdorffdistance(PG_FUNCTION_ARGS)
        if ( gserialized_is_empty(geom1) || gserialized_is_empty(geom2) )
                PG_RETURN_NULL();
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -180,7 +180,7 @@ PG_FUNCTION_INFO_V1(hausdorffdistancedensify);
 Datum hausdorffdistancedensify(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 32
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'ST_HausdorffDistance' function (3.2.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -202,7 +202,7 @@ Datum hausdorffdistancedensify(PG_FUNCTION_ARGS)
        if ( gserialized_is_empty(geom1) || gserialized_is_empty(geom2) )
                PG_RETURN_NULL();
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -308,7 +308,7 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
                PG_RETURN_POINTER((GSERIALIZED *)(ARR_DATA_PTR(array)));
        
        /* Ok, we really need GEOS now ;) */
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        /*
        ** Collect the non-empty inputs and stuff them into a GEOS collection
@@ -519,7 +519,7 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
                PG_RETURN_POINTER((GSERIALIZED *)(ARR_DATA_PTR(array)));
 
        /* Ok, we really need geos now ;) */
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
 
        if ( allpolys )
@@ -735,7 +735,7 @@ Datum ST_UnaryUnion(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 33
        PG_RETURN_NULL();
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'GEOSUnaryUnion' function (3.3.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -759,7 +759,7 @@ Datum ST_UnaryUnion(PG_FUNCTION_ARGS)
 
        srid = gserialized_get_srid(geom1);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
 
@@ -893,7 +893,7 @@ Datum boundary(PG_FUNCTION_ARGS)
 
        lwgeom = lwgeom_from_gserialized(geom1);
        if ( ! lwgeom ) {
-               lwerror("POSTGIS2GEOS: unable to deserialize input");
+               lwpgerror("POSTGIS2GEOS: unable to deserialize input");
                PG_RETURN_NULL();
        }
 
@@ -905,7 +905,7 @@ Datum boundary(PG_FUNCTION_ARGS)
                PG_RETURN_POINTER(result);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = LWGEOM2GEOS(lwgeom, 0);
        lwgeom_free(lwgeom);
@@ -966,7 +966,7 @@ Datum convexhull(PG_FUNCTION_ARGS)
 
        srid = gserialized_get_srid(geom1);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
 
@@ -1034,7 +1034,7 @@ Datum topologypreservesimplify(PG_FUNCTION_ARGS)
        if ( gserialized_is_empty(geom1) )
                PG_RETURN_POINTER(geom1);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -1115,7 +1115,7 @@ Datum buffer(PG_FUNCTION_ARGS)
 
        nargs = PG_NARGS();
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -1142,7 +1142,7 @@ Datum buffer(PG_FUNCTION_ARGS)
                        val = strchr(key, '=');
                        if ( val == NULL || *(val+1) == '\0' )
                        {
-                               lwerror("Missing value for buffer "
+                               lwpgerror("Missing value for buffer "
                                        "parameter %s", key);
                                break;
                        }
@@ -1171,7 +1171,7 @@ Datum buffer(PG_FUNCTION_ARGS)
                                }
                                else
                                {
-                                       lwerror("Invalid buffer end cap "
+                                       lwpgerror("Invalid buffer end cap "
                                                "style: %s (accept: "
                                                "'round', 'flat', 'butt' "
                                                "or 'square'"
@@ -1197,7 +1197,7 @@ Datum buffer(PG_FUNCTION_ARGS)
                                }
                                else
                                {
-                                       lwerror("Invalid buffer end cap "
+                                       lwpgerror("Invalid buffer end cap "
                                                "style: %s (accept: "
                                                "'round', 'mitre', 'miter' "
                                                " or 'bevel'"
@@ -1218,7 +1218,7 @@ Datum buffer(PG_FUNCTION_ARGS)
                        }
                        else
                        {
-                               lwerror("Invalid buffer parameter: %s (accept: "
+                               lwpgerror("Invalid buffer parameter: %s (accept: "
                                        "'endcap', 'join', 'mitre_limit', "
                                        "'miter_limit and "
                                        "'quad_segs')", key);
@@ -1244,7 +1244,7 @@ Datum buffer(PG_FUNCTION_ARGS)
                endCapStyle != DEFAULT_ENDCAP_STYLE ||
                joinStyle != DEFAULT_JOIN_STYLE )
        {
-               lwerror("The GEOS version this PostGIS binary "
+               lwpgerror("The GEOS version this PostGIS binary "
                        "was compiled against (%d) doesn't support "
                        "specifying a mitre limit != %d or styles different "
                        "from 'round' (needs 3.2 or higher)",
@@ -1287,7 +1287,7 @@ PG_FUNCTION_INFO_V1(ST_OffsetCurve);
 Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 32
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "ST_OffsetCurve function "
                "(needs 3.2 or higher)",
@@ -1325,7 +1325,7 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
        /* Check for a useable type */
        if ( gserialized_get_type(gser_input) != LINETYPE )
        {
-               lwerror("ST_OffsetCurve only works with LineStrings");
+               lwpgerror("ST_OffsetCurve only works with LineStrings");
                PG_RETURN_NULL();
        }
 
@@ -1340,7 +1340,7 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
        /* Read the lwgeom, check for errors */
        lwgeom_input = lwgeom_from_gserialized(gser_input);
        if ( ! lwgeom_input )
-               lwerror("ST_OffsetCurve: lwgeom_from_gserialized returned NULL");
+               lwpgerror("ST_OffsetCurve: lwgeom_from_gserialized returned NULL");
        
        /* For empty inputs, just echo them back */
        if ( lwgeom_is_empty(lwgeom_input) )
@@ -1365,7 +1365,7 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
                        val = strchr(key, '=');
                        if ( val == NULL || *(val+1) == '\0' )
                        {
-                               lwerror("ST_OffsetCurve: Missing value for buffer parameter %s", key);
+                               lwpgerror("ST_OffsetCurve: Missing value for buffer parameter %s", key);
                                break;
                        }
                        *val = '\0';
@@ -1389,7 +1389,7 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
                                }
                                else
                                {
-                                       lwerror("Invalid buffer end cap style: %s (accept: "
+                                       lwpgerror("Invalid buffer end cap style: %s (accept: "
                                                "'round', 'mitre', 'miter' or 'bevel')", val);
                                        break;
                                }
@@ -1407,7 +1407,7 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
                        }
                        else
                        {
-                               lwerror("Invalid buffer parameter: %s (accept: "
+                               lwpgerror("Invalid buffer parameter: %s (accept: "
                                        "'join', 'mitre_limit', 'miter_limit and "
                                        "'quad_segs')", key);
                                break;
@@ -1420,7 +1420,7 @@ Datum ST_OffsetCurve(PG_FUNCTION_ARGS)
        lwgeom_result = lwgeom_offsetcurve(lwgeom_as_lwline(lwgeom_input), size, quadsegs, joinStyle, mitreLimit);
        
        if (lwgeom_result == NULL)
-               lwerror("ST_OffsetCurve: lwgeom_offsetcurve returned NULL");
+               lwpgerror("ST_OffsetCurve: lwgeom_offsetcurve returned NULL");
 
        gser_result = gserialized_from_lwgeom(lwgeom_result, 0, 0);
        lwgeom_free(lwgeom_input);
@@ -1515,7 +1515,7 @@ Datum pointonsurface(PG_FUNCTION_ARGS)
                PG_RETURN_POINTER(result);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
 
@@ -1578,7 +1578,7 @@ Datum centroid(PG_FUNCTION_ARGS)
                PG_RETURN_POINTER(result);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom);
 
@@ -1622,7 +1622,7 @@ Datum ST_ClipByBox2d(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 35
 
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                                        "was compiled against (%d) doesn't support "
                                        "'GEOSClipByRect' function (3.5.0+ required)",
                                        POSTGIS_GEOS_VERSION);
@@ -1756,18 +1756,18 @@ Datum isvalid(PG_FUNCTION_ARGS)
                if ( isinf(box1.xmax) || isinf(box1.ymax) || isinf(box1.xmin) || isinf(box1.ymin) || 
                     isnan(box1.xmax) || isnan(box1.ymax) || isnan(box1.xmin) || isnan(box1.ymin)  )
                {
-                       lwnotice("Geometry contains an Inf or NaN coordinate");
+                       lwpgnotice("Geometry contains an Inf or NaN coordinate");
                        PG_RETURN_BOOL(FALSE);
                }
        }
 #endif
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        lwgeom = lwgeom_from_gserialized(geom1);
        if ( ! lwgeom )
        {
-               lwerror("unable to deserialize input");
+               lwpgerror("unable to deserialize input");
        }
        g1 = LWGEOM2GEOS(lwgeom, 0);
        lwgeom_free(lwgeom);
@@ -1777,7 +1777,7 @@ Datum isvalid(PG_FUNCTION_ARGS)
                /* should we drop the following
                 * notice now that we have ST_isValidReason ?
                 */
-               lwnotice("%s", lwgeom_geos_errmsg);
+               lwpgnotice("%s", lwgeom_geos_errmsg);
                PG_RETURN_BOOL(FALSE);
        }
 
@@ -1830,7 +1830,7 @@ Datum isvalidreason(PG_FUNCTION_ARGS)
        }
 #endif
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
        if ( g1 )
@@ -1864,7 +1864,7 @@ PG_FUNCTION_INFO_V1(isvaliddetail);
 Datum isvaliddetail(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 33
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'isValidDetail' function (3.3.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -1892,7 +1892,7 @@ Datum isvaliddetail(PG_FUNCTION_ARGS)
        tupdesc = RelationNameGetTupleDesc("valid_detail");
        if ( ! tupdesc )
        {
-               lwerror("TYPE valid_detail not found");
+               lwpgerror("TYPE valid_detail not found");
                PG_RETURN_NULL();
        }
 
@@ -1908,7 +1908,7 @@ Datum isvaliddetail(PG_FUNCTION_ARGS)
                flags = PG_GETARG_INT32(1);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
 
@@ -1931,7 +1931,7 @@ Datum isvaliddetail(PG_FUNCTION_ARGS)
                if (valid == 2)
                {
                        /* NOTE: should only happen on OOM or similar */
-                       lwerror("GEOS isvaliddetail() threw an exception!");
+                       lwpgerror("GEOS isvaliddetail() threw an exception!");
                        PG_RETURN_NULL(); /* never gets here */
                }
        }
@@ -2000,7 +2000,7 @@ Datum overlaps(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -2127,7 +2127,7 @@ Datum contains(PG_FUNCTION_ARGS)
                POSTGIS_DEBUGF(3, "Contains: type1: %d, type2: %d", type1, type2);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 );
 
@@ -2208,7 +2208,7 @@ Datum containsproperly(PG_FUNCTION_ARGS)
                        PG_RETURN_BOOL(FALSE);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 );
 
@@ -2352,7 +2352,7 @@ Datum covers(PG_FUNCTION_ARGS)
                POSTGIS_DEBUGF(3, "Covers: type1: %d, type2: %d", type1, type2);
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 );
 
@@ -2502,7 +2502,7 @@ Datum coveredby(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
 
@@ -2573,7 +2573,7 @@ Datum crosses(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -2707,7 +2707,7 @@ Datum geos_intersects(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
        prep_cache = GetPrepGeomCache( fcinfo, geom1, geom2 );
 
        if ( prep_cache && prep_cache->prepared_geom )
@@ -2803,7 +2803,7 @@ Datum touches(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1 );
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -2871,7 +2871,7 @@ Datum disjoint(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -2925,7 +2925,7 @@ Datum relate_pattern(PG_FUNCTION_ARGS)
        errorIfGeometryCollection(geom1,geom2);
        error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -2995,7 +2995,7 @@ Datum relate_full(PG_FUNCTION_ARGS)
 #if POSTGIS_GEOS_VERSION >= 33
                bnr = PG_GETARG_INT32(2);
 #else
-               lwerror("The GEOS version this PostGIS binary "
+               lwpgerror("The GEOS version this PostGIS binary "
                        "was compiled against (%d) doesn't support "
                        "specifying a boundary node rule with ST_Relate"
                        " (3.3.0+ required)",
@@ -3007,7 +3007,7 @@ Datum relate_full(PG_FUNCTION_ARGS)
        errorIfGeometryCollection(geom1,geom2);
        error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1 );
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -3090,7 +3090,7 @@ Datum ST_Equals(PG_FUNCTION_ARGS)
                }
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
 
@@ -3140,7 +3140,7 @@ Datum issimple(PG_FUNCTION_ARGS)
        if ( gserialized_is_empty(geom) )
                PG_RETURN_BOOL(TRUE);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -3180,7 +3180,7 @@ Datum isring(PG_FUNCTION_ARGS)
        if ( gserialized_is_empty(geom) )
                PG_RETURN_BOOL(FALSE);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom );
        if ( 0 == g1 )   /* exception thrown at construction */
@@ -3214,7 +3214,7 @@ GEOS2POSTGIS(GEOSGeom geom, char want3d)
        lwgeom = GEOS2LWGEOM(geom, want3d);
        if ( ! lwgeom )
        {
-               lwerror("GEOS2POSTGIS: GEOS2LWGEOM returned NULL");
+               lwpgerror("GEOS2POSTGIS: GEOS2LWGEOM returned NULL");
                return NULL;
        }
 
@@ -3241,14 +3241,14 @@ POSTGIS2GEOS(GSERIALIZED *pglwgeom)
        LWGEOM *lwgeom = lwgeom_from_gserialized(pglwgeom);
        if ( ! lwgeom )
        {
-               lwerror("POSTGIS2GEOS: unable to deserialize input");
+               lwpgerror("POSTGIS2GEOS: unable to deserialize input");
                return NULL;
        }
        ret = LWGEOM2GEOS(lwgeom, 0);
        lwgeom_free(lwgeom);
        if ( ! ret )
        {
-               /* lwerror("POSTGIS2GEOS conversion failed"); */
+               /* lwpgerror("POSTGIS2GEOS conversion failed"); */
                return NULL;
        }
        return ret;
@@ -3262,7 +3262,7 @@ Datum GEOSnoop(PG_FUNCTION_ARGS)
        GEOSGeometry *geosgeom;
        GSERIALIZED *lwgeom_result;
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        geom = PG_GETARG_GSERIALIZED_P(0);
        geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom);
@@ -3310,7 +3310,7 @@ Datum polygonize_garray(PG_FUNCTION_ARGS)
        if ( nelems == 0 ) PG_RETURN_NULL();
 
        /* Ok, we really need geos now ;) */
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        vgeoms = palloc(sizeof(GEOSGeometry *)*nelems);
        offset = 0;
@@ -3377,7 +3377,7 @@ Datum linemerge(PG_FUNCTION_ARGS)
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
 
@@ -3496,7 +3496,7 @@ PG_FUNCTION_INFO_V1(ST_Snap);
 Datum ST_Snap(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 33
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'ST_Snap' function (3.3.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -3606,7 +3606,7 @@ PG_FUNCTION_INFO_V1(ST_SharedPaths);
 Datum ST_SharedPaths(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 33
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'ST_SharedPaths' function (3.3.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -3657,7 +3657,7 @@ PG_FUNCTION_INFO_V1(ST_Node);
 Datum ST_Node(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 33
-       lwerror("The GEOS version this PostGIS binary "
+       lwpgerror("The GEOS version this PostGIS binary "
                "was compiled against (%d) doesn't support "
                "'ST_Node' function (3.3.0+ required)",
                POSTGIS_GEOS_VERSION);
index 8078bf8e599ccff553364b889ff305e6ff5f9cb2..7bea2206962782b276ae6966cfa95188d14e9cc0 100644 (file)
@@ -75,7 +75,7 @@ Datum ST_MakeValid(PG_FUNCTION_ARGS)
                break;
 
        default:
-               lwerror("ST_MakeValid: unsupported geometry type %s",
+               lwpgerror("ST_MakeValid: unsupported geometry type %s",
                        lwtype_name(lwgeom_in->type));
                PG_RETURN_NULL();
                break;
@@ -112,7 +112,7 @@ lwgeom_clean(LWGEOM* lwgeom_in)
        /* Check dimensionality is the same as input */
        if ( lwgeom_dimensionality(lwgeom_in) != lwgeom_dimensionality(lwgeom_out) )
        {
-               lwnotice("lwgeom_clean: dimensional collapse (%d to %d)",
+               lwpgnotice("lwgeom_clean: dimensional collapse (%d to %d)",
                         lwgeom_dimensionality(lwgeom_in), lwgeom_dimensionality(lwgeom_out));
 
                return NULL;
@@ -122,7 +122,7 @@ lwgeom_clean(LWGEOM* lwgeom_in)
        if ( lwgeom_out->type == COLLECTIONTYPE &&
                lwgeom_in->type != COLLECTIONTYPE )
        {
-               lwnotice("lwgeom_clean: mixed-type output (%s) "
+               lwpgnotice("lwgeom_clean: mixed-type output (%s) "
                         "from single-type input (%s)",
                         lwtype_name(lwgeom_out->type),
                         lwtype_name(lwgeom_in->type));
index ee0828e8e19096974e8ac720a8c48e7d684d1e31..8e7e10d330cc6903aec93414a6fdcb4e9941d923 100644 (file)
@@ -314,7 +314,7 @@ PrepGeomCacheBuilder(const LWGEOM *lwgeom, GeomCache *cache)
        */
        if ( prepcache->argnum || prepcache->geom || prepcache->prepared_geom )
        {
-               lwerror("PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
+               lwpgerror("PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
                return LW_FAILURE;
        }
        
@@ -331,7 +331,7 @@ PrepGeomCacheBuilder(const LWGEOM *lwgeom, GeomCache *cache)
        pghe = GetPrepGeomHashEntry(prepcache->context_callback);
        if ( ! pghe )
        {
-               lwerror("PrepGeomCacheBuilder failed to find hash entry for context %p", prepcache->context_callback);
+               lwpgerror("PrepGeomCacheBuilder failed to find hash entry for context %p", prepcache->context_callback);
                return LW_FAILURE;
        }
        
@@ -367,7 +367,7 @@ PrepGeomCacheCleaner(GeomCache *cache)
        pghe = GetPrepGeomHashEntry(prepcache->context_callback);
        if ( ! pghe )
        {
-               lwerror("PrepGeomCacheCleaner failed to find hash entry for context %p", prepcache->context_callback);
+               lwpgerror("PrepGeomCacheCleaner failed to find hash entry for context %p", prepcache->context_callback);
                return LW_FAILURE;
        }
        pghe->geom = 0;
index 74c2b072c046f5c06264c5fde2fd020c00b61737..3264ce4e3faedd277d77822e0cfab97cb0500c62 100644 (file)
@@ -41,7 +41,7 @@ PG_FUNCTION_INFO_V1(ST_RelateMatch);
 Datum ST_RelateMatch(PG_FUNCTION_ARGS)
 {
 #if POSTGIS_GEOS_VERSION < 33
-       lwerror("The GEOS version this postgis binary "
+       lwpgerror("The GEOS version this postgis binary "
                "was compiled against (%d) doesn't support "
                "'ST_RelateMatch' function (3.3.0+ required)",
                POSTGIS_GEOS_VERSION);
@@ -60,13 +60,13 @@ Datum ST_RelateMatch(PG_FUNCTION_ARGS)
         mat = text2cstring(mat_text);
         pat = text2cstring(pat_text);
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(lwpgnotice, lwgeom_geos_error);
 
        result = GEOSRelatePatternMatch(mat, pat);
        if (result == 2)
        {
                lwfree(mat); lwfree(pat);
-               lwerror("GEOSRelatePatternMatch: %s", lwgeom_geos_errmsg);
+               lwpgerror("GEOSRelatePatternMatch: %s", lwgeom_geos_errmsg);
                PG_RETURN_NULL();
        }
 
index 703686172690781e45b30bfe49c66ed502951f7d..966812b4d79b3bb0e64569551b29282f56a329cb 100644 (file)
 Datum box2d_from_geohash(PG_FUNCTION_ARGS);
 Datum point_from_geohash(PG_FUNCTION_ARGS);
 
-static void geohash_lwerror(char *msg, int error_code)
+static void geohash_lwpgerror(char *msg, int error_code)
 {
        POSTGIS_DEBUGF(3, "ST_Box2dFromGeoHash ERROR %i", error_code);
-       lwerror("%s", msg);
+       lwpgerror("%s", msg);
 }
 
 #include "lwgeom_export.h"
@@ -38,7 +38,7 @@ parse_geohash(char *geohash, int precision)
 
        if (NULL == geohash)
        {
-               geohash_lwerror("invalid GeoHash representation", 2);
+               geohash_lwpgerror("invalid GeoHash representation", 2);
        }
 
        decode_geohash_bbox(geohash, lat, lon, precision);
index 2f75c818bd9f7c51ddc06bbdf6e2afe3e3fa9761..968f65432b446a9bcc3cfe2876255608d8c72bac 100644 (file)
@@ -64,10 +64,10 @@ gmlSrs;
 
 
 
-static void gml_lwerror(char *msg, int error_code) 
+static void gml_lwpgerror(char *msg, int error_code) 
 {
         POSTGIS_DEBUGF(3, "ST_GeomFromGML ERROR %i", error_code);
-        lwerror("%s", msg);
+        lwpgerror("%s", msg);
 }
 
 /**
@@ -266,7 +266,7 @@ static xmlNodePtr get_xlink_node(xmlNodePtr xnode)
                if (node_id != NULL)
                {
                        if (!xmlStrcmp(node_id, p))
-                               gml_lwerror("invalid GML representation", 2);
+                               gml_lwpgerror("invalid GML representation", 2);
                        xmlFree(node_id);
                }
        }
@@ -285,7 +285,7 @@ static POINTARRAY* gml_reproject_pa(POINTARRAY *pa, int srid_in, int srid_out)
        char *text_in, *text_out;
 
        if (srid_in == SRID_UNKNOWN) return pa; /* nothing to do */
-       if (srid_out == SRID_UNKNOWN) gml_lwerror("invalid GML representation", 3);
+       if (srid_out == SRID_UNKNOWN) gml_lwpgerror("invalid GML representation", 3);
 
        text_in = GetProj4StringSPI(srid_in);
        text_out = GetProj4StringSPI(srid_out);
@@ -319,14 +319,14 @@ static int gml_is_srid_planar(int srid)
        int is_planar, err;
 
        if (SPI_OK_CONNECT != SPI_connect ())
-               lwerror("gml_is_srid_planar: could not connect to SPI manager");
+               lwpgerror("gml_is_srid_planar: could not connect to SPI manager");
 
        /* A way to find if this projection is planar or geocentric */
        sprintf(query, "SELECT position('+units=m ' in proj4text) \
                         FROM spatial_ref_sys WHERE srid='%d'", srid);
 
        err = SPI_exec(query, 1);
-       if (err < 0) lwerror("gml_is_srid_planar: error executing query %d", err);
+       if (err < 0) lwpgerror("gml_is_srid_planar: error executing query %d", err);
 
        /* No entry in spatial_ref_sys */
        if (SPI_processed <= 0)
@@ -405,19 +405,19 @@ static void parse_gml_srs(xmlNodePtr xnode, gmlSrs *srs)
                        sep = '#';
                        latlon = false;
                }
-               else gml_lwerror("unknown spatial reference system", 4);
+               else gml_lwpgerror("unknown spatial reference system", 4);
 
                /* retrieve the last ':' or '#' char */
                for (p = (char *) srsname ; *p ; p++);
                for (--p ; *p != sep ; p--)
-                       if (!isdigit(*p)) gml_lwerror("unknown spatial reference system", 5);
+                       if (!isdigit(*p)) gml_lwpgerror("unknown spatial reference system", 5);
 
                srs->srid = atoi(++p);
 
                /* Check into spatial_ref_sys that this SRID really exist */
                is_planar = gml_is_srid_planar(srs->srid);
                if (srs->srid == SRID_UNKNOWN || is_planar == -1)
-                       gml_lwerror("unknown spatial reference system", 6);
+                       gml_lwpgerror("unknown spatial reference system", 6);
 
                /* About lat/lon issue, Cf: http://tinyurl.com/yjpr55z */
                srs->reverse_axis = !is_planar && latlon;
@@ -465,37 +465,37 @@ static double parse_gml_double(char *d, bool space_before, bool space_after)
                        else if (st == NEED_DIG_DEC)                    st = DIG_DEC;
                        else if (st == NEED_DIG_EXP || st == EXP)       st = DIG_EXP;
                        else if (st == DIG || st == DIG_DEC || st == DIG_EXP);
-                       else gml_lwerror("invalid GML representation", 7);
+                       else gml_lwpgerror("invalid GML representation", 7);
                }
                else if (*p == '.')
                {
                        if      (st == DIG)                             st = NEED_DIG_DEC;
-                       else    gml_lwerror("invalid GML representation", 8);
+                       else    gml_lwpgerror("invalid GML representation", 8);
                }
                else if (*p == '-' || *p == '+')
                {
                        if      (st == INIT)                            st = NEED_DIG;
                        else if (st == EXP)                             st = NEED_DIG_EXP;
-                       else    gml_lwerror("invalid GML representation", 9);
+                       else    gml_lwpgerror("invalid GML representation", 9);
                }
                else if (*p == 'e' || *p == 'E')
                {
                        if      (st == DIG || st == DIG_DEC)            st = EXP;
-                       else    gml_lwerror("invalid GML representation", 10);
+                       else    gml_lwpgerror("invalid GML representation", 10);
                }
                else if (isspace(*p))
                {
-                       if (!space_after) gml_lwerror("invalid GML representation", 11);
+                       if (!space_after) gml_lwpgerror("invalid GML representation", 11);
                        if (st == DIG || st == DIG_DEC || st == DIG_EXP)st = END;
                        else if (st == NEED_DIG_DEC)                    st = END;
                        else if (st == END);
-                       else    gml_lwerror("invalid GML representation", 12);
+                       else    gml_lwpgerror("invalid GML representation", 12);
                }
-               else  gml_lwerror("invalid GML representation", 13);
+               else  gml_lwpgerror("invalid GML representation", 13);
        }
 
        if (st != DIG && st != NEED_DIG_DEC && st != DIG_DEC && st != DIG_EXP && st != END)
-               gml_lwerror("invalid GML representation", 14);
+               gml_lwpgerror("invalid GML representation", 14);
 
        return atof(d);
 }
@@ -530,7 +530,7 @@ static POINTARRAY* parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
        else
        {
                if (xmlStrlen(gml_ts) > 1 || isdigit(gml_ts[0]))
-                       gml_lwerror("invalid GML representation", 15);
+                       gml_lwpgerror("invalid GML representation", 15);
                ts = gml_ts[0];
                xmlFree(gml_ts);
        }
@@ -541,7 +541,7 @@ static POINTARRAY* parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
        else
        {
                if (xmlStrlen(gml_cs) > 1 || isdigit(gml_cs[0]))
-                       gml_lwerror("invalid GML representation", 16);
+                       gml_lwpgerror("invalid GML representation", 16);
                cs = gml_cs[0];
                xmlFree(gml_cs);
        }
@@ -552,13 +552,13 @@ static POINTARRAY* parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
        else
        {
                if (xmlStrlen(gml_dec) > 1 || isdigit(gml_dec[0]))
-                       gml_lwerror("invalid GML representation", 17);
+                       gml_lwpgerror("invalid GML representation", 17);
                dec = gml_dec[0];
                xmlFree(gml_dec);
        }
 
        if (cs == ts || cs == dec || ts == dec)
-               gml_lwerror("invalid GML representation", 18);
+               gml_lwpgerror("invalid GML representation", 18);
 
        /* HasZ, !HasM, 1 Point */
        dpa = ptarray_construct_empty(1, 0, 1);
@@ -575,7 +575,7 @@ static POINTARRAY* parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
                        *p = '\0';
                        gml_dims++;
 
-                       if (*(p+1) == '\0') gml_lwerror("invalid GML representation", 19);
+                       if (*(p+1) == '\0') gml_lwpgerror("invalid GML representation", 19);
 
                        if      (gml_dims == 1) pt.x = parse_gml_double(q, false, true);
                        else if (gml_dims == 2) pt.y = parse_gml_double(q, false, true);
@@ -590,7 +590,7 @@ static POINTARRAY* parse_gml_coordinates(xmlNodePtr xnode, bool *hasz)
                        gml_dims++;
 
                        if (gml_dims < 2 || gml_dims > 3)
-                               gml_lwerror("invalid GML representation", 20);
+                               gml_lwpgerror("invalid GML representation", 20);
 
                        if (gml_dims == 3)
                                pt.z = parse_gml_double(q, false, true);
@@ -639,7 +639,7 @@ static POINTARRAY* parse_gml_coord(xmlNodePtr xnode, bool *hasz)
 
                if (!strcmp((char *) xyz->name, "X"))
                {
-                       if (x) gml_lwerror("invalid GML representation", 21);
+                       if (x) gml_lwpgerror("invalid GML representation", 21);
                        c = xmlNodeGetContent(xyz);
                        p.x = parse_gml_double((char *) c, true, true);
                        x = true;
@@ -647,7 +647,7 @@ static POINTARRAY* parse_gml_coord(xmlNodePtr xnode, bool *hasz)
                }
                else  if (!strcmp((char *) xyz->name, "Y"))
                {
-                       if (y) gml_lwerror("invalid GML representation", 22);
+                       if (y) gml_lwpgerror("invalid GML representation", 22);
                        c = xmlNodeGetContent(xyz);
                        p.y = parse_gml_double((char *) c, true, true);
                        y = true;
@@ -655,7 +655,7 @@ static POINTARRAY* parse_gml_coord(xmlNodePtr xnode, bool *hasz)
                }
                else if (!strcmp((char *) xyz->name, "Z"))
                {
-                       if (z) gml_lwerror("invalid GML representation", 23);
+                       if (z) gml_lwpgerror("invalid GML representation", 23);
                        c = xmlNodeGetContent(xyz);
                        p.z = parse_gml_double((char *) c, true, true);
                        z = true;
@@ -663,7 +663,7 @@ static POINTARRAY* parse_gml_coord(xmlNodePtr xnode, bool *hasz)
                }
        }
        /* Check dimension consistancy */
-       if (!x || !y) gml_lwerror("invalid GML representation", 24);
+       if (!x || !y) gml_lwpgerror("invalid GML representation", 24);
        if (!z) *hasz = false;
 
        ptarray_append_point(dpa, &p, LW_FALSE);
@@ -697,7 +697,7 @@ static POINTARRAY* parse_gml_pos(xmlNodePtr xnode, bool *hasz)
         dim = atoi((char *) dimension);
         xmlFree(dimension);
         if (dim < 2 || dim > 3)
-            gml_lwerror("invalid GML representation", 25);
+            gml_lwpgerror("invalid GML representation", 25);
     }
     if (dim == 2) *hasz = false;
 
@@ -732,7 +732,7 @@ static POINTARRAY* parse_gml_pos(xmlNodePtr xnode, bool *hasz)
     /* Test again coherent dimensions on each coord */
     if (gml_dim == 2) *hasz = false;
     if (gml_dim < 2 || gml_dim > 3 || gml_dim != dim)
-        gml_lwerror("invalid GML representation", 26);
+        gml_lwpgerror("invalid GML representation", 26);
 
     ptarray_append_point(dpa, &pt, LW_FALSE);
 
@@ -761,7 +761,7 @@ static POINTARRAY* parse_gml_poslist(xmlNodePtr xnode, bool *hasz)
        {
                dim = atoi((char *) dimension);
                xmlFree(dimension);
-               if (dim < 2 || dim > 3) gml_lwerror("invalid GML representation", 27);
+               if (dim < 2 || dim > 3) gml_lwpgerror("invalid GML representation", 27);
        }
        if (dim == 2) *hasz = false;
 
@@ -794,7 +794,7 @@ static POINTARRAY* parse_gml_poslist(xmlNodePtr xnode, bool *hasz)
                                gml_dim = 0;
                        }
                        else if (*(poslist+1) == '\0')
-                               gml_lwerror("invalid GML representation", 28);
+                               gml_lwpgerror("invalid GML representation", 28);
 
                        p = poslist+1;
                        digit = false;
@@ -878,15 +878,15 @@ static POINTARRAY* parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
                                }
                        }
                        if (!found || xb == NULL)
-                               gml_lwerror("invalid GML representation", 29);
+                               gml_lwpgerror("invalid GML representation", 29);
 
                        if (is_xlink(xb)) xb = get_xlink_node(xb);
                        if (xb == NULL || xb->children == NULL)
-                               gml_lwerror("invalid GML representation", 30);
+                               gml_lwpgerror("invalid GML representation", 30);
 
                        tmp_pa = parse_gml_data(xb->children, hasz, root_srid);
                        if (tmp_pa->npoints != 1)
-                               gml_lwerror("invalid GML representation", 31);
+                               gml_lwpgerror("invalid GML representation", 31);
 
                        parse_gml_srs(xb, &srs);
                        if (srs.reverse_axis) tmp_pa = ptarray_flip_coordinates(tmp_pa);
@@ -898,7 +898,7 @@ static POINTARRAY* parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
                }
        }
 
-       if (pa == NULL) gml_lwerror("invalid GML representation", 32);
+       if (pa == NULL) gml_lwpgerror("invalid GML representation", 32);
 
        return pa;
 }
@@ -919,7 +919,7 @@ static LWGEOM* parse_gml_point(xmlNodePtr xnode, bool *hasz, int *root_srid)
                return lwpoint_as_lwgeom(lwpoint_construct_empty(*root_srid, 0, 0));
 
        pa = parse_gml_data(xnode->children, hasz, root_srid);
-       if (pa->npoints != 1) gml_lwerror("invalid GML representation", 34);
+       if (pa->npoints != 1) gml_lwpgerror("invalid GML representation", 34);
 
        parse_gml_srs(xnode, &srs);
        if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
@@ -954,7 +954,7 @@ static LWGEOM* parse_gml_line(xmlNodePtr xnode, bool *hasz, int *root_srid)
                return lwline_as_lwgeom(lwline_construct_empty(*root_srid, 0, 0));
                
        pa = parse_gml_data(xnode->children, hasz, root_srid);
-       if (pa->npoints < 2) gml_lwerror("invalid GML representation", 36);
+       if (pa->npoints < 2) gml_lwpgerror("invalid GML representation", 36);
 
        parse_gml_srs(xnode, &srs);
        if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
@@ -1002,7 +1002,7 @@ static LWGEOM* parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        break;
                }
        }
-       if (!found) gml_lwerror("invalid GML representation", 37);
+       if (!found) gml_lwpgerror("invalid GML representation", 37);
 
        ppa = (POINTARRAY**) lwalloc(sizeof(POINTARRAY*));
 
@@ -1018,7 +1018,7 @@ static LWGEOM* parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
                if (interpolation != NULL)
                {
                        if (strcmp((char *) interpolation, "linear"))
-                               gml_lwerror("invalid GML representation", 38);
+                               gml_lwpgerror("invalid GML representation", 38);
                        xmlFree(interpolation);
                }
 
@@ -1028,10 +1028,10 @@ static LWGEOM* parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
                ppa[lss] = parse_gml_data(xa->children, hasz, root_srid);
                npoints += ppa[lss]->npoints;
                if (ppa[lss]->npoints < 2)
-                       gml_lwerror("invalid GML representation", 39);
+                       gml_lwpgerror("invalid GML representation", 39);
                lss++;
        }
-       if (lss == 0) gml_lwerror("invalid GML representation", 40);
+       if (lss == 0) gml_lwpgerror("invalid GML representation", 40);
 
        /* Most common case, a single segment */
        if (lss == 1) pa = ppa[0];
@@ -1054,7 +1054,7 @@ static LWGEOM* parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (i > 0 && memcmp( getPoint_internal(pa, npoints),
                                             getPoint_internal(ppa[i], 0),
                                             *hasz ? sizeof(POINT3D) : sizeof(POINT2D)))
-                               gml_lwerror("invalid GML representation", 41);
+                               gml_lwpgerror("invalid GML representation", 41);
 
                        /* Aggregate stuff */
                        memcpy( getPoint_internal(pa, npoints),
@@ -1095,7 +1095,7 @@ static LWGEOM* parse_gml_linearring(xmlNodePtr xnode, bool *hasz, int *root_srid
        if (ppa[0]->npoints < 4
             || (!*hasz && !ptarray_is_closed_2d(ppa[0]))
             ||  (*hasz && !ptarray_is_closed_3d(ppa[0])))
-           gml_lwerror("invalid GML representation", 42);
+           gml_lwpgerror("invalid GML representation", 42);
 
        if (srs.reverse_axis) 
                ppa[0] = ptarray_flip_coordinates(ppa[0]);
@@ -1148,7 +1148,7 @@ static LWGEOM* parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (ppa[0]->npoints < 4
                                || (!*hasz && !ptarray_is_closed_2d(ppa[0]))
                                ||  (*hasz && !ptarray_is_closed_3d(ppa[0])))
-                               gml_lwerror("invalid GML representation", 43);
+                               gml_lwpgerror("invalid GML representation", 43);
 
                        if (srs.reverse_axis) ppa[0] = ptarray_flip_coordinates(ppa[0]);
                }
@@ -1156,7 +1156,7 @@ static LWGEOM* parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid)
 
        /* Found an <exterior> or <outerBoundaryIs> but no rings?!? We're outa here! */
        if ( ! ppa )
-               gml_lwerror("invalid GML representation", 43);  
+               gml_lwpgerror("invalid GML representation", 43);        
 
        for (ring=1, xa = xnode->children ; xa != NULL ; xa = xa->next)
        {
@@ -1180,7 +1180,7 @@ static LWGEOM* parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (ppa[ring]->npoints < 4
                                || (!*hasz && !ptarray_is_closed_2d(ppa[ring]))
                                ||  (*hasz && !ptarray_is_closed_3d(ppa[ring])))
-                               gml_lwerror("invalid GML representation", 43);
+                               gml_lwpgerror("invalid GML representation", 43);
 
                        if (srs.reverse_axis) ppa[ring] = ptarray_flip_coordinates(ppa[ring]);
                        ring++;
@@ -1188,7 +1188,7 @@ static LWGEOM* parse_gml_polygon(xmlNodePtr xnode, bool *hasz, int *root_srid)
        }
 
        /* Exterior Ring is mandatory */
-       if (ppa == NULL || ppa[0] == NULL) gml_lwerror("invalid GML representation", 44);
+       if (ppa == NULL || ppa[0] == NULL) gml_lwpgerror("invalid GML representation", 44);
 
        if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
        {
@@ -1224,7 +1224,7 @@ static LWGEOM* parse_gml_triangle(xmlNodePtr xnode, bool *hasz, int *root_srid)
        if (interpolation != NULL)
        {
                if (strcmp((char *) interpolation, "planar"))
-                       gml_lwerror("invalid GML representation", 45);
+                       gml_lwpgerror("invalid GML representation", 45);
                xmlFree(interpolation);
        }
 
@@ -1250,14 +1250,14 @@ static LWGEOM* parse_gml_triangle(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (pa->npoints != 4
                                || (!*hasz && !ptarray_is_closed_2d(pa))
                                ||  (*hasz && !ptarray_is_closed_3d(pa)))
-                               gml_lwerror("invalid GML representation", 46);
+                               gml_lwpgerror("invalid GML representation", 46);
 
                        if (srs.reverse_axis) pa = ptarray_flip_coordinates(pa);
                }
        }
 
        /* Exterior Ring is mandatory */
-       if (pa == NULL) gml_lwerror("invalid GML representation", 47);
+       if (pa == NULL) gml_lwpgerror("invalid GML representation", 47);
 
        if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
                gml_reproject_pa(pa, srs.srid, *root_srid);
@@ -1282,14 +1282,14 @@ static LWGEOM* parse_gml_patch(xmlNodePtr xnode, bool *hasz, int *root_srid)
 
        /* PolygonPatch */
        if (strcmp((char *) xnode->name, "PolygonPatch"))
-               gml_lwerror("invalid GML representation", 48);
+               gml_lwpgerror("invalid GML representation", 48);
 
        /* GML SF is resticted to planar interpolation  */
        interpolation = gmlGetProp(xnode, (xmlChar *) "interpolation");
        if (interpolation != NULL)
        {
                if (strcmp((char *) interpolation, "planar"))
-                       gml_lwerror("invalid GML representation", 48);
+                       gml_lwpgerror("invalid GML representation", 48);
                xmlFree(interpolation);
        }
 
@@ -1314,7 +1314,7 @@ static LWGEOM* parse_gml_patch(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (ppa[0]->npoints < 4
                                || (!*hasz && !ptarray_is_closed_2d(ppa[0]))
                                ||  (*hasz && !ptarray_is_closed_3d(ppa[0])))
-                               gml_lwerror("invalid GML representation", 48);
+                               gml_lwpgerror("invalid GML representation", 48);
 
                        if (srs.reverse_axis)
                                ppa[0] = ptarray_flip_coordinates(ppa[0]);
@@ -1323,7 +1323,7 @@ static LWGEOM* parse_gml_patch(xmlNodePtr xnode, bool *hasz, int *root_srid)
 
        /* Interior but no Exterior ! */
        if ( ! ppa )
-               gml_lwerror("invalid GML representation", 48);
+               gml_lwpgerror("invalid GML representation", 48);
 
        /* PolygonPatch/interior */
        for (ring=1, xa = xnode->children ; xa != NULL ; xa = xa->next)
@@ -1345,7 +1345,7 @@ static LWGEOM* parse_gml_patch(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        if (ppa[ring]->npoints < 4
                                || (!*hasz && !ptarray_is_closed_2d(ppa[ring]))
                                || ( *hasz && !ptarray_is_closed_3d(ppa[ring])))
-                               gml_lwerror("invalid GML representation", 49);
+                               gml_lwpgerror("invalid GML representation", 49);
 
                        if (srs.reverse_axis)
                                ppa[ring] = ptarray_flip_coordinates(ppa[ring]);
@@ -1355,7 +1355,7 @@ static LWGEOM* parse_gml_patch(xmlNodePtr xnode, bool *hasz, int *root_srid)
        }
 
        /* Exterior Ring is mandatory */
-       if (ppa == NULL || ppa[0] == NULL) gml_lwerror("invalid GML representation", 50);
+       if (ppa == NULL || ppa[0] == NULL) gml_lwpgerror("invalid GML representation", 50);
 
        if (srs.srid != *root_srid && *root_srid != SRID_UNKNOWN)
        {
@@ -1391,7 +1391,7 @@ static LWGEOM* parse_gml_surface(xmlNodePtr xnode, bool *hasz, int *root_srid)
                        break;
                }
        }
-       if (!found) gml_lwerror("invalid GML representation", 51);
+       if (!found) gml_lwpgerror("invalid GML representation", 51);
 
        /* Processing gml:PolygonPatch */
        for (patch=0, xa = xa->children ; xa != NULL ; xa = xa->next)
@@ -1403,12 +1403,12 @@ static LWGEOM* parse_gml_surface(xmlNodePtr xnode, bool *hasz, int *root_srid)
 
                /* SQL/MM define ST_CurvePolygon as a single patch only,
                   cf ISO 13249-3:2009 -> 4.2.9 (p27) */
-               if (patch > 1) gml_lwerror("invalid GML representation", 52);
+               if (patch > 1) gml_lwpgerror("invalid GML representation", 52);
 
                geom = parse_gml_patch(xa, hasz, root_srid);
        }
 
-       if (!patch) gml_lwerror("invalid GML representation", 53);
+       if (!patch) gml_lwpgerror("invalid GML representation", 53);
 
        return geom;
 }
@@ -1793,7 +1793,7 @@ static LWGEOM* lwgeom_from_gml(const char* xml)
        {
                xmlFreeDoc(xmldoc);
                xmlCleanupParser();
-               gml_lwerror("invalid GML representation", 1);
+               gml_lwpgerror("invalid GML representation", 1);
        }
 
        lwgeom = parse_gml(xmlroot, &hasz, &root_srid);
@@ -1838,7 +1838,7 @@ static LWGEOM* parse_gml(xmlNodePtr xnode, bool *hasz, int *root_srid)
        while (xa != NULL && (xa->type != XML_ELEMENT_NODE
                              || !is_gml_namespace(xa, false))) xa = xa->next;
 
-       if (xa == NULL) gml_lwerror("invalid GML representation", 55);
+       if (xa == NULL) gml_lwpgerror("invalid GML representation", 55);
 
        parse_gml_srs(xa, &srs);
        if (*root_srid == SRID_UNKNOWN && srs.srid != SRID_UNKNOWN)
@@ -1892,6 +1892,6 @@ static LWGEOM* parse_gml(xmlNodePtr xnode, bool *hasz, int *root_srid)
        if (!strcmp((char *) xa->name, "MultiGeometry"))
                return parse_gml_coll(xa, hasz, root_srid);
 
-       gml_lwerror("invalid GML representation", 56);
+       gml_lwpgerror("invalid GML representation", 56);
        return NULL; /* Never reach */
 }
index c3f16d7092c319f11f3f7c0bc0b8668daca6a32d..caa38b955770d34b2737d6c86e3f9b1af678dbce 100644 (file)
@@ -83,7 +83,7 @@ Datum geom_from_kml(PG_FUNCTION_ARGS)
        {
                xmlFreeDoc(xmldoc);
                xmlCleanupParser();
-               lwerror("invalid KML representation");
+               lwpgerror("invalid KML representation");
        }
 
        lwgeom = parse_kml(xmlroot, &hasz);
@@ -215,7 +215,7 @@ static double parse_kml_double(char *d, bool space_before, bool space_after)
        for (st = INIT, p = d ; *p ; p++)
        {
 
-lwnotice("State: %d, *p=%c", st, *p);
+lwpgnotice("State: %d, *p=%c", st, *p);
 
                if (isdigit(*p))
                {
@@ -223,37 +223,37 @@ lwnotice("State: %d, *p=%c", st, *p);
                        else if (st == NEED_DIG_DEC)                    st = DIG_DEC;
                        else if (st == NEED_DIG_EXP || st == EXP)       st = DIG_EXP;
                        else if (st == DIG || st == DIG_DEC || st == DIG_EXP);
-                       else lwerror("invalid KML representation");
+                       else lwpgerror("invalid KML representation");
                }
                else if (*p == '.')
                {
                        if      (st == DIG)                             st = NEED_DIG_DEC;
-                       else    lwerror("invalid KML representation");
+                       else    lwpgerror("invalid KML representation");
                }
                else if (*p == '-' || *p == '+')
                {
                        if      (st == INIT)                            st = NEED_DIG;
                        else if (st == EXP)                             st = NEED_DIG_EXP;
-                       else    lwerror("invalid KML representation");
+                       else    lwpgerror("invalid KML representation");
                }
                else if (*p == 'e' || *p == 'E')
                {
                        if      (st == DIG || st == DIG_DEC)            st = EXP;
-                       else    lwerror("invalid KML representation");
+                       else    lwpgerror("invalid KML representation");
                }
                else if (isspace(*p))
                {
-                       if (!space_after) lwerror("invalid KML representation");
+                       if (!space_after) lwpgerror("invalid KML representation");
                        if (st == DIG || st == DIG_DEC || st == DIG_EXP)st = END;
                        else if (st == NEED_DIG_DEC)                    st = END;
                        else if (st == END);
-                       else    lwerror("invalid KML representation");
+                       else    lwpgerror("invalid KML representation");
                }
-               else  lwerror("invalid KML representation");
+               else  lwpgerror("invalid KML representation");
        }
 
        if (st != DIG && st != NEED_DIG_DEC && st != DIG_DEC && st != DIG_EXP && st != END)
-               lwerror("invalid KML representation");
+               lwpgerror("invalid KML representation");
 
        return atof(d);
 }
@@ -274,7 +274,7 @@ static POINTARRAY* parse_kml_coordinates(xmlNodePtr xnode, bool *hasz)
        POINT4D pt;
   double d;
 
-       if (xnode == NULL) lwerror("invalid KML representation");
+       if (xnode == NULL) lwpgerror("invalid KML representation");
 
        for (found = false ; xnode != NULL ; xnode = xnode->next)
        {
@@ -285,7 +285,7 @@ static POINTARRAY* parse_kml_coordinates(xmlNodePtr xnode, bool *hasz)
                found = true;
                break;
        }
-       if (!found) lwerror("invalid KML representation");
+       if (!found) lwpgerror("invalid KML representation");
 
        /* We begin to retrieve coordinates string */
        kml_coord = xmlNodeGetContent(xnode);
@@ -302,44 +302,44 @@ static POINTARRAY* parse_kml_coordinates(xmlNodePtr xnode, bool *hasz)
   while (*p && isspace(*p)) ++p;
        for (kml_dims=0; *p ; p++)
        {
-//lwnotice("*p:%c, kml_dims:%d", *p, kml_dims);
+//lwpgnotice("*p:%c, kml_dims:%d", *p, kml_dims);
     if ( isdigit(*p) || *p == '+' || *p == '-' || *p == '.' ) {
                          kml_dims++;
         errno = 0; d = strtod(p, &q);
         if ( errno != 0 ) {
           // TODO: destroy dpa, return NULL
-          lwerror("invalid KML representation"); /*: %s", strerror(errno));*/
+          lwpgerror("invalid KML representation"); /*: %s", strerror(errno));*/
         }
         if      (kml_dims == 1) pt.x = d;
         else if (kml_dims == 2) pt.y = d;
         else if (kml_dims == 3) pt.z = d;
         else {
-          lwerror("invalid KML representation"); /* (more than 3 dimensions)"); */
+          lwpgerror("invalid KML representation"); /* (more than 3 dimensions)"); */
           // TODO: destroy dpa, return NULL
         }
 
-//lwnotice("after strtod d:%f, *q:%c, kml_dims:%d", d, *q, kml_dims);
+//lwpgnotice("after strtod d:%f, *q:%c, kml_dims:%d", d, *q, kml_dims);
 
         if ( *q && ! isspace(*q) && *q != ',' ) {
-          lwerror("invalid KML representation"); /* (invalid character %c follows ordinate value)", *q); */
+          lwpgerror("invalid KML representation"); /* (invalid character %c follows ordinate value)", *q); */
         }
 
         /* Look-ahead to see if we're done reading */
         while (*q && isspace(*q)) ++q;
         if ( isdigit(*q) || *q == '+' || *q == '-' || *q == '.' || ! *q ) {
-          if ( kml_dims < 2 ) lwerror("invalid KML representation"); /* (not enough ordinates)"); */
+          if ( kml_dims < 2 ) lwpgerror("invalid KML representation"); /* (not enough ordinates)"); */
           else if ( kml_dims < 3 ) *hasz = false;
           if ( ! seen_kml_dims ) seen_kml_dims = kml_dims;
           else if ( seen_kml_dims != kml_dims ) {
-            lwerror("invalid KML representation: mixed coordinates dimension");
+            lwpgerror("invalid KML representation: mixed coordinates dimension");
           }
           ptarray_append_point(dpa, &pt, LW_TRUE);
           kml_dims = 0;
         }
         p = q-1; /* will be incrementedon next iteration */
-//lwnotice("after look-ahead *p:%c, kml_dims:%d", *p, kml_dims);
+//lwpgnotice("after look-ahead *p:%c, kml_dims:%d", *p, kml_dims);
     } else if ( *p != ',' && ! isspace(*p) ) {
-          lwerror("invalid KML representation"); /* (unexpected character %c)", *p); */
+          lwpgerror("invalid KML representation"); /* (unexpected character %c)", *p); */
     }
        }
 
@@ -357,9 +357,9 @@ static LWGEOM* parse_kml_point(xmlNodePtr xnode, bool *hasz)
 {
        POINTARRAY *pa;
 
-       if (xnode->children == NULL) lwerror("invalid KML representation");
+       if (xnode->children == NULL) lwpgerror("invalid KML representation");
        pa = parse_kml_coordinates(xnode->children, hasz);
-       if (pa->npoints != 1) lwerror("invalid KML representation");
+       if (pa->npoints != 1) lwpgerror("invalid KML representation");
 
        return (LWGEOM *) lwpoint_construct(4326, NULL, pa);
 }
@@ -372,9 +372,9 @@ static LWGEOM* parse_kml_line(xmlNodePtr xnode, bool *hasz)
 {
        POINTARRAY *pa;
 
-       if (xnode->children == NULL) lwerror("invalid KML representation");
+       if (xnode->children == NULL) lwpgerror("invalid KML representation");
        pa = parse_kml_coordinates(xnode->children, hasz);
-       if (pa->npoints < 2) lwerror("invalid KML representation");
+       if (pa->npoints < 2) lwpgerror("invalid KML representation");
 
        return (LWGEOM *) lwline_construct(4326, NULL, pa);
 }
@@ -410,7 +410,7 @@ static LWGEOM* parse_kml_polygon(xmlNodePtr xnode, bool *hasz)
                        if (ppa[0]->npoints < 4
                                || (!*hasz && !ptarray_is_closed_2d(ppa[0]))
                                ||  (*hasz && !ptarray_is_closed_3d(ppa[0])))
-                               lwerror("invalid KML representation");
+                               lwpgerror("invalid KML representation");
                }
        }
 
@@ -436,14 +436,14 @@ static LWGEOM* parse_kml_polygon(xmlNodePtr xnode, bool *hasz)
                        if (ppa[ring]->npoints < 4
                                || (!*hasz && !ptarray_is_closed_2d(ppa[ring]))
                                ||  (*hasz && !ptarray_is_closed_3d(ppa[ring])))
-                               lwerror("invalid KML representation");
+                               lwpgerror("invalid KML representation");
 
                        ring++;
                }
        }
 
        /* Exterior Ring is mandatory */
-       if (ppa == NULL || ppa[0] == NULL) lwerror("invalid KML representation");
+       if (ppa == NULL || ppa[0] == NULL) lwpgerror("invalid KML representation");
 
        return (LWGEOM *) lwpoly_construct(4326, NULL, ring, ppa);
 }
@@ -490,7 +490,7 @@ static LWGEOM* parse_kml(xmlNodePtr xnode, bool *hasz)
        while (xa != NULL && (xa->type != XML_ELEMENT_NODE
                              || !is_kml_namespace(xa, false))) xa = xa->next;
 
-       if (xa == NULL) lwerror("invalid KML representation");
+       if (xa == NULL) lwpgerror("invalid KML representation");
 
        if (!strcmp((char *) xa->name, "Point"))
                return parse_kml_point(xa, hasz);
@@ -504,6 +504,6 @@ static LWGEOM* parse_kml(xmlNodePtr xnode, bool *hasz)
        if (!strcmp((char *) xa->name, "MultiGeometry"))
                return parse_kml_multi(xa, hasz);
 
-       lwerror("invalid KML representation");
+       lwpgerror("invalid KML representation");
        return NULL; /* Never reach */
 }
index d3111eff2f8ae8a2ef45954dc7c6fbbcdac9b699..f371a58945b51b70c4115b83c6fd0f36ebcdc3b7 100644 (file)
@@ -187,13 +187,13 @@ Datum LWGEOM_to_latlon(PG_FUNCTION_ARGS)
        uint8_t geom_type = gserialized_get_type(pg_lwgeom);
        if (POINTTYPE != geom_type)
        {
-               lwerror("Only points are supported, you tried type %s.", lwtype_name(geom_type));
+               lwpgerror("Only points are supported, you tried type %s.", lwtype_name(geom_type));
        }
        /* Convert to LWGEOM type */
        lwgeom = lwgeom_from_gserialized(pg_lwgeom);
 
   if (format_text == NULL) {
-    lwerror("ST_AsLatLonText: invalid format string (null");
+    lwpgerror("ST_AsLatLonText: invalid format string (null");
     PG_RETURN_NULL();
   }
 
index 77ce45b98a39c555a4f80539b2b649278544b80d..4d9b748eb7c4483d54aed8d8090858275c546b4e 100644 (file)
@@ -570,7 +570,7 @@ Datum LWGEOM_x_point(PG_FUNCTION_ARGS)
        geom = PG_GETARG_GSERIALIZED_P(0);
 
        if ( gserialized_get_type(geom) != POINTTYPE )
-               lwerror("Argument to ST_X() must be a point");
+               lwpgerror("Argument to ST_X() must be a point");
 
        lwgeom = lwgeom_from_gserialized(geom);
        point = lwgeom_as_lwpoint(lwgeom);
@@ -599,7 +599,7 @@ Datum LWGEOM_y_point(PG_FUNCTION_ARGS)
        geom = PG_GETARG_GSERIALIZED_P(0);
 
        if ( gserialized_get_type(geom) != POINTTYPE )
-               lwerror("Argument to ST_Y() must be a point");
+               lwpgerror("Argument to ST_Y() must be a point");
 
        lwgeom = lwgeom_from_gserialized(geom);
        point = lwgeom_as_lwpoint(lwgeom);
@@ -630,7 +630,7 @@ Datum LWGEOM_z_point(PG_FUNCTION_ARGS)
        geom = PG_GETARG_GSERIALIZED_P(0);
 
        if ( gserialized_get_type(geom) != POINTTYPE )
-               lwerror("Argument to ST_Z() must be a point");
+               lwpgerror("Argument to ST_Z() must be a point");
 
        lwgeom = lwgeom_from_gserialized(geom);
        point = lwgeom_as_lwpoint(lwgeom);
@@ -663,7 +663,7 @@ Datum LWGEOM_m_point(PG_FUNCTION_ARGS)
        geom = PG_GETARG_GSERIALIZED_P(0);
 
        if ( gserialized_get_type(geom) != POINTTYPE )
-               lwerror("Argument to ST_M() must be a point");
+               lwpgerror("Argument to ST_M() must be a point");
 
        lwgeom = lwgeom_from_gserialized(geom);
        point = lwgeom_as_lwpoint(lwgeom);
index f88627a7373f5f86d68954730105aff963ce418c..838fb669abf0a21bc31a14769a9b4a823ff47d88 100644 (file)
@@ -165,7 +165,7 @@ RTreeCreateLeafNode(POINTARRAY* pa, int startPoint)
 
        if (pa->npoints < startPoint + 2)
        {
-               lwerror("RTreeCreateLeafNode: npoints = %d, startPoint = %d", pa->npoints, startPoint);
+               lwpgerror("RTreeCreateLeafNode: npoints = %d, startPoint = %d", pa->npoints, startPoint);
        }
 
        /*
@@ -313,7 +313,7 @@ RTreeBuilder(const LWGEOM* lwgeom, GeomCache* cache)
 
        if ( rtree_cache->index )
        {
-               lwerror("RTreeBuilder asked to build index where one already exists.");
+               lwpgerror("RTreeBuilder asked to build index where one already exists.");
                return LW_FAILURE;
        }
        
@@ -370,7 +370,7 @@ RTreeBuilder(const LWGEOM* lwgeom, GeomCache* cache)
        else
        {
                /* Uh oh, shouldn't be here. */
-               lwerror("RTreeBuilder got asked to build index on non-polygon");
+               lwpgerror("RTreeBuilder got asked to build index on non-polygon");
                return LW_FAILURE;
        }
        return LW_SUCCESS;      
index 8fcee8030052bd277c6eecf9600b8b93e04c55ae..fe91ccb854f2df1f8aedf4d237efa12d1825bfaa 100644 (file)
@@ -50,7 +50,7 @@ void sfcgal_postgis_init(void)
 {
     if ( ! __sfcgal_init ) {
        sfcgal_init();
-       sfcgal_set_error_handlers((sfcgal_error_handler_t) lwnotice, (sfcgal_error_handler_t) lwerror);
+       sfcgal_set_error_handlers((sfcgal_error_handler_t) lwpgnotice, (sfcgal_error_handler_t) lwpgerror);
        sfcgal_set_alloc_handlers(lwalloc, lwfree);
        __sfcgal_init = 1;
     }
@@ -65,7 +65,7 @@ sfcgal_geometry_t* POSTGIS2SFCGALGeometry(GSERIALIZED *pglwgeom)
 
        if (! lwgeom)
        {
-               lwerror("POSTGIS2SFCGALGeometry: Unable to deserialize input");
+               lwpgerror("POSTGIS2SFCGALGeometry: Unable to deserialize input");
        }
        g = LWGEOM2SFCGAL(lwgeom);
        lwgeom_free(lwgeom);
@@ -82,7 +82,7 @@ sfcgal_prepared_geometry_t* POSTGIS2SFCGALPreparedGeometry(GSERIALIZED *pglwgeom
 
        if (!lwgeom)
        {
-               lwerror("POSTGIS2SFCGALPreparedGeometry: Unable to deserialize input");
+               lwpgerror("POSTGIS2SFCGALPreparedGeometry: Unable to deserialize input");
        }
        g = LWGEOM2SFCGAL(lwgeom);
 
index 1cbe3bdbfc5e461c84eac6148ead0b1b7475100f..47d6f9ef22be7b88e54ea791808808e7a0c9118d 100644 (file)
@@ -434,7 +434,7 @@ rt_errorstate rt_raster_surface(rt_raster raster, int nband, LWMPOLY **surface)
        }
 
        /* initialize GEOS */
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(rtinfo, lwgeom_geos_error);
 
        /* use gdal polygonize */
        gv = rt_raster_gdal_polygonize(raster, nband, 1, &gvcount);
@@ -1190,7 +1190,7 @@ rt_raster_gdal_polygonize(
        }
 
        /* initialize GEOS */
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(rtinfo, lwgeom_geos_error);
 
        RASTER_DEBUGF(3, "storing polygons (%d)", nFeatureCount);
 
index 01f4b0e155e7f13a7ccded2dcf2fa1c76d6d44b2..f8b4c039174bf03fe6dcc4a9531d92a98be5c345 100644 (file)
@@ -1223,7 +1223,7 @@ rt_raster_compute_skewed_raster(
        raster->height = _r[1];
 
        /* initialize GEOS */
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(rtinfo, lwgeom_geos_error);
 
        /* create reference LWPOLY */
        {
@@ -2716,7 +2716,7 @@ rt_raster_gdal_rasterize(
                */
 
                /* initialize GEOS */
-               initGEOS(lwnotice, lwgeom_geos_error);
+               initGEOS(rtinfo, lwgeom_geos_error);
 
                /* convert envelope to geometry */
                RASTER_DEBUG(4, "Converting envelope to geometry");
index 495a60388898611a11b207699bbbf43b4f7d759e..b9587c819f0a2ae95b8ec53cb34d9294675c182a 100644 (file)
@@ -171,7 +171,7 @@ rt_errorstate rt_raster_geos_spatial_relationship(
                return ES_ERROR;
        }
 
-       initGEOS(lwnotice, lwgeom_geos_error);
+       initGEOS(rtinfo, lwgeom_geos_error);
 
        /* get LWMPOLY of each band */
        if (rt_raster_surface(rast1, nband1, &surface1) != ES_NONE) {
@@ -1066,7 +1066,7 @@ rt_raster_intersects(
        do {
                int rtn;
 
-               initGEOS(lwnotice, lwgeom_geos_error);
+               initGEOS(rtinfo, lwgeom_geos_error);
 
                rtn = 1;
                for (i = 0; i < 2; i++) {