[postgis-tickets] r17409 - Style changes from the previous commits

Raul raul at rmr.ninja
Wed Apr 24 03:04:42 PDT 2019


Author: algunenano
Date: 2019-04-24 03:04:42 -0700 (Wed, 24 Apr 2019)
New Revision: 17409

Modified:
   trunk/liblwgeom/liblwgeom_topo.h
   trunk/liblwgeom/liblwgeom_topo_internal.h
   trunk/liblwgeom/lwgeom_topo.c
   trunk/raster/rt_pg/rtpg_gdal.c
   trunk/raster/rt_pg/rtpg_geometry.c
   trunk/topology/postgis_topology.c
Log:
Style changes from the previous commits

Also addresses some warnings in debug logs

Note: SPI_processed was 32b until PG9.5 (still supported)


Modified: trunk/liblwgeom/liblwgeom_topo.h
===================================================================
--- trunk/liblwgeom/liblwgeom_topo.h	2019-04-24 10:03:07 UTC (rev 17408)
+++ trunk/liblwgeom/liblwgeom_topo.h	2019-04-24 10:04:42 UTC (rev 17409)
@@ -198,10 +198,7 @@
    *           (@see lastErrorMessage)
    *
    */
-  LWT_ISO_NODE* (*getNodeById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids, uint64_t* numelems, int fields
-  );
+  LWT_ISO_NODE *(*getNodeById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields);
 
   /**
    * Get nodes within distance by point
@@ -223,11 +220,12 @@
    *         - error ("numelems" is set to -1)
    *
    */
-  LWT_ISO_NODE* (*getNodeWithinDistance2D) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWPOINT* pt, double dist, uint64_t* numelems,
-      int fields, int limit
-  );
+  LWT_ISO_NODE *(*getNodeWithinDistance2D)(const LWT_BE_TOPOLOGY *topo,
+					   const LWPOINT *pt,
+					   double dist,
+					   uint64_t *numelems,
+					   int fields,
+					   int limit);
 
   /**
    * Insert nodes
@@ -242,11 +240,7 @@
    *
    * @return 1 on success, 0 on error (@see lastErrorMessage)
    */
-  int (*insertNodes) (
-      const LWT_BE_TOPOLOGY* topo,
-      LWT_ISO_NODE* nodes,
-      uint64_t numelems
-  );
+  int (*insertNodes)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_NODE *nodes, uint64_t numelems);
 
   /**
    * Get edge by id
@@ -264,10 +258,7 @@
    *         - none found ("numelems" is set to 0)
    *         - error ("numelems" is set to -1)
    */
-  LWT_ISO_EDGE* (*getEdgeById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids, uint64_t* numelems, int fields
-  );
+  LWT_ISO_EDGE *(*getEdgeById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields);
 
   /**
    * Get edges within distance by point
@@ -289,11 +280,12 @@
    *         - error ("numelems" is set to -1)
    *
    */
-  LWT_ISO_EDGE* (*getEdgeWithinDistance2D) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWPOINT* pt, double dist, uint64_t* numelems,
-      int fields, int limit
-  );
+  LWT_ISO_EDGE *(*getEdgeWithinDistance2D)(const LWT_BE_TOPOLOGY *topo,
+					   const LWPOINT *pt,
+					   double dist,
+					   uint64_t *numelems,
+					   int fields,
+					   int limit);
 
   /**
    * Get next available edge identifier
@@ -322,11 +314,7 @@
    *
    * @return number of inserted edges, or -1 (@see lastErrorMessage)
    */
-  int (*insertEdges) (
-      const LWT_BE_TOPOLOGY* topo,
-      LWT_ISO_EDGE* edges,
-      uint64_t numelems
-  );
+  int (*insertEdges)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_EDGE *edges, uint64_t numelems);
 
   /**
    * Update edges selected by fields match/mismatch
@@ -369,10 +357,7 @@
    *         - none found ("numelems" is set to 0)
    *         - error ("numelems" is set to -1)
    */
-  LWT_ISO_FACE* (*getFaceById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids, uint64_t* numelems, int fields
-  );
+  LWT_ISO_FACE *(*getFaceById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields);
 
   /**
    * Get face containing point
@@ -447,11 +432,8 @@
    *         - error ("numelems" is set to -1)
    *
    */
-  LWT_ISO_NODE* (*getNodeWithinBox2D) (
-      const LWT_BE_TOPOLOGY* topo,
-      const GBOX* box,
-      uint64_t* numelems, int fields, int limit
-  );
+  LWT_ISO_NODE *(
+      *getNodeWithinBox2D)(const LWT_BE_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, int limit);
 
   /**
    * Get edges whose bounding box overlaps a given 2D bounding box
@@ -472,11 +454,8 @@
    *         - error ("numelems" is set to -1)
    *
    */
-  LWT_ISO_EDGE* (*getEdgeWithinBox2D) (
-      const LWT_BE_TOPOLOGY* topo,
-      const GBOX* box,
-      uint64_t* numelems, int fields, int limit
-  );
+  LWT_ISO_EDGE *(
+      *getEdgeWithinBox2D)(const LWT_BE_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, int limit);
 
   /**
    * Get edges that start or end on any of the given node identifiers
@@ -496,10 +475,7 @@
    *         - error ("numelems" is set to -1)
    *           (@see lastErrorMessage)
    */
-  LWT_ISO_EDGE* (*getEdgeByNode) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids, uint64_t* numelems, int fields
-  );
+  LWT_ISO_EDGE *(*getEdgeByNode)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields);
 
   /**
    * Update nodes selected by fields match/mismatch
@@ -559,11 +535,7 @@
    *
    * @return number of inserted faces, or -1 (@see lastErrorMessage)
    */
-  int (*insertFaces) (
-      const LWT_BE_TOPOLOGY* topo,
-      LWT_ISO_FACE* faces,
-      uint64_t numelems
-  );
+  int (*insertFaces)(const LWT_BE_TOPOLOGY *topo, LWT_ISO_FACE *faces, uint64_t numelems);
 
   /**
    * Update faces by id
@@ -609,10 +581,7 @@
    *         walked in their direction, negative ones in opposite) or
    *         NULL on error (@see lastErrorMessage)
    */
-  LWT_ELEMID* (*getRingEdges) (
-      const LWT_BE_TOPOLOGY* topo,
-      LWT_ELEMID edge, uint64_t *numedges, uint64_t limit
-  );
+  LWT_ELEMID *(*getRingEdges)(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge, uint64_t *numedges, int limit);
 
   /**
    * Update edges by id
@@ -628,11 +597,7 @@
    * @return number of edges being updated or -1 on error
    *         (@see lastErrorMessage)
    */
-  int (*updateEdgesById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ISO_EDGE* edges, uint64_t numedges,
-      int upd_fields
-  );
+  int (*updateEdgesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *edges, uint64_t numedges, int upd_fields);
 
   /**
    * \brief
@@ -654,11 +619,11 @@
    *         - no edge found ("numelems" is set to 0)
    *         - error ("numelems" is set to -1)
    */
-  LWT_ISO_EDGE* (*getEdgeByFace) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids, uint64_t* numelems, int fields,
-      const GBOX *box
-  );
+  LWT_ISO_EDGE *(*getEdgeByFace)(const LWT_BE_TOPOLOGY *topo,
+				 const LWT_ELEMID *ids,
+				 uint64_t *numelems,
+				 int fields,
+				 const GBOX *box);
 
   /**
    * Get isolated nodes contained in any of the given faces
@@ -679,11 +644,11 @@
    *         - no nod found ("numelems" is set to 0)
    *         - error ("numelems" is set to -1, @see lastErrorMessage)
    */
-  LWT_ISO_NODE* (*getNodeByFace) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* faces, uint64_t* numelems, int fields,
-      const GBOX *box
-  );
+  LWT_ISO_NODE *(*getNodeByFace)(const LWT_BE_TOPOLOGY *topo,
+				 const LWT_ELEMID *faces,
+				 uint64_t *numelems,
+				 int fields,
+				 const GBOX *box);
 
   /**
    * Update nodes by id
@@ -698,11 +663,7 @@
    * @return number of nodes being updated or -1 on error
    *         (@see lastErrorMessage)
    */
-  int (*updateNodesById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ISO_NODE* nodes, uint64_t numnodes,
-      int upd_fields
-  );
+  int (*updateNodesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, uint64_t numnodes, int upd_fields);
 
   /**
    * Delete faces by id
@@ -714,11 +675,7 @@
    * @return number of faces being deleted or -1 on error
    *         (@see lastErrorMessage)
    */
-  int (*deleteFacesById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids,
-      uint64_t numelems
-  );
+  int (*deleteFacesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems);
 
   /**
    * Get topology SRID
@@ -753,11 +710,7 @@
    * @return number of nodes being deleted or -1 on error
    *         (@see lastErrorMessage)
    */
-  int (*deleteNodesById) (
-      const LWT_BE_TOPOLOGY* topo,
-      const LWT_ELEMID* ids,
-      uint64_t numelems
-  );
+  int (*deleteNodesById)(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems);
 
   /**
    * Check TopoGeometry objects before an edge removal event
@@ -863,11 +816,11 @@
    *         - error ("numelems" is set to -1)
    *
    */
-  LWT_ISO_FACE* (*getFaceWithinBox2D) (
-      const LWT_BE_TOPOLOGY* topo,
-      const GBOX* box,
-      uint64_t* numelems, int fields, uint64_t limit
-  );
+  LWT_ISO_FACE *(*getFaceWithinBox2D)(const LWT_BE_TOPOLOGY *topo,
+				      const GBOX *box,
+				      uint64_t *numelems,
+				      int fields,
+				      int limit);
 
 } LWT_BE_CALLBACKS;
 

Modified: trunk/liblwgeom/liblwgeom_topo_internal.h
===================================================================
--- trunk/liblwgeom/liblwgeom_topo_internal.h	2019-04-24 10:03:07 UTC (rev 17408)
+++ trunk/liblwgeom/liblwgeom_topo_internal.h	2019-04-24 10:04:42 UTC (rev 17409)
@@ -49,24 +49,30 @@
 
 int lwt_be_freeTopology(LWT_TOPOLOGY *topo);
 
-LWT_ISO_NODE* lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt, double dist, uint64_t* numelems, int fields, uint64_t limit);
+LWT_ISO_NODE *lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY *topo,
+					     LWPOINT *pt,
+					     double dist,
+					     uint64_t *numelems,
+					     int fields,
+					     uint64_t limit);
 
-LWT_ISO_NODE* lwt_be_getNodeById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids, uint64_t* numelems, int fields);
+LWT_ISO_NODE *lwt_be_getNodeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields);
 
 int lwt_be_ExistsCoincidentNode(LWT_TOPOLOGY* topo, LWPOINT* pt);
-int lwt_be_insertNodes(LWT_TOPOLOGY* topo, LWT_ISO_NODE* node, uint64_t numelems);
+int lwt_be_insertNodes(LWT_TOPOLOGY *topo, LWT_ISO_NODE *node, uint64_t numelems);
 
 int lwt_be_ExistsEdgeIntersectingPoint(LWT_TOPOLOGY* topo, LWPOINT* pt);
 
 LWT_ELEMID lwt_be_getNextEdgeId(LWT_TOPOLOGY* topo);
-LWT_ISO_EDGE* lwt_be_getEdgeById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                               uint64_t* numelems, int fields);
-LWT_ISO_EDGE* lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt,
-                               double dist, uint64_t* numelems, int fields,
-                               uint64_t limit);
+LWT_ISO_EDGE *lwt_be_getEdgeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields);
+LWT_ISO_EDGE *lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY *topo,
+					     LWPOINT *pt,
+					     double dist,
+					     uint64_t *numelems,
+					     int fields,
+					     uint64_t limit);
+int lwt_be_insertEdges(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edge, uint64_t numelems);
 int
-lwt_be_insertEdges(LWT_TOPOLOGY* topo, LWT_ISO_EDGE* edge, uint64_t numelems);
-int
 lwt_be_updateEdges(LWT_TOPOLOGY* topo, const LWT_ISO_EDGE* sel_edge, int sel_fields, const LWT_ISO_EDGE* upd_edge, int upd_fields, const LWT_ISO_EDGE* exc_edge, int exc_fields);
 int
 lwt_be_deleteEdges(LWT_TOPOLOGY* topo, const LWT_ISO_EDGE* sel_edge, int sel_fields);

Modified: trunk/liblwgeom/lwgeom_topo.c
===================================================================
--- trunk/liblwgeom/lwgeom_topo.c	2019-04-24 10:03:07 UTC (rev 17408)
+++ trunk/liblwgeom/lwgeom_topo.c	2019-04-24 10:04:42 UTC (rev 17409)
@@ -151,65 +151,61 @@
   CBT0(topo, freeTopology);
 }
 
-LWT_ISO_NODE*
-lwt_be_getNodeById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                   uint64_t* numelems, int fields)
+LWT_ISO_NODE *
+lwt_be_getNodeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   CBT3(topo, getNodeById, ids, numelems, fields);
 }
 
-LWT_ISO_NODE*
-lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt,
-                               double dist, uint64_t* numelems, int fields,
-                               uint64_t limit)
+LWT_ISO_NODE *
+lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY *topo,
+			       LWPOINT *pt,
+			       double dist,
+			       uint64_t *numelems,
+			       int fields,
+			       uint64_t limit)
 {
   CBT5(topo, getNodeWithinDistance2D, pt, dist, numelems, fields, limit);
 }
 
-static LWT_ISO_NODE*
-lwt_be_getNodeWithinBox2D( const LWT_TOPOLOGY* topo,
-                           const GBOX* box, uint64_t* numelems, int fields,
-                           uint64_t limit )
+static LWT_ISO_NODE *
+lwt_be_getNodeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, uint64_t limit)
 {
   CBT4(topo, getNodeWithinBox2D, box, numelems, fields, limit);
 }
 
-static LWT_ISO_EDGE*
-lwt_be_getEdgeWithinBox2D( const LWT_TOPOLOGY* topo,
-                           const GBOX* box, uint64_t* numelems, int fields,
-                           uint64_t limit )
+static LWT_ISO_EDGE *
+lwt_be_getEdgeWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, uint64_t limit)
 {
   CBT4(topo, getEdgeWithinBox2D, box, numelems, fields, limit);
 }
 
-static LWT_ISO_FACE*
-lwt_be_getFaceWithinBox2D( const LWT_TOPOLOGY* topo,
-                           const GBOX* box, uint64_t* numelems, int fields,
-                           uint64_t limit )
+static LWT_ISO_FACE *
+lwt_be_getFaceWithinBox2D(const LWT_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, uint64_t limit)
 {
   CBT4(topo, getFaceWithinBox2D, box, numelems, fields, limit);
 }
 
 int
-lwt_be_insertNodes(LWT_TOPOLOGY* topo, LWT_ISO_NODE* node, uint64_t numelems)
+lwt_be_insertNodes(LWT_TOPOLOGY *topo, LWT_ISO_NODE *node, uint64_t numelems)
 {
   CBT2(topo, insertNodes, node, numelems);
 }
 
 static int
-lwt_be_insertFaces(LWT_TOPOLOGY* topo, LWT_ISO_FACE* face, uint64_t numelems)
+lwt_be_insertFaces(LWT_TOPOLOGY *topo, LWT_ISO_FACE *face, uint64_t numelems)
 {
   CBT2(topo, insertFaces, face, numelems);
 }
 
 static int
-lwt_be_deleteFacesById(const LWT_TOPOLOGY* topo, const LWT_ELEMID* ids, uint64_t numelems)
+lwt_be_deleteFacesById(const LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems)
 {
   CBT2(topo, deleteFacesById, ids, numelems);
 }
 
 static int
-lwt_be_deleteNodesById(const LWT_TOPOLOGY* topo, const LWT_ELEMID* ids, uint64_t numelems)
+lwt_be_deleteNodesById(const LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems)
 {
   CBT2(topo, deleteNodesById, ids, numelems);
 }
@@ -220,51 +216,49 @@
   CBT0(topo, getNextEdgeId);
 }
 
-LWT_ISO_EDGE*
-lwt_be_getEdgeById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                   uint64_t* numelems, int fields)
+LWT_ISO_EDGE *
+lwt_be_getEdgeById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   CBT3(topo, getEdgeById, ids, numelems, fields);
 }
 
-static LWT_ISO_FACE*
-lwt_be_getFaceById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                   uint64_t* numelems, int fields)
+static LWT_ISO_FACE *
+lwt_be_getFaceById(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   CBT3(topo, getFaceById, ids, numelems, fields);
 }
 
-static LWT_ISO_EDGE*
-lwt_be_getEdgeByNode(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                   uint64_t* numelems, int fields)
+static LWT_ISO_EDGE *
+lwt_be_getEdgeByNode(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   CBT3(topo, getEdgeByNode, ids, numelems, fields);
 }
 
-static LWT_ISO_EDGE*
-lwt_be_getEdgeByFace(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                   uint64_t* numelems, int fields, const GBOX *box)
+static LWT_ISO_EDGE *
+lwt_be_getEdgeByFace(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields, const GBOX *box)
 {
   CBT4(topo, getEdgeByFace, ids, numelems, fields, box);
 }
 
-static LWT_ISO_NODE*
-lwt_be_getNodeByFace(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
-                   uint64_t* numelems, int fields, const GBOX *box)
+static LWT_ISO_NODE *
+lwt_be_getNodeByFace(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields, const GBOX *box)
 {
   CBT4(topo, getNodeByFace, ids, numelems, fields, box);
 }
 
-LWT_ISO_EDGE*
-lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt,
-                               double dist, uint64_t* numelems, int fields,
-                               uint64_t limit)
+LWT_ISO_EDGE *
+lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY *topo,
+			       LWPOINT *pt,
+			       double dist,
+			       uint64_t *numelems,
+			       int fields,
+			       uint64_t limit)
 {
   CBT5(topo, getEdgeWithinDistance2D, pt, dist, numelems, fields, limit);
 }
 
 int
-lwt_be_insertEdges(LWT_TOPOLOGY* topo, LWT_ISO_EDGE* edge, uint64_t numelems)
+lwt_be_insertEdges(LWT_TOPOLOGY *topo, LWT_ISO_EDGE *edge, uint64_t numelems)
 {
   CBT2(topo, insertEdges, edge, numelems);
 }
@@ -375,9 +369,8 @@
   CBT3(topo, updateTopoGeomEdgeHeal, edge1, edge2, newedge);
 }
 
-static LWT_ELEMID*
-lwt_be_getRingEdges( LWT_TOPOLOGY* topo,
-                     LWT_ELEMID edge, uint64_t *numedges, uint64_t limit )
+static LWT_ELEMID *
+lwt_be_getRingEdges(LWT_TOPOLOGY *topo, LWT_ELEMID edge, uint64_t *numedges, uint64_t limit)
 {
   CBT3(topo, getRingEdges, edge, numedges, limit);
 }
@@ -388,12 +381,13 @@
 int
 lwt_be_ExistsCoincidentNode(LWT_TOPOLOGY* topo, LWPOINT* pt)
 {
-  uint64_t exists = 0;
-  lwt_be_getNodeWithinDistance2D(topo, pt, 0, &exists, 0, -1);
-  if ( exists == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return 0;
-  }
+	uint64_t exists = 0;
+	lwt_be_getNodeWithinDistance2D(topo, pt, 0, &exists, 0, -1);
+	if (exists == UINT64_MAX)
+	{
+		lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		return 0;
+	}
   return exists;
 }
 
@@ -400,12 +394,13 @@
 int
 lwt_be_ExistsEdgeIntersectingPoint(LWT_TOPOLOGY* topo, LWPOINT* pt)
 {
-  uint64_t exists = 0;
-  lwt_be_getEdgeWithinDistance2D(topo, pt, 0, &exists, 0, -1);
-  if ( exists == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return 0;
-  }
+	uint64_t exists = 0;
+	lwt_be_getEdgeWithinDistance2D(topo, pt, 0, &exists, 0, -1);
+	if (exists == UINT64_MAX)
+	{
+		lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		return 0;
+	}
   return exists;
 }
 
@@ -601,19 +596,20 @@
                         LWT_ELEMID start_node, LWT_ELEMID end_node,
                         const LWLINE *geom, LWT_ELEMID myself )
 {
-  uint64_t i, num_nodes, num_edges;
-  LWT_ISO_EDGE *edges;
-  LWT_ISO_NODE *nodes;
-  const GBOX *edgebox;
-  GEOSGeometry *edgegg;
+	uint64_t i, num_nodes, num_edges;
+	LWT_ISO_EDGE *edges;
+	LWT_ISO_NODE *nodes;
+	const GBOX *edgebox;
+	GEOSGeometry *edgegg;
 
-  initGEOS(lwnotice, lwgeom_geos_error);
+	initGEOS(lwnotice, lwgeom_geos_error);
 
-  edgegg = LWGEOM2GEOS( lwline_as_lwgeom(geom), 0);
-  if ( ! edgegg ) {
-    lwerror("Could not convert edge geometry to GEOS: %s", lwgeom_geos_errmsg);
-    return -1;
-  }
+	edgegg = LWGEOM2GEOS(lwline_as_lwgeom(geom), 0);
+	if (!edgegg)
+	{
+		lwerror("Could not convert edge geometry to GEOS: %s", lwgeom_geos_errmsg);
+		return -1;
+	}
   edgebox = lwgeom_get_bbox( lwline_as_lwgeom(geom) );
 
   /* loop over each node within the edge's gbox */
@@ -620,9 +616,10 @@
   nodes = lwt_be_getNodeWithinBox2D( topo, edgebox, &num_nodes,
                                             LWT_COL_NODE_ALL, 0 );
   LWDEBUGF(1, "lwt_be_getNodeWithinBox2D returned %d nodes", num_nodes);
-  if ( num_nodes == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (num_nodes == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   for ( i=0; i<num_nodes; ++i )
   {
@@ -648,10 +645,11 @@
   /* loop over each edge within the edge's gbox */
   edges = lwt_be_getEdgeWithinBox2D( topo, edgebox, &num_edges, LWT_COL_EDGE_ALL, 0 );
   LWDEBUGF(1, "lwt_be_getEdgeWithinBox2D returned %d edges", num_edges);
-  if ( num_edges == UINT64_MAX ) {
-    GEOSGeom_destroy(edgegg);
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (num_edges == UINT64_MAX)
+  {
+	  GEOSGeom_destroy(edgegg);
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   for ( i=0; i<num_edges; ++i )
   {
@@ -769,24 +767,24 @@
 lwt_AddIsoEdge( LWT_TOPOLOGY* topo, LWT_ELEMID startNode,
                 LWT_ELEMID endNode, const LWLINE* geom )
 {
-  uint64_t num_nodes;
-  uint64_t i;
-  LWT_ISO_EDGE newedge;
-  LWT_ISO_NODE *endpoints;
-  LWT_ELEMID containing_face = -1;
-  LWT_ELEMID node_ids[2];
-  LWT_ISO_NODE updated_nodes[2];
-  int skipISOChecks = 0;
-  POINT2D p1, p2;
+	uint64_t num_nodes;
+	uint64_t i;
+	LWT_ISO_EDGE newedge;
+	LWT_ISO_NODE *endpoints;
+	LWT_ELEMID containing_face = -1;
+	LWT_ELEMID node_ids[2];
+	LWT_ISO_NODE updated_nodes[2];
+	int skipISOChecks = 0;
+	POINT2D p1, p2;
 
-  /* NOT IN THE SPECS:
-   * A closed edge is never isolated (as it forms a face)
-   */
-  if ( startNode == endNode )
-  {
-    lwerror("Closed edges would not be isolated, try lwt_AddEdgeNewFaces");
-    return -1;
-  }
+	/* NOT IN THE SPECS:
+	 * A closed edge is never isolated (as it forms a face)
+	 */
+	if (startNode == endNode)
+	{
+		lwerror("Closed edges would not be isolated, try lwt_AddEdgeNewFaces");
+		return -1;
+	}
 
   if ( ! skipISOChecks )
   {
@@ -811,7 +809,7 @@
   node_ids[1] = endNode;
   endpoints = lwt_be_getNodeById( topo, node_ids, &num_nodes,
                                              LWT_COL_NODE_ALL );
-  if ( num_nodes == UINT64_MAX )
+  if (num_nodes == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -945,7 +943,7 @@
   if ( ! *oldedge )
   {
     LWDEBUGF(1, "lwt_be_getEdgeById returned NULL and set i=%d", i);
-    if ( i == UINT64_MAX )
+    if (i == UINT64_MAX)
     {
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
       return NULL;
@@ -1516,9 +1514,10 @@
 
   /* Get incident edges */
   edges = lwt_be_getEdgeByNode( topo, &node, &numedges, LWT_COL_EDGE_ALL );
-  if ( numedges == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return 0;
+  if (numedges == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return 0;
   }
 
   LWDEBUGF(1, "getEdgeByNode returned %d edges, minaz=%g, maxaz=%g",
@@ -1764,7 +1763,7 @@
   ring_edges = lwt_be_getEdgeById(topo, edge_ids, &i,
                                   LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM);
   lwfree( edge_ids );
-  if ( i == UINT64_MAX )
+  if (i == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return NULL;
@@ -1856,23 +1855,24 @@
                    LWT_ELEMID sedge, LWT_ELEMID face,
                    int mbr_only )
 {
-  uint64_t numfaceedges, i, j;
-  int newface_outside;
-  uint64_t num_signed_edge_ids;
-  LWT_ELEMID *signed_edge_ids;
-  LWT_ISO_EDGE *edges;
-  LWT_ISO_EDGE *forward_edges = NULL;
-  int forward_edges_count = 0;
-  LWT_ISO_EDGE *backward_edges = NULL;
-  int backward_edges_count = 0;
+	uint64_t numfaceedges, i, j;
+	int newface_outside;
+	uint64_t num_signed_edge_ids;
+	LWT_ELEMID *signed_edge_ids;
+	LWT_ISO_EDGE *edges;
+	LWT_ISO_EDGE *forward_edges = NULL;
+	int forward_edges_count = 0;
+	LWT_ISO_EDGE *backward_edges = NULL;
+	int backward_edges_count = 0;
 
-  signed_edge_ids = lwt_be_getRingEdges(topo, sedge,
-                                        &num_signed_edge_ids, 0);
-  if ( ! signed_edge_ids ) {
-    lwerror("Backend error (no ring edges for edge %" LWTFMT_ELEMID "): %s",
-            sedge, lwt_be_lastErrorMessage(topo->be_iface));
-    return -2;
-  }
+	signed_edge_ids = lwt_be_getRingEdges(topo, sedge, &num_signed_edge_ids, 0);
+	if (!signed_edge_ids)
+	{
+		lwerror("Backend error (no ring edges for edge %" LWTFMT_ELEMID "): %s",
+			sedge,
+			lwt_be_lastErrorMessage(topo->be_iface));
+		return -2;
+	}
   LWDEBUGF(1, "getRingEdges returned %d edges", num_signed_edge_ids);
 
   /* You can't get to the other side of an edge forming a ring */
@@ -1956,7 +1956,7 @@
     /* Face created an hole in an outer face */
     uint64_t nfaces = 1;
     oldface = lwt_be_getFaceById(topo, &face, &nfaces, LWT_COL_FACE_ALL);
-    if ( nfaces == UINT64_MAX )
+    if (nfaces == UINT64_MAX)
     {
       lwfree( signed_edge_ids );
       lwpoly_free(shell); /* NOTE: owns shellbox */
@@ -2021,10 +2021,11 @@
                ;
   numfaceedges = 1;
   edges = lwt_be_getEdgeByFace( topo, &face, &numfaceedges, fields, newface.mbr );
-  if ( numfaceedges == UINT64_MAX ) {
-    lwfree( signed_edge_ids );
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -2;
+  if (numfaceedges == UINT64_MAX)
+  {
+	  lwfree(signed_edge_ids);
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -2;
   }
   LWDEBUGF(1, "lwt_be_getEdgeByFace returned %d edges", numfaceedges);
 
@@ -2183,10 +2184,11 @@
   fields = LWT_COL_NODE_NODE_ID | LWT_COL_NODE_GEOM;
   LWT_ISO_NODE *nodes = lwt_be_getNodeByFace(topo, &face,
                                              &numisonodes, fields, newface.mbr);
-  if ( numisonodes == UINT64_MAX ) {
-    lwfree( signed_edge_ids );
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -2;
+  if (numisonodes == UINT64_MAX)
+  {
+	  lwfree(signed_edge_ids);
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -2;
   }
   if ( numisonodes ) {
     LWT_ISO_NODE *updated_nodes = lwalloc(sizeof(LWT_ISO_NODE)*numisonodes);
@@ -2349,9 +2351,10 @@
   }
 
   endpoints = lwt_be_getNodeById( topo, node_ids, &num_nodes, LWT_COL_NODE_ALL );
-  if ( num_nodes == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (num_nodes == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   for ( i=0; i<num_nodes; ++i )
   {
@@ -2776,19 +2779,19 @@
 LWGEOM*
 lwt_GetFaceGeometry(LWT_TOPOLOGY* topo, LWT_ELEMID faceid)
 {
-  uint64_t numfaceedges;
-  LWT_ISO_EDGE *edges;
-  LWT_ISO_FACE *face;
-  LWPOLY *out;
-  LWGEOM *outg;
-  uint64_t i;
-  int fields;
+	uint64_t numfaceedges;
+	LWT_ISO_EDGE *edges;
+	LWT_ISO_FACE *face;
+	LWPOLY *out;
+	LWGEOM *outg;
+	uint64_t i;
+	int fields;
 
-  if ( faceid == 0 )
-  {
-    lwerror("SQL/MM Spatial exception - universal face has no geometry");
-    return NULL;
-  }
+	if (faceid == 0)
+	{
+		lwerror("SQL/MM Spatial exception - universal face has no geometry");
+		return NULL;
+	}
 
   /* Construct the face geometry */
   numfaceedges = 1;
@@ -2797,9 +2800,10 @@
            LWT_COL_EDGE_FACE_RIGHT
            ;
   edges = lwt_be_getEdgeByFace( topo, &faceid, &numfaceedges, fields, NULL );
-  if ( numfaceedges == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return NULL;
+  if (numfaceedges == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return NULL;
   }
 
   if ( numfaceedges == 0 )
@@ -2806,9 +2810,10 @@
   {
     i = 1;
     face = lwt_be_getFaceById(topo, &faceid, &i, LWT_COL_FACE_FACE_ID);
-    if ( i == UINT64_MAX ) {
-      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-      return NULL;
+    if (i == UINT64_MAX)
+    {
+	    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	    return NULL;
     }
     if ( i == 0 ) {
       lwerror("SQL/MM Spatial exception - non-existent face.");
@@ -3023,9 +3028,10 @@
            LWT_COL_EDGE_FACE_RIGHT
            ;
   edges = lwt_be_getEdgeByFace( topo, &face_id, &numfaceedges, fields, NULL );
-  if ( numfaceedges == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (numfaceedges == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   if ( ! numfaceedges ) return 0; /* no edges in output */
 
@@ -3188,7 +3194,7 @@
   {
     LWDEBUGF(1, "lwt_ChangeEdgeGeom: "
                 "lwt_be_getEdgeById returned NULL and set i=%d", i);
-    if ( i == UINT64_MAX )
+    if (i == UINT64_MAX)
     {
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
       return -1;
@@ -3305,10 +3311,11 @@
   nodes = lwt_be_getNodeWithinBox2D(topo, &mbox, &numnodes,
                                           LWT_COL_NODE_ALL, 0);
   LWDEBUGF(1, "lwt_be_getNodeWithinBox2D returned %d nodes", numnodes);
-  if ( numnodes == UINT64_MAX ) {
-    _lwt_release_edges(oldedge, 1);
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (numnodes == UINT64_MAX)
+  {
+	  _lwt_release_edges(oldedge, 1);
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   // 3. if any node beside endnodes are found:
   if ( numnodes > ( 1 + isclosed ? 0 : 1 ) )
@@ -3344,9 +3351,9 @@
 
   edgeend span_pre, epan_pre;
   /* initialize span_pre.myaz and epan_pre.myaz with existing edge */
-  int res = _lwt_InitEdgeEndByLine(&span_pre, &epan_pre,
-                             oldedge->geom, &p1, &p2);
-  if ( res ) return -1; /* lwerror should have been raised */
+  int res = _lwt_InitEdgeEndByLine(&span_pre, &epan_pre, oldedge->geom, &p1, &p2);
+  if (res)
+	  return -1; /* lwerror should have been raised */
   _lwt_FindAdjacentEdges( topo, oldedge->start_node, &span_pre,
                                   isclosed ? &epan_pre : NULL, edge_id );
   _lwt_FindAdjacentEdges( topo, oldedge->end_node, &epan_pre,
@@ -3362,13 +3369,13 @@
   newedge.edge_id = edge_id;
   newedge.geom = geom;
   res = lwt_be_updateEdgesById(topo, &newedge, 1, LWT_COL_EDGE_GEOM);
-  if ( res == -1 )
+  if (res == -1)
   {
     _lwt_release_edges(oldedge, 1);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
   }
-  if ( ! res )
+  if (!res)
   {
     _lwt_release_edges(oldedge, 1);
     lwerror("Unexpected error: %d edges updated when expecting 1", i);
@@ -3380,11 +3387,12 @@
    */
   edgeend span_post, epan_post;
   res = _lwt_InitEdgeEndByLine(&span_post, &epan_post, geom, &p1, &p2);
-  if ( res ) return -1; /* lwerror should have been raised */
+  if (res)
+	  return -1; /* lwerror should have been raised */
   /* initialize epan_post.myaz and epan_post.myaz */
-  res = _lwt_InitEdgeEndByLine(&span_post, &epan_post,
-                             geom, &p1, &p2);
-  if ( res ) return -1; /* lwerror should have been raised */
+  res = _lwt_InitEdgeEndByLine(&span_post, &epan_post, geom, &p1, &p2);
+  if (res)
+	  return -1; /* lwerror should have been raised */
   _lwt_FindAdjacentEdges( topo, oldedge->start_node, &span_post,
                           isclosed ? &epan_post : NULL, edge_id );
   _lwt_FindAdjacentEdges( topo, oldedge->end_node, &epan_post,
@@ -3485,18 +3493,20 @@
     LWDEBUGF(1, "%d faces to update", facestoupdate);
     if ( facestoupdate )
     {
-      res = lwt_be_updateFacesById( topo, &(faces[0]), facestoupdate );
-      if ( res != facestoupdate )
-      {
-        if ( nface1 ) lwgeom_free(nface1);
-        if ( nface2 ) lwgeom_free(nface2);
-        _lwt_release_edges(oldedge, 1);
-        if ( res == -1 )
-          lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-        else
-          lwerror("Unexpected error: %d faces found when expecting 1", i);
-        return -1;
-      }
+	    res = lwt_be_updateFacesById(topo, &(faces[0]), facestoupdate);
+	    if (res != facestoupdate)
+	    {
+		    if (nface1)
+			    lwgeom_free(nface1);
+		    if (nface2)
+			    lwgeom_free(nface2);
+		    _lwt_release_edges(oldedge, 1);
+		    if (res == -1)
+			    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		    else
+			    lwerror("Unexpected error: %d faces found when expecting 1", i);
+		    return -1;
+	    }
     }
     if ( nface1 ) lwgeom_free(nface1);
     if ( nface2 ) lwgeom_free(nface2);
@@ -3518,9 +3528,10 @@
   uint64_t n = 1;
 
   node = lwt_be_getNodeById( topo, &nid, &n, LWT_COL_NODE_CONTAINING_FACE );
-  if ( n == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return 0;
+  if (n == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return 0;
   }
   if ( n < 1 ) {
     lwerror("SQL/MM Spatial exception - non-existent node");
@@ -3673,7 +3684,7 @@
 
   deledge.edge_id = id;
   n = lwt_be_deleteEdges( topo, &deledge, LWT_COL_EDGE_EDGE_ID );
-  if ( n == UINT64_MAX )
+  if (n == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -3694,7 +3705,7 @@
   }
   n = lwt_be_updateNodesById(topo, upd_node, n,
                                LWT_COL_NODE_CONTAINING_FACE);
-  if ( n == UINT64_MAX )
+  if (n == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -3774,50 +3785,51 @@
 static LWT_ELEMID
 _lwt_RemEdge( LWT_TOPOLOGY* topo, LWT_ELEMID edge_id, int modFace )
 {
-  uint64_t i, nedges, nfaces, fields;
-  LWT_ISO_EDGE *edge = NULL;
-  LWT_ISO_EDGE *upd_edge = NULL;
-  LWT_ISO_EDGE upd_edge_left[2];
-  int nedge_left = 0;
-  LWT_ISO_EDGE upd_edge_right[2];
-  int nedge_right = 0;
-  LWT_ISO_NODE upd_node[2];
-  int nnode = 0;
-  LWT_ISO_FACE *faces = NULL;
-  LWT_ISO_FACE newface;
-  LWT_ELEMID node_ids[2];
-  LWT_ELEMID face_ids[2];
-  int fnode_edges = 0; /* number of edges on the first node (excluded
-                        * the one being removed ) */
-  int lnode_edges = 0; /* number of edges on the last node (excluded
-                        * the one being removed ) */
+	uint64_t i, nedges, nfaces, fields;
+	LWT_ISO_EDGE *edge = NULL;
+	LWT_ISO_EDGE *upd_edge = NULL;
+	LWT_ISO_EDGE upd_edge_left[2];
+	int nedge_left = 0;
+	LWT_ISO_EDGE upd_edge_right[2];
+	int nedge_right = 0;
+	LWT_ISO_NODE upd_node[2];
+	int nnode = 0;
+	LWT_ISO_FACE *faces = NULL;
+	LWT_ISO_FACE newface;
+	LWT_ELEMID node_ids[2];
+	LWT_ELEMID face_ids[2];
+	int fnode_edges = 0; /* number of edges on the first node (excluded
+			      * the one being removed ) */
+	int lnode_edges = 0; /* number of edges on the last node (excluded
+			      * the one being removed ) */
 
-  newface.face_id = 0;
+	newface.face_id = 0;
 
-  i = 1;
-  edge = lwt_be_getEdgeById(topo, &edge_id, &i, LWT_COL_EDGE_ALL);
-  if ( ! edge )
-  {
-    LWDEBUGF(1, "lwt_be_getEdgeById returned NULL and set i=%d", i);
-    if ( i == UINT64_MAX )
-    {
-      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-      return -1;
-    }
-    else if ( i == 0 )
-    {
-      lwerror("SQL/MM Spatial exception - non-existent edge %"
-              LWTFMT_ELEMID, edge_id);
-      return -1;
-    }
-    else
-    {
-      lwerror("Backend coding error: getEdgeById callback returned NULL "
-              "but numelements output parameter has value %d "
-              "(expected 0 or 1)", i);
-      return -1;
-    }
-  }
+	i = 1;
+	edge = lwt_be_getEdgeById(topo, &edge_id, &i, LWT_COL_EDGE_ALL);
+	if (!edge)
+	{
+		LWDEBUGF(1, "lwt_be_getEdgeById returned NULL and set i=%d", i);
+		if (i == UINT64_MAX)
+		{
+			lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+			return -1;
+		}
+		else if (i == 0)
+		{
+			lwerror("SQL/MM Spatial exception - non-existent edge %" LWTFMT_ELEMID, edge_id);
+			return -1;
+		}
+		else
+		{
+			lwerror(
+			    "Backend coding error: getEdgeById callback returned NULL "
+			    "but numelements output parameter has value %d "
+			    "(expected 0 or 1)",
+			    i);
+			return -1;
+		}
+	}
 
   if ( ! lwt_be_checkTopoGeomRemEdge(topo, edge_id,
                                      edge->face_left, edge->face_right) )
@@ -3840,9 +3852,10 @@
            LWT_COL_EDGE_END_NODE | LWT_COL_EDGE_NEXT_LEFT |
            LWT_COL_EDGE_NEXT_RIGHT;
   upd_edge = lwt_be_getEdgeByNode( topo, &(node_ids[0]), &nedges, fields );
-  if ( nedges == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (nedges == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   nedge_left = nedge_right = 0;
   for ( i=0; i<nedges; ++i )
@@ -3888,9 +3901,8 @@
   {
     LWDEBUGF(1, "updating %d 'next_left' edges", nedge_left);
     /* update edges in upd_edge_left set next_left */
-    int result = lwt_be_updateEdgesById(topo, &(upd_edge_left[0]), nedge_left,
-                               LWT_COL_EDGE_NEXT_LEFT);
-    if ( result == -1 )
+    int result = lwt_be_updateEdgesById(topo, &(upd_edge_left[0]), nedge_left, LWT_COL_EDGE_NEXT_LEFT);
+    if (result == -1)
     {
       _lwt_release_edges(edge, 1);
       lwfree(upd_edge);
@@ -3902,9 +3914,8 @@
   {
     LWDEBUGF(1, "updating %d 'next_right' edges", nedge_right);
     /* update edges in upd_edge_right set next_right */
-    int result = lwt_be_updateEdgesById(topo, &(upd_edge_right[0]), nedge_right,
-                               LWT_COL_EDGE_NEXT_RIGHT);
-    if ( result == -1 )
+    int result = lwt_be_updateEdgesById(topo, &(upd_edge_right[0]), nedge_right, LWT_COL_EDGE_NEXT_RIGHT);
+    if (result == -1)
     {
       _lwt_release_edges(edge, 1);
       lwfree(upd_edge);
@@ -3944,9 +3955,10 @@
       nfaces = 2;
       fields = LWT_COL_FACE_ALL;
       faces = lwt_be_getFaceById(topo, face_ids, &nfaces, fields);
-      if ( nfaces == UINT64_MAX ) {
-        lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-        return -1;
+      if (nfaces == UINT64_MAX)
+      {
+	      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	      return -1;
       }
       GBOX *box1=NULL;
       GBOX *box2=NULL;
@@ -4011,39 +4023,39 @@
       if ( modFace )
       {
         newface.face_id = floodface;
-        int result = lwt_be_updateFacesById( topo, &newface, 1 );
-        _lwt_release_faces(faces, 2);
-        if ( result == -1 )
-        {
-          _lwt_release_edges(edge, 1);
-          lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-          return -1;
-        }
-        if ( result != 1 )
-        {
-          _lwt_release_edges(edge, 1);
-          lwerror("Unexpected error: %d faces updated when expecting 1", i);
-          return -1;
-        }
+	int result = lwt_be_updateFacesById(topo, &newface, 1);
+	_lwt_release_faces(faces, 2);
+	if (result == -1)
+	{
+		_lwt_release_edges(edge, 1);
+		lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		return -1;
+	}
+	if (result != 1)
+	{
+		_lwt_release_edges(edge, 1);
+		lwerror("Unexpected error: %d faces updated when expecting 1", i);
+		return -1;
+	}
       }
       else
       {
         /* New face replaces the old two faces */
         newface.face_id = -1;
-        int result = lwt_be_insertFaces( topo, &newface, 1 );
-        _lwt_release_faces(faces, 2);
-        if ( result == -1 )
-        {
+	int result = lwt_be_insertFaces(topo, &newface, 1);
+	_lwt_release_faces(faces, 2);
+	if (result == -1)
+	{
+		_lwt_release_edges(edge, 1);
+		lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		return -1;
+	}
+	if (result != 1)
+	{
           _lwt_release_edges(edge, 1);
-          lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-          return -1;
+	  lwerror("Unexpected error: %d faces inserted when expecting 1", result);
+	  return -1;
         }
-        if ( i != 1 )
-        {
-          _lwt_release_edges(edge, 1);
-          lwerror("Unexpected error: %d faces inserted when expecting 1", i);
-          return -1;
-        }
         floodface = newface.face_id;
       }
     }
@@ -4096,10 +4108,11 @@
 
   /* Delete the edge */
   int result = lwt_be_deleteEdges(topo, edge, LWT_COL_EDGE_EDGE_ID);
-  if ( result == -1 ) {
-    _lwt_release_edges(edge, 1);
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (result == -1)
+  {
+	  _lwt_release_edges(edge, 1);
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
 
   /* If any of the edge nodes remained isolated, set
@@ -4119,13 +4132,13 @@
   }
   if ( nnode )
   {
-    int result = lwt_be_updateNodesById(topo, upd_node, nnode,
-                               LWT_COL_NODE_CONTAINING_FACE);
-    if ( result == -1 ) {
-      _lwt_release_edges(edge, 1);
-      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-      return -1;
-    }
+	  int result = lwt_be_updateNodesById(topo, upd_node, nnode, LWT_COL_NODE_CONTAINING_FACE);
+	  if (result == -1)
+	  {
+		  _lwt_release_edges(edge, 1);
+		  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		  return -1;
+	  }
   }
 
   if ( edge->face_left != edge->face_right )
@@ -4138,10 +4151,11 @@
     if ( edge->face_left != floodface )
       ids[nids++] = edge->face_left;
     int result = lwt_be_deleteFacesById(topo, ids, nids);
-    if ( result == -1 ) {
-      _lwt_release_edges(edge, 1);
-      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-      return -1;
+    if (result == -1)
+    {
+	    _lwt_release_edges(edge, 1);
+	    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	    return -1;
     }
   }
 
@@ -4272,10 +4286,11 @@
     num_node_edges = 1;
     node_edges = lwt_be_getEdgeByNode( topo, &commonnode,
                                        &num_node_edges, LWT_COL_EDGE_EDGE_ID );
-    if ( num_node_edges == UINT64_MAX ) {
-      _lwt_release_edges(edges, nedges);
-      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-      return -1;
+    if (num_node_edges == UINT64_MAX)
+    {
+	    _lwt_release_edges(edges, nedges);
+	    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	    return -1;
     }
     for (i=0; i<num_node_edges; ++i)
     {
@@ -4323,10 +4338,11 @@
       num_node_edges = 1;
       node_edges = lwt_be_getEdgeByNode( topo, &commonnode,
                                          &num_node_edges, LWT_COL_EDGE_EDGE_ID );
-      if ( num_node_edges == UINT64_MAX ) {
-        _lwt_release_edges(edges, nedges);
-        lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-        return -1;
+      if (num_node_edges == UINT64_MAX)
+      {
+	      _lwt_release_edges(edges, nedges);
+	      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	      return -1;
       }
       for (i=0; i<num_node_edges; ++i)
       {
@@ -4453,13 +4469,12 @@
   {
     /* Update data of the first edge */
     newedge.edge_id = eid1;
-    int result = lwt_be_updateEdgesById(topo, &newedge, 1,
-                               LWT_COL_EDGE_NEXT_LEFT|
-                               LWT_COL_EDGE_NEXT_RIGHT |
-                               LWT_COL_EDGE_START_NODE |
-                               LWT_COL_EDGE_END_NODE |
-                               LWT_COL_EDGE_GEOM);
-    if ( result == -1 )
+    int result = lwt_be_updateEdgesById(topo,
+					&newedge,
+					1,
+					LWT_COL_EDGE_NEXT_LEFT | LWT_COL_EDGE_NEXT_RIGHT | LWT_COL_EDGE_START_NODE |
+					    LWT_COL_EDGE_END_NODE | LWT_COL_EDGE_GEOM);
+    if (result == -1)
     {
       lwline_free(newedge.geom);
       _lwt_release_edges(edges, nedges);
@@ -4466,7 +4481,7 @@
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
       return -1;
     }
-    else if ( result != 1 )
+    else if (result != 1)
     {
       lwline_free(newedge.geom);
       if ( edges ) _lwt_release_edges(edges, nedges);
@@ -4481,17 +4496,20 @@
     newedge.face_left = e1->face_left;
     newedge.face_right = e1->face_right;
     int result = lwt_be_insertEdges(topo, &newedge, 1);
-    if ( result == -1 ) {
-      lwline_free(newedge.geom);
-      _lwt_release_edges(edges, nedges);
-      lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-      return -1;
-    } else if ( result == 0 ) {
-      lwline_free(newedge.geom);
-      _lwt_release_edges(edges, nedges);
-      lwerror("Insertion of split edge failed (no reason)");
-      return -1;
+    if (result == -1)
+    {
+	    lwline_free(newedge.geom);
+	    _lwt_release_edges(edges, nedges);
+	    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	    return -1;
     }
+    else if (result == 0)
+    {
+	    lwline_free(newedge.geom);
+	    _lwt_release_edges(edges, nedges);
+	    lwerror("Insertion of split edge failed (no reason)");
+	    return -1;
+    }
   }
   lwline_free(newedge.geom);
 
@@ -4512,10 +4530,8 @@
   /* update edges connected to e2's boundary from their end node */
   seledge.next_left = e2freenode * eid2;
   updedge.next_left = e2freenode * newedge.edge_id * e2sign;
-  int result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT,
-                               &updedge, LWT_COL_EDGE_NEXT_LEFT,
-                               NULL, 0);
-  if ( result == -1 )
+  int result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT, &updedge, LWT_COL_EDGE_NEXT_LEFT, NULL, 0);
+  if (result == -1)
   {
     _lwt_release_edges(edges, nedges);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4525,10 +4541,8 @@
   /* update edges connected to e2's boundary from their start node */
   seledge.next_right = e2freenode * eid2;
   updedge.next_right = e2freenode * newedge.edge_id * e2sign;
-  result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT,
-                               &updedge, LWT_COL_EDGE_NEXT_RIGHT,
-                               NULL, 0);
-  if ( result == -1 )
+  result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT, &updedge, LWT_COL_EDGE_NEXT_RIGHT, NULL, 0);
+  if (result == -1)
   {
     _lwt_release_edges(edges, nedges);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4540,10 +4554,8 @@
     /* update edges connected to e1's boundary from their end node */
     seledge.next_left = e1freenode * eid1;
     updedge.next_left = e1freenode * newedge.edge_id;
-    result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT,
-                                 &updedge, LWT_COL_EDGE_NEXT_LEFT,
-                                 NULL, 0);
-    if ( result == -1 )
+    result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT, &updedge, LWT_COL_EDGE_NEXT_LEFT, NULL, 0);
+    if (result == -1)
     {
       _lwt_release_edges(edges, nedges);
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4553,10 +4565,8 @@
     /* update edges connected to e1's boundary from their start node */
     seledge.next_right = e1freenode * eid1;
     updedge.next_right = e1freenode * newedge.edge_id;
-    result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT,
-                                 &updedge, LWT_COL_EDGE_NEXT_RIGHT,
-                                 NULL, 0);
-    if ( result == -1 )
+    result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT, &updedge, LWT_COL_EDGE_NEXT_RIGHT, NULL, 0);
+    if (result == -1)
     {
       _lwt_release_edges(edges, nedges);
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4566,7 +4576,7 @@
 
   /* delete the edges (only second on modEdge or both) */
   result = lwt_be_deleteEdges(topo, e2, LWT_COL_EDGE_EDGE_ID);
-  if ( result == -1 )
+  if (result == -1)
   {
     _lwt_release_edges(edges, nedges);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4574,7 +4584,7 @@
   }
   if ( ! modEdge ) {
     i = lwt_be_deleteEdges(topo, e1, LWT_COL_EDGE_EDGE_ID);
-    if ( result == -1 )
+    if (result == -1)
     {
       _lwt_release_edges(edges, nedges);
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4586,7 +4596,7 @@
 
   /* delete the common node */
   i = lwt_be_deleteNodesById( topo, &commonnode, 1 );
-  if ( result == -1 )
+  if (result == -1)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -4637,7 +4647,7 @@
     return -1;
   }
   elem = lwt_be_getNodeWithinDistance2D(topo, pt, tol, &num, flds, 0);
-  if ( num == UINT64_MAX )
+  if (num == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -4672,7 +4682,7 @@
     return -1;
   }
   elem = lwt_be_getEdgeWithinDistance2D(topo, pt, tol, &num, flds, 0);
-  if ( num == UINT64_MAX )
+  if (num == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -4745,7 +4755,7 @@
   /* NOTE: we never pass a tolerance of 0 to avoid ever using
    * ST_Within, which doesn't include endpoints matches */
   elem = lwt_be_getEdgeWithinDistance2D(topo, pt, tol?tol:1e-5, &num, flds, 0);
-  if ( num == UINT64_MAX )
+  if (num == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -4885,32 +4895,33 @@
 _lwt_AddPoint(LWT_TOPOLOGY* topo, LWPOINT* point, double tol, int
               findFace, int *moved)
 {
-  uint64_t num, i;
-  double mindist = FLT_MAX;
-  LWT_ISO_NODE *nodes, *nodes2;
-  LWT_ISO_EDGE *edges, *edges2;
-  LWGEOM *pt = lwpoint_as_lwgeom(point);
-  int flds;
-  LWT_ELEMID id = 0;
-  scored_pointer *sorted;
+	uint64_t num, i;
+	double mindist = FLT_MAX;
+	LWT_ISO_NODE *nodes, *nodes2;
+	LWT_ISO_EDGE *edges, *edges2;
+	LWGEOM *pt = lwpoint_as_lwgeom(point);
+	int flds;
+	LWT_ELEMID id = 0;
+	scored_pointer *sorted;
 
-  /* Get tolerance, if 0 was given */
-  if ( ! tol ) tol = _LWT_MINTOLERANCE( topo, pt );
+	/* Get tolerance, if 0 was given */
+	if (!tol)
+		tol = _LWT_MINTOLERANCE(topo, pt);
 
-  LWDEBUGG(1, pt, "Adding point");
+	LWDEBUGG(1, pt, "Adding point");
 
-  /*
-  -- 1. Check if any existing node is closer than the given precision
-  --    and if so pick the closest
-  TODO: use WithinBox2D
-  */
-  flds = LWT_COL_NODE_NODE_ID|LWT_COL_NODE_GEOM;
-  nodes = lwt_be_getNodeWithinDistance2D(topo, point, tol, &num, flds, 0);
-  if ( num == UINT64_MAX )
-  {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
-  }
+	/*
+	-- 1. Check if any existing node is closer than the given precision
+	--    and if so pick the closest
+	TODO: use WithinBox2D
+	*/
+	flds = LWT_COL_NODE_NODE_ID | LWT_COL_NODE_GEOM;
+	nodes = lwt_be_getNodeWithinDistance2D(topo, point, tol, &num, flds, 0);
+	if (num == UINT64_MAX)
+	{
+		lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+		return -1;
+	}
   if ( num )
   {
     LWDEBUGF(1, "New point is within %.15g units of %d nodes", tol, num);
@@ -4968,7 +4979,7 @@
   */
   flds = LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM;
   edges = lwt_be_getEdgeWithinDistance2D(topo, point, tol, &num, flds, 0);
-  if ( num == UINT64_MAX )
+  if (num == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -5215,7 +5226,7 @@
   const int flds = LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM;
 
   edges = lwt_be_getEdgeWithinBox2D( topo, qbox, &num, flds, 0 );
-  if ( num == UINT64_MAX )
+  if (num == UINT64_MAX)
   {
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
     return -1;
@@ -5333,7 +5344,7 @@
     nn = nid[0] == nid[1] ? 1 : 2;
     node = lwt_be_getNodeById( topo, nid, &nn,
                                LWT_COL_NODE_NODE_ID|LWT_COL_NODE_GEOM );
-    if ( nn == UINT64_MAX )
+    if (nn == UINT64_MAX)
     {
       lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
       return -1;
@@ -5496,7 +5507,7 @@
   LWT_ELEMID *ids;
   LWT_ISO_EDGE *edges;
   LWT_ISO_NODE *nodes;
-  uint64_t num, numedges=0, numnodes=0;
+  uint64_t num, numedges = 0, numnodes = 0;
   uint64_t i;
   GBOX qbox;
 
@@ -5534,7 +5545,7 @@
 
   /* 2. Node to edges falling within tol distance */
   edges = lwt_be_getEdgeWithinBox2D( topo, &qbox, &numedges, LWT_COL_EDGE_ALL, 0 );
-  if ( numedges == UINT64_MAX )
+  if (numedges == UINT64_MAX)
   {
     lwgeom_free(noded);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -5610,7 +5621,7 @@
   /* 2.1. Node with existing nodes within tol
    * TODO: check if we should be only considering _isolated_ nodes! */
   nodes = lwt_be_getNodeWithinBox2D( topo, &qbox, &numnodes, LWT_COL_NODE_ALL, 0 );
-  if ( numnodes == UINT64_MAX )
+  if (numnodes == UINT64_MAX)
   {
     lwgeom_free(noded);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -5821,7 +5832,7 @@
   gbox_expand(&qbox, tol);
   faces = lwt_be_getFaceWithinBox2D( topo, &qbox, &nfacesinbox,
                                      LWT_COL_FACE_ALL, 0 );
-  if ( nfacesinbox == UINT64_MAX )
+  if (nfacesinbox == UINT64_MAX)
   {
     lwfree(ids);
     lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -6117,9 +6128,10 @@
 
   edge = lwt_be_getEdgeWithinBox2D( topo, NULL, &nelems, fields, 0);
   *numedges = nelems;
-  if ( nelems == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return NULL;
+  if (nelems == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return NULL;
   }
   return edge;
 }
@@ -6661,9 +6673,10 @@
   qbox.xmin = qbox.ymin = -DBL_MAX;
   qbox.xmax = qbox.ymax = DBL_MAX;
   faces = lwt_be_getFaceWithinBox2D( topo, &qbox, &nelems, fields, 1);
-  if ( nelems == UINT64_MAX ) {
-    lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
-    return -1;
+  if (nelems == UINT64_MAX)
+  {
+	  lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
+	  return -1;
   }
   if ( faces ) _lwt_release_faces(faces, nelems);
   return nelems;

Modified: trunk/raster/rt_pg/rtpg_gdal.c
===================================================================
--- trunk/raster/rt_pg/rtpg_gdal.c	2019-04-24 10:03:07 UTC (rev 17408)
+++ trunk/raster/rt_pg/rtpg_gdal.c	2019-04-24 10:04:42 UTC (rev 17409)
@@ -417,8 +417,8 @@
 		POSTGIS_RT_DEBUGF(4, "Result %d, Index %d", call_cntr, drv_set2[call_cntr].idx);
 		POSTGIS_RT_DEBUGF(4, "Result %d, Short Name %s", call_cntr, drv_set2[call_cntr].short_name);
 		POSTGIS_RT_DEBUGF(4, "Result %d, Full Name %s", call_cntr, drv_set2[call_cntr].long_name);
-		POSTGIS_RT_DEBUGF(4, "Result %d, Can Read %s", call_cntr, drv_set2[call_cntr].can_read);
-		POSTGIS_RT_DEBUGF(4, "Result %d, Can Write %s", call_cntr, drv_set2[call_cntr].can_write);
+		POSTGIS_RT_DEBUGF(4, "Result %d, Can Read %u", call_cntr, drv_set2[call_cntr].can_read);
+		POSTGIS_RT_DEBUGF(4, "Result %d, Can Write %u", call_cntr, drv_set2[call_cntr].can_write);
 		POSTGIS_RT_DEBUGF(5, "Result %d, Create Options %s", call_cntr, drv_set2[call_cntr].create_options);
 
 		/* build a tuple */

Modified: trunk/raster/rt_pg/rtpg_geometry.c
===================================================================
--- trunk/raster/rt_pg/rtpg_geometry.c	2019-04-24 10:03:07 UTC (rev 17408)
+++ trunk/raster/rt_pg/rtpg_geometry.c	2019-04-24 10:04:42 UTC (rev 17409)
@@ -926,8 +926,8 @@
 		}
 	}
 #if POSTGIS_DEBUG_LEVEL > 0
-	for (i = 0; i < pixtypes_len; i++)
-		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: pixtypes[%d] = %d", i, (int) pixtypes[i]);
+	for (uint32_t u = 0; u < pixtypes_len; u++)
+		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: pixtypes[%u] = %u", i, pixtypes[i]);
 #endif
 
 	/* value */
@@ -989,8 +989,8 @@
 		}
 	}
 #if POSTGIS_DEBUG_LEVEL > 0
-	for (i = 0; i < values_len; i++)
-		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: values[%d] = %f", i, values[i]);
+	for (uint32_t u = 0; u < values_len; u++)
+		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: values[%u] = %f", i, values[i]);
 #endif
 
 	/* nodataval */
@@ -1061,9 +1061,10 @@
 		}
 	}
 #if POSTGIS_DEBUG_LEVEL > 0
-	for (i = 0; i < nodatavals_len; i++) {
-		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: hasnodatas[%d] = %d", i, hasnodatas[i]);
-		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: nodatavals[%d] = %f", i, nodatavals[i]);
+	for (uint32_t u = 0; u < nodatavals_len; u++)
+	{
+		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: hasnodatas[%u] = %d", u, hasnodatas[u]);
+		POSTGIS_RT_DEBUGF(3, "RASTER_asRaster: nodatavals[%u] = %f", u, nodatavals[u]);
 	}
 #endif
 

Modified: trunk/topology/postgis_topology.c
===================================================================
--- trunk/topology/postgis_topology.c	2019-04-24 10:03:07 UTC (rev 17408)
+++ trunk/topology/postgis_topology.c	2019-04-24 10:04:42 UTC (rev 17409)
@@ -917,9 +917,8 @@
 
 /* ----------------- Callbacks start here ------------------------ */
 
-static LWT_ISO_EDGE*
-cb_getEdgeById(const LWT_BE_TOPOLOGY* topo,
-               const LWT_ELEMID* ids, uint64_t* numelems, int fields)
+static LWT_ISO_EDGE *
+cb_getEdgeById(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   LWT_ISO_EDGE *edges;
   int spi_result;
@@ -952,7 +951,7 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getEdgeById: edge query returned %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_getEdgeById: edge query returned " UINT64_FORMAT " rows", SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -971,9 +970,8 @@
   return edges;
 }
 
-static LWT_ISO_EDGE*
-cb_getEdgeByNode(const LWT_BE_TOPOLOGY* topo,
-                 const LWT_ELEMID* ids, uint64_t* numelems, int fields)
+static LWT_ISO_EDGE *
+cb_getEdgeByNode(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   LWT_ISO_EDGE *edges;
   int spi_result;
@@ -1015,7 +1013,7 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getEdgeByNode: edge query returned %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_getEdgeByNode: edge query returned " UINT64_FORMAT " rows", SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -1034,10 +1032,8 @@
   return edges;
 }
 
-static LWT_ISO_EDGE*
-cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo,
-                 const LWT_ELEMID* ids, uint64_t* numelems, int fields,
-                 const GBOX *box)
+static LWT_ISO_EDGE *
+cb_getEdgeByFace(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields, const GBOX *box)
 {
   LWT_ISO_EDGE *edges;
   int spi_result;
@@ -1096,7 +1092,7 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getEdgeByFace: edge query returned %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_getEdgeByFace: edge query returned " UINT64_FORMAT " rows", SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -1115,9 +1111,8 @@
   return edges;
 }
 
-static LWT_ISO_FACE*
-cb_getFacesById(const LWT_BE_TOPOLOGY* topo,
-                const LWT_ELEMID* ids, uint64_t* numelems, int fields)
+static LWT_ISO_FACE *
+cb_getFacesById(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   LWT_ISO_FACE *faces;
   int spi_result;
@@ -1152,7 +1147,7 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getFaceById: face query returned %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_getFaceById: face query returned " UINT64_FORMAT " rows", SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -1171,9 +1166,8 @@
   return faces;
 }
 
-static LWT_ELEMID*
-cb_getRingEdges(const LWT_BE_TOPOLOGY* topo,
-                LWT_ELEMID edge, uint64_t* numelems, uint64_t limit)
+static LWT_ELEMID *
+cb_getRingEdges(const LWT_BE_TOPOLOGY *topo, LWT_ELEMID edge, uint64_t *numelems, int limit)
 {
   LWT_ELEMID *edges;
   int spi_result;
@@ -1199,10 +1193,10 @@
   if ( limit )
   {
     ++limit; /* so we know if we hit it */
-    appendStringInfo(sql, " LIMIT " UINT64_FORMAT, limit);
+    appendStringInfo(sql, " LIMIT %d", limit);
   }
 
-  POSTGIS_DEBUGF(1, "cb_getRingEdges query (limit " UINT64_FORMAT "): %s", limit, sql->data);
+  POSTGIS_DEBUGF(1, "cb_getRingEdges query (limit %d): %s", limit, sql->data);
   spi_result = SPI_execute(sql->data, !topo->be_data->data_changed, limit);
   MemoryContextSwitchTo( oldcontext ); /* switch back */
   if ( spi_result != SPI_OK_SELECT )
@@ -1220,11 +1214,11 @@
   {
     return NULL;
   }
-  if ( limit && *numelems == limit )
+  if (limit && *numelems == (uint64_t)limit)
   {
-    cberror(topo->be_data, "Max traversing limit hit: "UINT64_FORMAT, limit-1);
-    *numelems = UINT64_MAX;
-    return NULL;
+	  cberror(topo->be_data, "Max traversing limit hit: %d", limit - 1);
+	  *numelems = UINT64_MAX;
+	  return NULL;
   }
 
   edges = palloc( sizeof(LWT_ELEMID) * *numelems );
@@ -1245,8 +1239,7 @@
     }
     val = DatumGetInt32(dat);
     edges[i] = val;
-    POSTGIS_DEBUGF(1, "Component %d in ring of edge %" LWTFMT_ELEMID
-                   " is edge %d", i, edge, val);
+    POSTGIS_DEBUGF(1, "Component " UINT64_FORMAT " in ring of edge %" LWTFMT_ELEMID " is edge %d", i, edge, val);
   }
 
   SPI_freetuptable(SPI_tuptable);
@@ -1254,9 +1247,8 @@
   return edges;
 }
 
-static LWT_ISO_NODE*
-cb_getNodeById(const LWT_BE_TOPOLOGY* topo,
-               const LWT_ELEMID* ids, uint64_t* numelems, int fields)
+static LWT_ISO_NODE *
+cb_getNodeById(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
 {
   LWT_ISO_NODE *nodes;
   int spi_result;
@@ -1289,7 +1281,7 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getNodeById: edge query returned %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_getNodeById: edge query returned " UINT64_FORMAT " rows", SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -1308,10 +1300,8 @@
   return nodes;
 }
 
-static LWT_ISO_NODE*
-cb_getNodeByFace(const LWT_BE_TOPOLOGY* topo,
-                 const LWT_ELEMID* ids, uint64_t* numelems, int fields,
-                 const GBOX *box)
+static LWT_ISO_NODE *
+cb_getNodeByFace(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields, const GBOX *box)
 {
   LWT_ISO_NODE *nodes;
   int spi_result;
@@ -1351,7 +1341,7 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getNodeByFace: edge query returned %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_getNodeByFace: edge query returned " UINT64_FORMAT " rows", SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -1370,10 +1360,13 @@
   return nodes;
 }
 
-static LWT_ISO_EDGE*
-cb_getEdgeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
-                           const LWPOINT* pt, double dist, uint64_t* numelems,
-                           int fields, int limit)
+static LWT_ISO_EDGE *
+cb_getEdgeWithinDistance2D(const LWT_BE_TOPOLOGY *topo,
+			   const LWPOINT *pt,
+			   double dist,
+			   uint64_t *numelems,
+			   int fields,
+			   int limit)
 {
   LWT_ISO_EDGE *edges;
   int spi_result;
@@ -1427,9 +1420,11 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getEdgeWithinDistance2D: edge query "
-                 "(limited by %d) returned %d rows",
-                 elems_requested, SPI_processed);
+  POSTGIS_DEBUGF(1,
+		 "cb_getEdgeWithinDistance2D: edge query "
+		 "(limited by %d) returned " UINT64_FORMAT " rows",
+		 elems_requested,
+		 SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -1445,7 +1440,7 @@
       dat = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull);
       exists = DatumGetBool(dat);
       *numelems = exists ? 1 : 0;
-      POSTGIS_DEBUGF(1, "cb_getEdgeWithinDistance2D: exists ? %d", *numelems);
+      POSTGIS_DEBUGF(1, "cb_getEdgeWithinDistance2D: exists ? " UINT64_FORMAT, *numelems);
     }
 
     SPI_freetuptable(SPI_tuptable);
@@ -1465,10 +1460,13 @@
   return edges;
 }
 
-static LWT_ISO_NODE*
-cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
-                           const LWPOINT* pt, double dist, uint64_t* numelems,
-                           int fields, int limit)
+static LWT_ISO_NODE *
+cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY *topo,
+			   const LWPOINT *pt,
+			   double dist,
+			   uint64_t *numelems,
+			   int fields,
+			   int limit)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   LWT_ISO_NODE *nodes;
@@ -1530,9 +1528,11 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getNodeWithinDistance2D: node query "
-                 "(limited by %d) returned %d rows",
-                 elems_requested, SPI_processed);
+  POSTGIS_DEBUGF(1,
+		 "cb_getNodeWithinDistance2D: node query "
+		 "(limited by %d) returned " UINT64_FORMAT " rows",
+		 elems_requested,
+		 SPI_processed);
   if ( ! SPI_processed )
   {
     *numelems = 0;
@@ -1571,8 +1571,7 @@
 }
 
 static int
-cb_insertNodes( const LWT_BE_TOPOLOGY* topo,
-                LWT_ISO_NODE* nodes, uint64_t numelems )
+cb_insertNodes(const LWT_BE_TOPOLOGY *topo, LWT_ISO_NODE *nodes, uint64_t numelems)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -1607,12 +1606,13 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  // TODO: Remove cast when numelems uses uint64 instead of int
-  if ( SPI_processed != (uint64) numelems )
+  if (SPI_processed != numelems)
   {
-    cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
-            SPI_processed, numelems);
-    return 0;
+	  cberror(topo->be_data,
+		  "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
+		  (uint64_t)SPI_processed,
+		  numelems);
+	  return 0;
   }
 
   /* Set node_id (could skip this if none had it set to -1) */
@@ -1630,8 +1630,7 @@
 }
 
 static int
-cb_insertEdges( const LWT_BE_TOPOLOGY* topo,
-                LWT_ISO_EDGE* edges, uint64_t numelems )
+cb_insertEdges(const LWT_BE_TOPOLOGY *topo, LWT_ISO_EDGE *edges, uint64_t numelems)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -1654,7 +1653,7 @@
   }
   if ( needsEdgeIdReturn ) appendStringInfoString(sql, " RETURNING edge_id");
 
-  POSTGIS_DEBUGF(1, "cb_insertEdges query (%d elems): %s", numelems, sql->data);
+  POSTGIS_DEBUGF(1, "cb_insertEdges query (" UINT64_FORMAT " elems): %s", numelems, sql->data);
   spi_result = SPI_execute(sql->data, false, numelems);
   MemoryContextSwitchTo( oldcontext ); /* switch back */
   if ( spi_result != ( needsEdgeIdReturn ? SPI_OK_INSERT_RETURNING : SPI_OK_INSERT ) )
@@ -1666,18 +1665,20 @@
   }
   pfree(sqldata.data);
   if ( SPI_processed ) topo->be_data->data_changed = true;
-  POSTGIS_DEBUGF(1, "cb_insertEdges query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_insertEdges query processed " UINT64_FORMAT " rows", SPI_processed);
   if ( SPI_processed != (uint64) numelems )
   {
-    cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
-            SPI_processed, numelems);
-    return -1;
+	  cberror(topo->be_data,
+		  "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
+		  (uint64_t)SPI_processed,
+		  numelems);
+	  return -1;
   }
 
   if ( needsEdgeIdReturn )
   {
     /* Set node_id for items that need it */
-    for ( i=0; i< SPI_processed; ++i )
+    for (i = 0; i < SPI_processed; ++i)
     {
       if ( edges[i].edge_id != -1 ) continue;
       fillEdgeFields(&edges[i], SPI_tuptable->vals[i],
@@ -1691,8 +1692,7 @@
 }
 
 static int
-cb_insertFaces( const LWT_BE_TOPOLOGY* topo,
-                LWT_ISO_FACE* faces, uint64_t numelems )
+cb_insertFaces(const LWT_BE_TOPOLOGY *topo, LWT_ISO_FACE *faces, uint64_t numelems)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -1714,7 +1714,7 @@
   }
   if ( needsFaceIdReturn ) appendStringInfoString(sql, " RETURNING face_id");
 
-  POSTGIS_DEBUGF(1, "cb_insertFaces query (" UINT64_MAX " elems): %s", numelems, sql->data);
+  POSTGIS_DEBUGF(1, "cb_insertFaces query (" UINT64_FORMAT " elems): %s", numelems, sql->data);
   spi_result = SPI_execute(sql->data, false, numelems);
   MemoryContextSwitchTo( oldcontext ); /* switch back */
   if ( spi_result != ( needsFaceIdReturn ? SPI_OK_INSERT_RETURNING : SPI_OK_INSERT ) )
@@ -1726,12 +1726,14 @@
   }
   pfree(sqldata.data);
   if ( SPI_processed ) topo->be_data->data_changed = true;
-  POSTGIS_DEBUGF(1, "cb_insertFaces query processed %d rows", SPI_processed);
-  if ( SPI_processed != numelems )
+  POSTGIS_DEBUGF(1, "cb_insertFaces query processed " UINT64_FORMAT " rows", SPI_processed);
+  if (SPI_processed != numelems)
   {
-    cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
-            SPI_processed, numelems);
-    return -1;
+	  cberror(topo->be_data,
+		  "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
+		  (uint64_t)SPI_processed,
+		  numelems);
+	  return -1;
   }
 
   if ( needsFaceIdReturn )
@@ -1790,7 +1792,7 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_updateEdges: update query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_updateEdges: update query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
@@ -1835,14 +1837,13 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_updateNodes: update query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_updateNodes: update query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
 
 static int
-cb_updateNodesById( const LWT_BE_TOPOLOGY* topo,
-                    const LWT_ISO_NODE* nodes, uint64_t numnodes, int fields )
+cb_updateNodesById(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_NODE *nodes, uint64_t numnodes, int fields)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   uint64_t i;
@@ -1859,9 +1860,12 @@
     return -1;
   }
 
-  POSTGIS_DEBUGF(1, "cb_updateNodesById got %d nodes to update"
-                 " (fields:%d)",
-                 numnodes, fields);
+  POSTGIS_DEBUGF(1,
+		 "cb_updateNodesById got " UINT64_FORMAT
+		 " nodes to update"
+		 " (fields:%d)",
+		 numnodes,
+		 fields);
 
   initStringInfo(sql);
   appendStringInfoString(sql, "WITH newnodes(node_id,");
@@ -1908,7 +1912,7 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_updateNodesById: update query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_updateNodesById: update query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
@@ -1956,14 +1960,13 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_updateFacesById: update query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_updateFacesById: update query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
 
 static int
-cb_updateEdgesById( const LWT_BE_TOPOLOGY* topo,
-                    const LWT_ISO_EDGE* edges, uint64_t numedges, int fields )
+cb_updateEdgesById(const LWT_BE_TOPOLOGY *topo, const LWT_ISO_EDGE *edges, uint64_t numedges, int fields)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   uint64_t i;
@@ -2049,7 +2052,7 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_updateEdgesById: update query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_updateEdgesById: update query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
@@ -2082,7 +2085,7 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_deleteEdges: delete query processed %d rows", SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_deleteEdges: delete query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
@@ -2116,9 +2119,8 @@
 
   if ( SPI_processed != 1 )
   {
-    cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected 1",
-            (uint64)SPI_processed);
-    return -1;
+	  cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected 1", (uint64_t)SPI_processed);
+	  return -1;
   }
 
   dat = SPI_getbinval( SPI_tuptable->vals[0],
@@ -2178,8 +2180,8 @@
 
   if ( spi_result == SPI_OK_DELETE_RETURNING && SPI_processed )
   {
-    POSTGIS_DEBUGF(1, "cb_updateTopoGeomEdgeSplit: deleted %d faces", SPI_processed);
-    topo->be_data->data_changed = true;
+	  POSTGIS_DEBUGF(1, "cb_updateTopoGeomEdgeSplit: deleted " UINT64_FORMAT " faces", SPI_processed);
+	  topo->be_data->data_changed = true;
   }
 
   ntopogeoms = SPI_processed;
@@ -2816,8 +2818,7 @@
 }
 
 static int
-cb_deleteFacesById( const LWT_BE_TOPOLOGY* topo,
-                    const LWT_ELEMID* ids, uint64_t numelems )
+cb_deleteFacesById(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -2826,7 +2827,7 @@
 
   initStringInfo(sql);
   appendStringInfo(sql, "DELETE FROM \"%s\".face WHERE face_id IN (", topo->name);
-  for (uint64_t i=0; i<numelems; ++i)
+  for (uint64_t i = 0; i < numelems; ++i)
   {
     appendStringInfo(sql, "%s%" LWTFMT_ELEMID, (i?",":""), ids[i]);
   }
@@ -2847,15 +2848,13 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_deleteFacesById: delete query processed %d rows",
-                 SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_deleteFacesById: delete query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
 
 static int
-cb_deleteNodesById( const LWT_BE_TOPOLOGY* topo,
-                    const LWT_ELEMID* ids, uint64_t numelems )
+cb_deleteNodesById(const LWT_BE_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t numelems)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -2865,7 +2864,7 @@
   initStringInfo(sql);
   appendStringInfo(sql, "DELETE FROM \"%s\".node WHERE node_id IN (",
                    topo->name);
-  for (uint64_t i=0; i<numelems; ++i)
+  for (uint64_t i = 0; i < numelems; ++i)
   {
     appendStringInfo(sql, "%s%" LWTFMT_ELEMID, (i?",":""), ids[i]);
   }
@@ -2886,15 +2885,13 @@
 
   if ( SPI_processed ) topo->be_data->data_changed = true;
 
-  POSTGIS_DEBUGF(1, "cb_deleteNodesById: delete query processed %d rows",
-                 SPI_processed);
+  POSTGIS_DEBUGF(1, "cb_deleteNodesById: delete query processed " UINT64_FORMAT " rows", SPI_processed);
 
   return SPI_processed;
 }
 
-static LWT_ISO_NODE*
-cb_getNodeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
-                        uint64_t* numelems, int fields, int limit )
+static LWT_ISO_NODE *
+cb_getNodeWithinBox2D(const LWT_BE_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, int limit)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -2940,9 +2937,11 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getNodeWithinBox2D: edge query "
-                 "(limited by %d) returned %d rows",
-                 elems_requested, SPI_processed);
+  POSTGIS_DEBUGF(1,
+		 "cb_getNodeWithinBox2D: edge query "
+		 "(limited by %d) returned " UINT64_FORMAT " rows",
+		 elems_requested,
+		 SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -2959,7 +2958,7 @@
       exists = DatumGetBool(dat);
       SPI_freetuptable(SPI_tuptable);
       *numelems = exists ? 1 : 0;
-      POSTGIS_DEBUGF(1, "cb_getNodeWithinBox2D: exists ? %d", *numelems);
+      POSTGIS_DEBUGF(1, "cb_getNodeWithinBox2D: exists ? " UINT64_FORMAT, *numelems);
     }
     return NULL;
   }
@@ -2976,9 +2975,8 @@
   return nodes;
 }
 
-static LWT_ISO_EDGE*
-cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
-                        uint64_t* numelems, int fields, int limit )
+static LWT_ISO_EDGE *
+cb_getEdgeWithinBox2D(const LWT_BE_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, int limit)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -3029,9 +3027,11 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getEdgeWithinBox2D: edge query "
-                 "(limited by %d) returned %d rows",
-                 elems_requested, SPI_processed);
+  POSTGIS_DEBUGF(1,
+		 "cb_getEdgeWithinBox2D: edge query "
+		 "(limited by %d) returned " UINT64_FORMAT " rows",
+		 elems_requested,
+		 SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -3048,7 +3048,7 @@
       exists = DatumGetBool(dat);
       *numelems = exists ? 1 : 0;
       SPI_freetuptable(SPI_tuptable);
-      POSTGIS_DEBUGF(1, "cb_getEdgeWithinBox2D: exists ? %d", *numelems);
+      POSTGIS_DEBUGF(1, "cb_getEdgeWithinBox2D: exists ? " UINT64_FORMAT, *numelems);
     }
     return NULL;
   }
@@ -3065,9 +3065,8 @@
   return edges;
 }
 
-static LWT_ISO_FACE*
-cb_getFaceWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
-                        uint64_t* numelems, int fields, uint64_t limit )
+static LWT_ISO_FACE *
+cb_getFaceWithinBox2D(const LWT_BE_TOPOLOGY *topo, const GBOX *box, uint64_t *numelems, int fields, int limit)
 {
   MemoryContext oldcontext = CurrentMemoryContext;
   int spi_result;
@@ -3113,9 +3112,11 @@
   }
   pfree(sqldata.data);
 
-  POSTGIS_DEBUGF(1, "cb_getFaceWithinBox2D: face query "
-                 "(limited by %d) returned %d rows",
-                 elems_requested, SPI_processed);
+  POSTGIS_DEBUGF(1,
+		 "cb_getFaceWithinBox2D: face query "
+		 "(limited by %d) returned " UINT64_FORMAT " rows",
+		 elems_requested,
+		 SPI_processed);
   *numelems = SPI_processed;
   if ( ! SPI_processed )
   {
@@ -3131,7 +3132,7 @@
       dat = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull);
       exists = DatumGetBool(dat);
       *numelems = exists ? 1 : 0;
-      POSTGIS_DEBUGF(1, "cb_getFaceWithinBox2D: exists ? %d", *numelems);
+      POSTGIS_DEBUGF(1, "cb_getFaceWithinBox2D: exists ? " UINT64_FORMAT, *numelems);
     }
 
     SPI_freetuptable(SPI_tuptable);



More information about the postgis-tickets mailing list