[postgis-tickets] r17408 - Use uint64 to handle row counts in the topology extension
Raul
raul at rmr.ninja
Wed Apr 24 03:03:07 PDT 2019
Author: algunenano
Date: 2019-04-24 03:03:07 -0700 (Wed, 24 Apr 2019)
New Revision: 17408
Modified:
trunk/NEWS
trunk/liblwgeom/liblwgeom_topo.h
trunk/liblwgeom/liblwgeom_topo_internal.h
trunk/liblwgeom/lwgeom_topo.c
trunk/topology/postgis_topology.c
Log:
Use uint64 to handle row counts in the topology extension
References #4141
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2019-04-22 12:09:06 UTC (rev 17407)
+++ trunk/NEWS 2019-04-24 10:03:07 UTC (rev 17408)
@@ -94,7 +94,9 @@
- #4378, Allow passing TINs as input to GEOS-backed functions (Darafei
Praliaskouski)
- #4368, Reorder LWGEOM struct members to minimize extra padding (Raúl Marín)
+ - #4141, Use uint64 to handle row counts in the topology extension (Raúl Marín)
+
PostGIS 2.5.0
2018/09/23
WARNING: If compiling with PostgreSQL+JIT, LLVM >= 6 is required
Modified: trunk/liblwgeom/liblwgeom_topo.h
===================================================================
--- trunk/liblwgeom/liblwgeom_topo.h 2019-04-22 12:09:06 UTC (rev 17407)
+++ trunk/liblwgeom/liblwgeom_topo.h 2019-04-24 10:03:07 UTC (rev 17408)
@@ -188,7 +188,6 @@
* @param ids an array of element identifiers
* @param numelems input/output parameter, pass number of node identifiers
* in the input array, gets number of node in output array.
- * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_NODE_* macros
*
@@ -201,7 +200,7 @@
*/
LWT_ISO_NODE* (*getNodeById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields
);
/**
@@ -213,7 +212,6 @@
* @param numelems output parameter, gets number of elements found
* if the return is not null, otherwise see @return
* section for semantic.
- * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_NODE_* macros
* @param limit max number of nodes to return, 0 for no limit, -1
@@ -227,7 +225,7 @@
*/
LWT_ISO_NODE* (*getNodeWithinDistance2D) (
const LWT_BE_TOPOLOGY* topo,
- const LWPOINT* pt, double dist, int* numelems,
+ const LWPOINT* pt, double dist, uint64_t* numelems,
int fields, int limit
);
@@ -241,7 +239,6 @@
* @param nodes the nodes to insert. Those with a node_id set to -1
* it will be replaced to an automatically assigned identifier
* @param nelems number of elements in the nodes array
- * TODO: Should be uint64 to match SPI_processed
*
* @return 1 on success, 0 on error (@see lastErrorMessage)
*/
@@ -248,7 +245,7 @@
int (*insertNodes) (
const LWT_BE_TOPOLOGY* topo,
LWT_ISO_NODE* nodes,
- int numelems
+ uint64_t numelems
);
/**
@@ -269,7 +266,7 @@
*/
LWT_ISO_EDGE* (*getEdgeById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields
);
/**
@@ -294,7 +291,7 @@
*/
LWT_ISO_EDGE* (*getEdgeWithinDistance2D) (
const LWT_BE_TOPOLOGY* topo,
- const LWPOINT* pt, double dist, int* numelems,
+ const LWPOINT* pt, double dist, uint64_t* numelems,
int fields, int limit
);
@@ -322,7 +319,6 @@
* @param edges the edges to insert. Those with a edge_id set to -1
* it will be replaced to an automatically assigned identifier
* @param nelems number of elements in the edges array
- * TODO: Should be uint64 to match SPI_processed
*
* @return number of inserted edges, or -1 (@see lastErrorMessage)
*/
@@ -329,7 +325,7 @@
int (*insertEdges) (
const LWT_BE_TOPOLOGY* topo,
LWT_ISO_EDGE* edges,
- int numelems
+ uint64_t numelems
);
/**
@@ -375,7 +371,7 @@
*/
LWT_ISO_FACE* (*getFaceById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields
);
/**
@@ -454,7 +450,7 @@
LWT_ISO_NODE* (*getNodeWithinBox2D) (
const LWT_BE_TOPOLOGY* topo,
const GBOX* box,
- int* numelems, int fields, int limit
+ uint64_t* numelems, int fields, int limit
);
/**
@@ -479,7 +475,7 @@
LWT_ISO_EDGE* (*getEdgeWithinBox2D) (
const LWT_BE_TOPOLOGY* topo,
const GBOX* box,
- int* numelems, int fields, int limit
+ uint64_t* numelems, int fields, int limit
);
/**
@@ -502,7 +498,7 @@
*/
LWT_ISO_EDGE* (*getEdgeByNode) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields
);
/**
@@ -559,7 +555,7 @@
* @param faces the faces to insert. Those with a node_id set to -1
* it will be replaced to an automatically assigned identifier
* @param nelems number of elements in the faces array
- * TODO: Should be uint64 to match SPI_processed
+ * TODO: Should be uint64_t to match SPI_processed
*
* @return number of inserted faces, or -1 (@see lastErrorMessage)
*/
@@ -566,7 +562,7 @@
int (*insertFaces) (
const LWT_BE_TOPOLOGY* topo,
LWT_ISO_FACE* faces,
- int numelems
+ uint64_t numelems
);
/**
@@ -576,7 +572,7 @@
* @param faces an array of LWT_ISO_FACE object with selecting id
* and setting mbr.
* @param numfaces number of faces in the "faces" array
- * TODO: Should be uint64 to match SPI_processed
+ * TODO: Should be uint64_t to match SPI_processed
*
* @return number of faces being updated or -1 on error
* (@see lastErroMessage)
@@ -615,7 +611,7 @@
*/
LWT_ELEMID* (*getRingEdges) (
const LWT_BE_TOPOLOGY* topo,
- LWT_ELEMID edge, int *numedges, int limit
+ LWT_ELEMID edge, uint64_t *numedges, uint64_t limit
);
/**
@@ -625,7 +621,7 @@
* @param edges an array of LWT_ISO_EDGE object with selecting id
* and updating fields.
* @param numedges number of edges in the "edges" array
- * TODO: Should be uint64 to match SPI_processed
+ * TODO: Should be uint64_t to match SPI_processed
* @param upd_fields fields to be updated for the selected edges,
* see LWT_COL_EDGE_* macros
*
@@ -634,7 +630,7 @@
*/
int (*updateEdgesById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_EDGE* edges, int numedges,
+ const LWT_ISO_EDGE* edges, uint64_t numedges,
int upd_fields
);
@@ -649,7 +645,6 @@
* in the input array, gets number of edges in output array
* if the return is not null, otherwise see @return
* section for semantic.
- * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_EDGE_* macros
* @param box optional bounding box to further restrict matches, use
@@ -661,7 +656,7 @@
*/
LWT_ISO_EDGE* (*getEdgeByFace) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields,
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields,
const GBOX *box
);
@@ -674,7 +669,7 @@
* identifiers in the input array, gets number of
* nodes in output array if the return is not null,
* otherwise see @return section for semantic.
- * TODO: Should be uint64 to match SPI_processed
+ * TODO: Should be uint64_t to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_NODE_* macros
* @param box optional bounding box to further restrict matches, use
@@ -686,7 +681,7 @@
*/
LWT_ISO_NODE* (*getNodeByFace) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* faces, int* numelems, int fields,
+ const LWT_ELEMID* faces, uint64_t* numelems, int fields,
const GBOX *box
);
@@ -697,7 +692,6 @@
* @param nodes an array of LWT_ISO_EDGE objects with selecting id
* and updating fields.
* @param numnodes number of nodes in the "nodes" array
- * TODO: Should be uint64 to match SPI_processed
* @param upd_fields fields to be updated for the selected edges,
* see LWT_COL_NODE_* macros
*
@@ -706,7 +700,7 @@
*/
int (*updateNodesById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_NODE* nodes, int numnodes,
+ const LWT_ISO_NODE* nodes, uint64_t numnodes,
int upd_fields
);
@@ -716,7 +710,6 @@
* @param topo the topology to act upon
* @param ids an array of face identifiers
* @param numelems number of face identifiers in the ids array
- * TODO: Should be uint64 to match SPI_processed
*
* @return number of faces being deleted or -1 on error
* (@see lastErrorMessage)
@@ -724,7 +717,7 @@
int (*deleteFacesById) (
const LWT_BE_TOPOLOGY* topo,
const LWT_ELEMID* ids,
- int numelems
+ uint64_t numelems
);
/**
@@ -756,7 +749,6 @@
* @param topo the topology to act upon
* @param ids an array of node identifiers
* @param numelems number of node identifiers in the ids array
- * TODO: Should be uint64 to match SPI_processed
*
* @return number of nodes being deleted or -1 on error
* (@see lastErrorMessage)
@@ -764,7 +756,7 @@
int (*deleteNodesById) (
const LWT_BE_TOPOLOGY* topo,
const LWT_ELEMID* ids,
- int numelems
+ uint64_t numelems
);
/**
@@ -860,7 +852,6 @@
* @param numelems output parameter, gets number of elements found
* if the return is not null, otherwise see @return
* section for semantic.
- * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_FACE_* macros
* @param limit max number of faces to return, 0 for no limit, -1
@@ -875,7 +866,7 @@
LWT_ISO_FACE* (*getFaceWithinBox2D) (
const LWT_BE_TOPOLOGY* topo,
const GBOX* box,
- int* numelems, int fields, int limit
+ uint64_t* numelems, int fields, uint64_t limit
);
} LWT_BE_CALLBACKS;
Modified: trunk/liblwgeom/liblwgeom_topo_internal.h
===================================================================
--- trunk/liblwgeom/liblwgeom_topo_internal.h 2019-04-22 12:09:06 UTC (rev 17407)
+++ trunk/liblwgeom/liblwgeom_topo_internal.h 2019-04-24 10:03:07 UTC (rev 17408)
@@ -49,23 +49,23 @@
int lwt_be_freeTopology(LWT_TOPOLOGY *topo);
-LWT_ISO_NODE* lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt, double dist, int* numelems, int fields, int 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, int* 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, int 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,
- int* numelems, int fields);
+ uint64_t* numelems, int fields);
LWT_ISO_EDGE* lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt,
- double dist, int* numelems, int fields,
- int limit);
+ double dist, uint64_t* numelems, int fields,
+ uint64_t limit);
int
-lwt_be_insertEdges(LWT_TOPOLOGY* topo, LWT_ISO_EDGE* edge, int numelems);
+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
Modified: trunk/liblwgeom/lwgeom_topo.c
===================================================================
--- trunk/liblwgeom/lwgeom_topo.c 2019-04-22 12:09:06 UTC (rev 17407)
+++ trunk/liblwgeom/lwgeom_topo.c 2019-04-24 10:03:07 UTC (rev 17408)
@@ -153,7 +153,7 @@
LWT_ISO_NODE*
lwt_be_getNodeById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
- int* numelems, int fields)
+ uint64_t* numelems, int fields)
{
CBT3(topo, getNodeById, ids, numelems, fields);
}
@@ -160,8 +160,8 @@
LWT_ISO_NODE*
lwt_be_getNodeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt,
- double dist, int* numelems, int fields,
- int limit)
+ double dist, uint64_t* numelems, int fields,
+ uint64_t limit)
{
CBT5(topo, getNodeWithinDistance2D, pt, dist, numelems, fields, limit);
}
@@ -168,8 +168,8 @@
static LWT_ISO_NODE*
lwt_be_getNodeWithinBox2D( const LWT_TOPOLOGY* topo,
- const GBOX* box, int* numelems, int fields,
- int limit )
+ const GBOX* box, uint64_t* numelems, int fields,
+ uint64_t limit )
{
CBT4(topo, getNodeWithinBox2D, box, numelems, fields, limit);
}
@@ -176,8 +176,8 @@
static LWT_ISO_EDGE*
lwt_be_getEdgeWithinBox2D( const LWT_TOPOLOGY* topo,
- const GBOX* box, int* numelems, int fields,
- int limit )
+ const GBOX* box, uint64_t* numelems, int fields,
+ uint64_t limit )
{
CBT4(topo, getEdgeWithinBox2D, box, numelems, fields, limit);
}
@@ -184,32 +184,32 @@
static LWT_ISO_FACE*
lwt_be_getFaceWithinBox2D( const LWT_TOPOLOGY* topo,
- const GBOX* box, int* numelems, int fields,
- int limit )
+ 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, int 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, int 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, int 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, int numelems)
+lwt_be_deleteNodesById(const LWT_TOPOLOGY* topo, const LWT_ELEMID* ids, uint64_t numelems)
{
CBT2(topo, deleteNodesById, ids, numelems);
}
@@ -222,7 +222,7 @@
LWT_ISO_EDGE*
lwt_be_getEdgeById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
- int* numelems, int fields)
+ uint64_t* numelems, int fields)
{
CBT3(topo, getEdgeById, ids, numelems, fields);
}
@@ -229,7 +229,7 @@
static LWT_ISO_FACE*
lwt_be_getFaceById(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
- int* numelems, int fields)
+ uint64_t* numelems, int fields)
{
CBT3(topo, getFaceById, ids, numelems, fields);
}
@@ -236,7 +236,7 @@
static LWT_ISO_EDGE*
lwt_be_getEdgeByNode(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
- int* numelems, int fields)
+ uint64_t* numelems, int fields)
{
CBT3(topo, getEdgeByNode, ids, numelems, fields);
}
@@ -243,7 +243,7 @@
static LWT_ISO_EDGE*
lwt_be_getEdgeByFace(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
- int* numelems, int fields, const GBOX *box)
+ uint64_t* numelems, int fields, const GBOX *box)
{
CBT4(topo, getEdgeByFace, ids, numelems, fields, box);
}
@@ -250,7 +250,7 @@
static LWT_ISO_NODE*
lwt_be_getNodeByFace(LWT_TOPOLOGY* topo, const LWT_ELEMID* ids,
- int* numelems, int fields, const GBOX *box)
+ uint64_t* numelems, int fields, const GBOX *box)
{
CBT4(topo, getNodeByFace, ids, numelems, fields, box);
}
@@ -257,14 +257,14 @@
LWT_ISO_EDGE*
lwt_be_getEdgeWithinDistance2D(LWT_TOPOLOGY* topo, LWPOINT* pt,
- double dist, int* numelems, int fields,
- int limit)
+ 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, int numelems)
+lwt_be_insertEdges(LWT_TOPOLOGY* topo, LWT_ISO_EDGE* edge, uint64_t numelems)
{
CBT2(topo, insertEdges, edge, numelems);
}
@@ -377,7 +377,7 @@
static LWT_ELEMID*
lwt_be_getRingEdges( LWT_TOPOLOGY* topo,
- LWT_ELEMID edge, int *numedges, int limit )
+ LWT_ELEMID edge, uint64_t *numedges, uint64_t limit )
{
CBT3(topo, getRingEdges, edge, numedges, limit);
}
@@ -388,9 +388,9 @@
int
lwt_be_ExistsCoincidentNode(LWT_TOPOLOGY* topo, LWPOINT* pt)
{
- int exists = 0;
+ uint64_t exists = 0;
lwt_be_getNodeWithinDistance2D(topo, pt, 0, &exists, 0, -1);
- if ( exists == -1 ) {
+ if ( exists == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return 0;
}
@@ -400,9 +400,9 @@
int
lwt_be_ExistsEdgeIntersectingPoint(LWT_TOPOLOGY* topo, LWPOINT* pt)
{
- int exists = 0;
+ uint64_t exists = 0;
lwt_be_getEdgeWithinDistance2D(topo, pt, 0, &exists, 0, -1);
- if ( exists == -1 ) {
+ if ( exists == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return 0;
}
@@ -601,7 +601,7 @@
LWT_ELEMID start_node, LWT_ELEMID end_node,
const LWLINE *geom, LWT_ELEMID myself )
{
- int i, num_nodes, num_edges;
+ uint64_t i, num_nodes, num_edges;
LWT_ISO_EDGE *edges;
LWT_ISO_NODE *nodes;
const GBOX *edgebox;
@@ -620,7 +620,7 @@
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 == -1 ) {
+ if ( num_nodes == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
@@ -648,7 +648,7 @@
/* 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 == -1 ) {
+ if ( num_edges == UINT64_MAX ) {
GEOSGeom_destroy(edgegg);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -769,8 +769,8 @@
lwt_AddIsoEdge( LWT_TOPOLOGY* topo, LWT_ELEMID startNode,
LWT_ELEMID endNode, const LWLINE* geom )
{
- int num_nodes;
- int i;
+ uint64_t num_nodes;
+ uint64_t i;
LWT_ISO_EDGE newedge;
LWT_ISO_NODE *endpoints;
LWT_ELEMID containing_face = -1;
@@ -811,7 +811,7 @@
node_ids[1] = endNode;
endpoints = lwt_be_getNodeById( topo, node_ids, &num_nodes,
LWT_COL_NODE_ALL );
- if ( num_nodes < 0 )
+ if ( num_nodes == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -935,7 +935,7 @@
{
LWGEOM *split;
LWCOLLECTION *split_col;
- int i;
+ uint64_t i;
/* Get edge */
i = 1;
@@ -945,7 +945,7 @@
if ( ! *oldedge )
{
LWDEBUGF(1, "lwt_be_getEdgeById returned NULL and set i=%d", i);
- if ( i == -1 )
+ if ( i == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return NULL;
@@ -1492,8 +1492,8 @@
edgeend *other, int myedge_id )
{
LWT_ISO_EDGE *edges;
- int numedges = 1;
- int i;
+ uint64_t numedges = 1;
+ uint64_t i;
double minaz, maxaz;
double az, azdif;
@@ -1516,7 +1516,7 @@
/* Get incident edges */
edges = lwt_be_getEdgeByNode( topo, &node, &numedges, LWT_COL_EDGE_ALL );
- if ( numedges == -1 ) {
+ if ( numedges == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return 0;
}
@@ -1739,10 +1739,10 @@
}
static LWPOLY *
-_lwt_MakeRingShell(LWT_TOPOLOGY *topo, LWT_ELEMID *signed_edge_ids, int num_signed_edge_ids)
+_lwt_MakeRingShell(LWT_TOPOLOGY *topo, LWT_ELEMID *signed_edge_ids, uint64_t num_signed_edge_ids)
{
LWT_ELEMID *edge_ids;
- int numedges, i, j;
+ uint64_t numedges, i, j;
LWT_ISO_EDGE *ring_edges;
/* Construct a polygon using edges of the ring */
@@ -1764,7 +1764,7 @@
ring_edges = lwt_be_getEdgeById(topo, edge_ids, &i,
LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM);
lwfree( edge_ids );
- if ( i == -1 )
+ if ( i == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return NULL;
@@ -1856,9 +1856,9 @@
LWT_ELEMID sedge, LWT_ELEMID face,
int mbr_only )
{
- int numfaceedges, i, j;
+ uint64_t numfaceedges, i, j;
int newface_outside;
- int num_signed_edge_ids;
+ uint64_t num_signed_edge_ids;
LWT_ELEMID *signed_edge_ids;
LWT_ISO_EDGE *edges;
LWT_ISO_EDGE *forward_edges = NULL;
@@ -1954,9 +1954,9 @@
if ( face != 0 && ! isccw)
{{
/* Face created an hole in an outer face */
- int nfaces = 1;
+ uint64_t nfaces = 1;
oldface = lwt_be_getFaceById(topo, &face, &nfaces, LWT_COL_FACE_ALL);
- if ( nfaces == -1 )
+ if ( nfaces == UINT64_MAX )
{
lwfree( signed_edge_ids );
lwpoly_free(shell); /* NOTE: owns shellbox */
@@ -2021,7 +2021,7 @@
;
numfaceedges = 1;
edges = lwt_be_getEdgeByFace( topo, &face, &numfaceedges, fields, newface.mbr );
- if ( numfaceedges == -1 ) {
+ if ( numfaceedges == UINT64_MAX ) {
lwfree( signed_edge_ids );
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -2;
@@ -2179,11 +2179,11 @@
_lwt_release_edges(edges, numfaceedges);
/* Update isolated nodes which are now in new face */
- int numisonodes = 1;
+ uint64_t numisonodes = 1;
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 == -1 ) {
+ if ( numisonodes == UINT64_MAX ) {
lwfree( signed_edge_ids );
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -2;
@@ -2264,9 +2264,9 @@
LWT_ELEMID node_ids[2];
const LWPOINT *start_node_geom = NULL;
const LWPOINT *end_node_geom = NULL;
- int num_nodes;
+ uint64_t num_nodes;
LWT_ISO_NODE *endpoints;
- int i;
+ uint64_t i;
int prev_left;
int prev_right;
LWT_ISO_EDGE seledge;
@@ -2349,7 +2349,7 @@
}
endpoints = lwt_be_getNodeById( topo, node_ids, &num_nodes, LWT_COL_NODE_ALL );
- if ( num_nodes < 0 ) {
+ if ( num_nodes == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
@@ -2776,12 +2776,12 @@
LWGEOM*
lwt_GetFaceGeometry(LWT_TOPOLOGY* topo, LWT_ELEMID faceid)
{
- int numfaceedges;
+ uint64_t numfaceedges;
LWT_ISO_EDGE *edges;
LWT_ISO_FACE *face;
LWPOLY *out;
LWGEOM *outg;
- int i;
+ uint64_t i;
int fields;
if ( faceid == 0 )
@@ -2797,7 +2797,7 @@
LWT_COL_EDGE_FACE_RIGHT
;
edges = lwt_be_getEdgeByFace( topo, &faceid, &numfaceedges, fields, NULL );
- if ( numfaceedges == -1 ) {
+ if ( numfaceedges == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return NULL;
}
@@ -2806,7 +2806,7 @@
{
i = 1;
face = lwt_be_getFaceById(topo, &faceid, &i, LWT_COL_FACE_FACE_ID);
- if ( i == -1 ) {
+ if ( i == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return NULL;
}
@@ -3008,7 +3008,7 @@
LWGEOM *face;
LWPOLY *facepoly;
LWT_ISO_EDGE *edges;
- int numfaceedges;
+ uint64_t numfaceedges;
int fields;
uint32_t i;
int nseid = 0; /* number of signed edge ids */
@@ -3023,7 +3023,7 @@
LWT_COL_EDGE_FACE_RIGHT
;
edges = lwt_be_getEdgeByFace( topo, &face_id, &numfaceedges, fields, NULL );
- if ( numfaceedges == -1 ) {
+ if ( numfaceedges == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
@@ -3172,7 +3172,7 @@
LWT_ISO_EDGE *oldedge;
LWT_ISO_EDGE newedge;
POINT2D p1, p2, pt;
- int i;
+ uint64_t i;
int isclosed = 0;
/* curve must be simple */
@@ -3188,7 +3188,7 @@
{
LWDEBUGF(1, "lwt_ChangeEdgeGeom: "
"lwt_be_getEdgeById returned NULL and set i=%d", i);
- if ( i == -1 )
+ if ( i == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -3301,11 +3301,11 @@
gbox_union(oldedge->geom->bbox, geom->bbox, &mbox);
// 2. fetch all nodes in the combined box
LWT_ISO_NODE *nodes;
- int numnodes;
+ uint64_t numnodes;
nodes = lwt_be_getNodeWithinBox2D(topo, &mbox, &numnodes,
LWT_COL_NODE_ALL, 0);
LWDEBUGF(1, "lwt_be_getNodeWithinBox2D returned %d nodes", numnodes);
- if ( numnodes == -1 ) {
+ if ( numnodes == UINT64_MAX ) {
_lwt_release_edges(oldedge, 1);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -3344,9 +3344,9 @@
edgeend span_pre, epan_pre;
/* initialize span_pre.myaz and epan_pre.myaz with existing edge */
- i = _lwt_InitEdgeEndByLine(&span_pre, &epan_pre,
+ int res = _lwt_InitEdgeEndByLine(&span_pre, &epan_pre,
oldedge->geom, &p1, &p2);
- if ( i ) return -1; /* lwerror should have been raised */
+ 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,
@@ -3361,14 +3361,14 @@
/* update edge geometry */
newedge.edge_id = edge_id;
newedge.geom = geom;
- i = lwt_be_updateEdgesById(topo, &newedge, 1, LWT_COL_EDGE_GEOM);
- if ( i == -1 )
+ res = lwt_be_updateEdgesById(topo, &newedge, 1, LWT_COL_EDGE_GEOM);
+ if ( res == -1 )
{
_lwt_release_edges(oldedge, 1);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
- if ( ! i )
+ if ( ! res )
{
_lwt_release_edges(oldedge, 1);
lwerror("Unexpected error: %d edges updated when expecting 1", i);
@@ -3379,12 +3379,12 @@
* Check edge adjacency after
*/
edgeend span_post, epan_post;
- i = _lwt_InitEdgeEndByLine(&span_post, &epan_post, geom, &p1, &p2);
- if ( i ) 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 */
/* initialize epan_post.myaz and epan_post.myaz */
- i = _lwt_InitEdgeEndByLine(&span_post, &epan_post,
+ res = _lwt_InitEdgeEndByLine(&span_post, &epan_post,
geom, &p1, &p2);
- if ( i ) return -1; /* lwerror should have been raised */
+ 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,13 +3485,13 @@
LWDEBUGF(1, "%d faces to update", facestoupdate);
if ( facestoupdate )
{
- i = lwt_be_updateFacesById( topo, &(faces[0]), facestoupdate );
- if ( i != 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 ( i == -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);
@@ -3515,10 +3515,10 @@
_lwt_GetIsoNode(LWT_TOPOLOGY* topo, LWT_ELEMID nid)
{
LWT_ISO_NODE *node;
- int n = 1;
+ uint64_t n = 1;
node = lwt_be_getNodeById( topo, &nid, &n, LWT_COL_NODE_CONTAINING_FACE );
- if ( n < 0 ) {
+ if ( n == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return 0;
}
@@ -3616,8 +3616,8 @@
LWT_ELEMID nid[2];
LWT_ISO_NODE upd_node[2];
LWT_ELEMID containing_face;
- int n = 1;
- int i;
+ uint64_t n = 1;
+ uint64_t i;
edge = lwt_be_getEdgeById( topo, &id, &n, LWT_COL_EDGE_START_NODE|
LWT_COL_EDGE_END_NODE |
@@ -3655,7 +3655,7 @@
n = 2;
edge = lwt_be_getEdgeByNode( topo, nid, &n, LWT_COL_EDGE_EDGE_ID );
- if ((n == -1) || (edge == NULL))
+ if ((n == UINT64_MAX) || (edge == NULL))
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -3673,7 +3673,7 @@
deledge.edge_id = id;
n = lwt_be_deleteEdges( topo, &deledge, LWT_COL_EDGE_EDGE_ID );
- if ( n == -1 )
+ if ( n == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -3694,7 +3694,7 @@
}
n = lwt_be_updateNodesById(topo, upd_node, n,
LWT_COL_NODE_CONTAINING_FACE);
- if ( n == -1 )
+ if ( n == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -3774,7 +3774,7 @@
static LWT_ELEMID
_lwt_RemEdge( LWT_TOPOLOGY* topo, LWT_ELEMID edge_id, int modFace )
{
- int i, nedges, nfaces, fields;
+ uint64_t i, nedges, nfaces, fields;
LWT_ISO_EDGE *edge = NULL;
LWT_ISO_EDGE *upd_edge = NULL;
LWT_ISO_EDGE upd_edge_left[2];
@@ -3799,7 +3799,7 @@
if ( ! edge )
{
LWDEBUGF(1, "lwt_be_getEdgeById returned NULL and set i=%d", i);
- if ( i == -1 )
+ if ( i == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -3840,7 +3840,7 @@
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 == -1 ) {
+ if ( nedges == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
@@ -3888,9 +3888,9 @@
{
LWDEBUGF(1, "updating %d 'next_left' edges", nedge_left);
/* update edges in upd_edge_left set next_left */
- i = lwt_be_updateEdgesById(topo, &(upd_edge_left[0]), nedge_left,
+ int result = lwt_be_updateEdgesById(topo, &(upd_edge_left[0]), nedge_left,
LWT_COL_EDGE_NEXT_LEFT);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edge, 1);
lwfree(upd_edge);
@@ -3902,9 +3902,9 @@
{
LWDEBUGF(1, "updating %d 'next_right' edges", nedge_right);
/* update edges in upd_edge_right set next_right */
- i = lwt_be_updateEdgesById(topo, &(upd_edge_right[0]), nedge_right,
+ int result = lwt_be_updateEdgesById(topo, &(upd_edge_right[0]), nedge_right,
LWT_COL_EDGE_NEXT_RIGHT);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edge, 1);
lwfree(upd_edge);
@@ -3944,7 +3944,7 @@
nfaces = 2;
fields = LWT_COL_FACE_ALL;
faces = lwt_be_getFaceById(topo, face_ids, &nfaces, fields);
- if ( nfaces == -1 ) {
+ if ( nfaces == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
@@ -4011,15 +4011,15 @@
if ( modFace )
{
newface.face_id = floodface;
- i = lwt_be_updateFacesById( topo, &newface, 1 );
+ int result = lwt_be_updateFacesById( topo, &newface, 1 );
_lwt_release_faces(faces, 2);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edge, 1);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
- if ( i != 1 )
+ if ( result != 1 )
{
_lwt_release_edges(edge, 1);
lwerror("Unexpected error: %d faces updated when expecting 1", i);
@@ -4030,9 +4030,9 @@
{
/* New face replaces the old two faces */
newface.face_id = -1;
- i = lwt_be_insertFaces( topo, &newface, 1 );
+ int result = lwt_be_insertFaces( topo, &newface, 1 );
_lwt_release_faces(faces, 2);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edge, 1);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4095,8 +4095,8 @@
} /* two faces healed */
/* Delete the edge */
- i = lwt_be_deleteEdges(topo, edge, LWT_COL_EDGE_EDGE_ID);
- if ( i == -1 ) {
+ 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;
@@ -4119,9 +4119,9 @@
}
if ( nnode )
{
- i = lwt_be_updateNodesById(topo, upd_node, nnode,
+ int result = lwt_be_updateNodesById(topo, upd_node, nnode,
LWT_COL_NODE_CONTAINING_FACE);
- if ( i == -1 ) {
+ if ( result == -1 ) {
_lwt_release_edges(edge, 1);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4137,8 +4137,8 @@
ids[nids++] = edge->face_right;
if ( edge->face_left != floodface )
ids[nids++] = edge->face_left;
- i = lwt_be_deleteFacesById(topo, ids, nids);
- if ( i == -1 ) {
+ 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;
@@ -4169,12 +4169,12 @@
LWT_ELEMID commonnode = -1;
int caseno = 0;
LWT_ISO_EDGE *node_edges;
- int num_node_edges;
+ uint64_t num_node_edges;
LWT_ISO_EDGE *edges;
LWT_ISO_EDGE *e1 = NULL;
LWT_ISO_EDGE *e2 = NULL;
LWT_ISO_EDGE newedge, updedge, seledge;
- int nedges, i;
+ uint64_t nedges, i;
int e1freenode;
int e2sign, e2freenode;
POINTARRAY *pa;
@@ -4195,7 +4195,7 @@
ids[1] = eid2;
nedges = 2;
edges = lwt_be_getEdgeById(topo, ids, &nedges, LWT_COL_EDGE_ALL);
- if ((nedges == -1) || (edges == NULL))
+ if ((nedges == UINT64_MAX) || (edges == NULL))
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4272,7 +4272,7 @@
num_node_edges = 1;
node_edges = lwt_be_getEdgeByNode( topo, &commonnode,
&num_node_edges, LWT_COL_EDGE_EDGE_ID );
- if ( num_node_edges == -1 ) {
+ if ( num_node_edges == UINT64_MAX ) {
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4323,7 +4323,7 @@
num_node_edges = 1;
node_edges = lwt_be_getEdgeByNode( topo, &commonnode,
&num_node_edges, LWT_COL_EDGE_EDGE_ID );
- if ( num_node_edges == -1 ) {
+ if ( num_node_edges == UINT64_MAX ) {
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4453,13 +4453,13 @@
{
/* Update data of the first edge */
newedge.edge_id = eid1;
- i = lwt_be_updateEdgesById(topo, &newedge, 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 ( i == -1 )
+ if ( result == -1 )
{
lwline_free(newedge.geom);
_lwt_release_edges(edges, nedges);
@@ -4466,7 +4466,7 @@
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
- else if ( i != 1 )
+ else if ( result != 1 )
{
lwline_free(newedge.geom);
if ( edges ) _lwt_release_edges(edges, nedges);
@@ -4480,13 +4480,13 @@
newedge.edge_id = -1;
newedge.face_left = e1->face_left;
newedge.face_right = e1->face_right;
- i = lwt_be_insertEdges(topo, &newedge, 1);
- if ( i == -1 ) {
+ 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 ( i == 0 ) {
+ } else if ( result == 0 ) {
lwline_free(newedge.geom);
_lwt_release_edges(edges, nedges);
lwerror("Insertion of split edge failed (no reason)");
@@ -4512,10 +4512,10 @@
/* update edges connected to e2's boundary from their end node */
seledge.next_left = e2freenode * eid2;
updedge.next_left = e2freenode * newedge.edge_id * e2sign;
- i = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT,
+ int result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT,
&updedge, LWT_COL_EDGE_NEXT_LEFT,
NULL, 0);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4525,10 +4525,10 @@
/* update edges connected to e2's boundary from their start node */
seledge.next_right = e2freenode * eid2;
updedge.next_right = e2freenode * newedge.edge_id * e2sign;
- i = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT,
+ result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT,
&updedge, LWT_COL_EDGE_NEXT_RIGHT,
NULL, 0);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4540,10 +4540,10 @@
/* update edges connected to e1's boundary from their end node */
seledge.next_left = e1freenode * eid1;
updedge.next_left = e1freenode * newedge.edge_id;
- i = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT,
+ result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_LEFT,
&updedge, LWT_COL_EDGE_NEXT_LEFT,
NULL, 0);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4553,10 +4553,10 @@
/* update edges connected to e1's boundary from their start node */
seledge.next_right = e1freenode * eid1;
updedge.next_right = e1freenode * newedge.edge_id;
- i = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT,
+ result = lwt_be_updateEdges(topo, &seledge, LWT_COL_EDGE_NEXT_RIGHT,
&updedge, LWT_COL_EDGE_NEXT_RIGHT,
NULL, 0);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4565,8 +4565,8 @@
}
/* delete the edges (only second on modEdge or both) */
- i = lwt_be_deleteEdges(topo, e2, LWT_COL_EDGE_EDGE_ID);
- if ( i == -1 )
+ result = lwt_be_deleteEdges(topo, e2, LWT_COL_EDGE_EDGE_ID);
+ if ( result == -1 )
{
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4574,7 +4574,7 @@
}
if ( ! modEdge ) {
i = lwt_be_deleteEdges(topo, e1, LWT_COL_EDGE_EDGE_ID);
- if ( i == -1 )
+ if ( result == -1 )
{
_lwt_release_edges(edges, nedges);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -4586,7 +4586,7 @@
/* delete the common node */
i = lwt_be_deleteNodesById( topo, &commonnode, 1 );
- if ( i == -1 )
+ if ( result == -1 )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4626,7 +4626,7 @@
lwt_GetNodeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
{
LWT_ISO_NODE *elem;
- int num;
+ uint64_t num;
int flds = LWT_COL_NODE_NODE_ID|LWT_COL_NODE_GEOM; /* geom not needed */
LWT_ELEMID id = 0;
POINT2D qp; /* query point */
@@ -4637,7 +4637,7 @@
return -1;
}
elem = lwt_be_getNodeWithinDistance2D(topo, pt, tol, &num, flds, 0);
- if ( num == -1 )
+ if ( num == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4661,7 +4661,7 @@
lwt_GetEdgeByPoint(LWT_TOPOLOGY *topo, LWPOINT *pt, double tol)
{
LWT_ISO_EDGE *elem;
- int num, i;
+ uint64_t num, i;
int flds = LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM; /* GEOM is not needed */
LWT_ELEMID id = 0;
LWGEOM *qp = lwpoint_as_lwgeom(pt); /* query point */
@@ -4672,7 +4672,7 @@
return -1;
}
elem = lwt_be_getEdgeWithinDistance2D(topo, pt, tol, &num, flds, 0);
- if ( num == -1 )
+ if ( num == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4718,7 +4718,7 @@
{
LWT_ELEMID id = 0;
LWT_ISO_EDGE *elem;
- int num, i;
+ uint64_t num, i;
int flds = LWT_COL_EDGE_EDGE_ID |
LWT_COL_EDGE_GEOM |
LWT_COL_EDGE_FACE_LEFT |
@@ -4745,7 +4745,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 == -1 )
+ if ( num == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4885,7 +4885,7 @@
_lwt_AddPoint(LWT_TOPOLOGY* topo, LWPOINT* point, double tol, int
findFace, int *moved)
{
- int num, i;
+ uint64_t num, i;
double mindist = FLT_MAX;
LWT_ISO_NODE *nodes, *nodes2;
LWT_ISO_EDGE *edges, *edges2;
@@ -4906,7 +4906,7 @@
*/
flds = LWT_COL_NODE_NODE_ID|LWT_COL_NODE_GEOM;
nodes = lwt_be_getNodeWithinDistance2D(topo, point, tol, &num, flds, 0);
- if ( num == -1 )
+ if ( num == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -4968,7 +4968,7 @@
*/
flds = LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM;
edges = lwt_be_getEdgeWithinDistance2D(topo, point, tol, &num, flds, 0);
- if ( num == -1 )
+ if ( num == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -5209,13 +5209,13 @@
{
LWT_ELEMID id;
LWT_ISO_EDGE *edges;
- int num, i;
+ uint64_t num, i;
const GBOX *qbox = lwgeom_get_bbox( lwline_as_lwgeom(edge) );
GEOSGeometry *edgeg;
const int flds = LWT_COL_EDGE_EDGE_ID|LWT_COL_EDGE_GEOM;
edges = lwt_be_getEdgeWithinBox2D( topo, qbox, &num, flds, 0 );
- if ( num == -1 )
+ if ( num == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -5289,7 +5289,7 @@
LWT_ELEMID nid[2]; /* start_node, end_node */
LWT_ELEMID id; /* edge id */
POINT4D p4d;
- int nn, i;
+ uint64_t nn, i;
int moved=0, mm;
LWDEBUGG(1, lwline_as_lwgeom(edge), "_lwtAddLineEdge");
@@ -5333,7 +5333,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 == -1 )
+ if ( nn == UINT64_MAX )
{
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
@@ -5490,14 +5490,14 @@
{
LWGEOM *geomsbuf[1];
LWGEOM **geoms;
- int ngeoms;
+ uint32_t ngeoms;
LWGEOM *noded, *tmp;
LWCOLLECTION *col;
LWT_ELEMID *ids;
LWT_ISO_EDGE *edges;
LWT_ISO_NODE *nodes;
- int num, numedges=0, numnodes=0;
- int i;
+ uint64_t num, numedges=0, numnodes=0;
+ uint64_t i;
GBOX qbox;
*nedges = -1; /* error condition, by default */
@@ -5534,7 +5534,7 @@
/* 2. Node to edges falling within tol distance */
edges = lwt_be_getEdgeWithinBox2D( topo, &qbox, &numedges, LWT_COL_EDGE_ALL, 0 );
- if ( numedges == -1 )
+ if ( numedges == UINT64_MAX )
{
lwgeom_free(noded);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -5610,7 +5610,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 == -1 )
+ if ( numnodes == UINT64_MAX )
{
lwgeom_free(noded);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -5781,8 +5781,8 @@
*nfaces = -1; /* error condition, by default */
int num;
LWT_ISO_FACE *faces;
- int nfacesinbox;
- int j;
+ uint64_t nfacesinbox;
+ uint64_t j;
LWT_ELEMID *ids = NULL;
GBOX qbox;
const GEOSPreparedGeometry *ppoly;
@@ -5821,7 +5821,7 @@
gbox_expand(&qbox, tol);
faces = lwt_be_getFaceWithinBox2D( topo, &qbox, &nfacesinbox,
LWT_COL_FACE_ALL, 0 );
- if ( nfacesinbox == -1 )
+ if ( nfacesinbox == UINT64_MAX )
{
lwfree(ids);
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
@@ -6113,11 +6113,11 @@
{
LWT_ISO_EDGE *edge;
int fields = LWT_COL_EDGE_ALL;
- int nelems = 1;
+ uint64_t nelems = 1;
edge = lwt_be_getEdgeWithinBox2D( topo, NULL, &nelems, fields, 0);
*numedges = nelems;
- if ( nelems == -1 ) {
+ if ( nelems == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return NULL;
}
@@ -6655,13 +6655,13 @@
{
LWT_ISO_FACE *faces;
int fields = LWT_COL_FACE_FACE_ID;
- int nelems = 1;
+ uint64_t nelems = 1;
GBOX qbox;
qbox.xmin = qbox.ymin = -DBL_MAX;
qbox.xmax = qbox.ymax = DBL_MAX;
faces = lwt_be_getFaceWithinBox2D( topo, &qbox, &nelems, fields, 1);
- if ( nelems == -1 ) {
+ if ( nelems == UINT64_MAX ) {
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
return -1;
}
Modified: trunk/topology/postgis_topology.c
===================================================================
--- trunk/topology/postgis_topology.c 2019-04-22 12:09:06 UTC (rev 17407)
+++ trunk/topology/postgis_topology.c 2019-04-24 10:03:07 UTC (rev 17408)
@@ -919,7 +919,7 @@
static LWT_ISO_EDGE*
cb_getEdgeById(const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields)
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields)
{
LWT_ISO_EDGE *edges;
int spi_result;
@@ -926,7 +926,7 @@
MemoryContext oldcontext = CurrentMemoryContext;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
initStringInfo(sql);
appendStringInfoString(sql, "SELECT ");
@@ -947,7 +947,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -973,7 +973,7 @@
static LWT_ISO_EDGE*
cb_getEdgeByNode(const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields)
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields)
{
LWT_ISO_EDGE *edges;
int spi_result;
@@ -980,7 +980,7 @@
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
MemoryContext oldcontext = CurrentMemoryContext;
initStringInfo(sql);
@@ -1010,7 +1010,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -1036,7 +1036,7 @@
static LWT_ISO_EDGE*
cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields,
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields,
const GBOX *box)
{
LWT_ISO_EDGE *edges;
@@ -1044,7 +1044,7 @@
MemoryContext oldcontext = CurrentMemoryContext;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
ArrayType *array_ids;
Datum *datum_ids;
Datum values[2];
@@ -1091,7 +1091,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -1117,13 +1117,13 @@
static LWT_ISO_FACE*
cb_getFacesById(const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields)
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields)
{
LWT_ISO_FACE *faces;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
MemoryContext oldcontext = CurrentMemoryContext;
initStringInfo(sql);
@@ -1147,7 +1147,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -1173,7 +1173,7 @@
static LWT_ELEMID*
cb_getRingEdges(const LWT_BE_TOPOLOGY* topo,
- LWT_ELEMID edge, int* numelems, int limit)
+ LWT_ELEMID edge, uint64_t* numelems, uint64_t limit)
{
LWT_ELEMID *edges;
int spi_result;
@@ -1180,7 +1180,7 @@
TupleDesc rowdesc;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
MemoryContext oldcontext = CurrentMemoryContext;
initStringInfo(sql);
@@ -1199,10 +1199,10 @@
if ( limit )
{
++limit; /* so we know if we hit it */
- appendStringInfo(sql, " LIMIT %d", limit);
+ appendStringInfo(sql, " LIMIT " UINT64_FORMAT, limit);
}
- POSTGIS_DEBUGF(1, "cb_getRingEdges query (limit %d): %s", limit, sql->data);
+ POSTGIS_DEBUGF(1, "cb_getRingEdges query (limit " UINT64_FORMAT "): %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 )
@@ -1209,12 +1209,12 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
- POSTGIS_DEBUGF(1, "cb_getRingEdges: edge query returned %d rows", SPI_processed);
+ POSTGIS_DEBUGF(1, "cb_getRingEdges: edge query returned " UINT64_FORMAT " rows", SPI_processed);
*numelems = SPI_processed;
if ( ! SPI_processed )
{
@@ -1222,8 +1222,8 @@
}
if ( limit && *numelems == limit )
{
- cberror(topo->be_data, "Max traversing limit hit: %d", limit-1);
- *numelems = -1;
+ cberror(topo->be_data, "Max traversing limit hit: "UINT64_FORMAT, limit-1);
+ *numelems = UINT64_MAX;
return NULL;
}
@@ -1240,7 +1240,7 @@
{
lwfree(edges);
cberror(topo->be_data, "Found edge with NULL edge_id");
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
val = DatumGetInt32(dat);
@@ -1256,7 +1256,7 @@
static LWT_ISO_NODE*
cb_getNodeById(const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields)
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields)
{
LWT_ISO_NODE *nodes;
int spi_result;
@@ -1263,7 +1263,7 @@
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
MemoryContext oldcontext = CurrentMemoryContext;
initStringInfo(sql);
@@ -1310,7 +1310,7 @@
static LWT_ISO_NODE*
cb_getNodeByFace(const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int* numelems, int fields,
+ const LWT_ELEMID* ids, uint64_t* numelems, int fields,
const GBOX *box)
{
LWT_ISO_NODE *nodes;
@@ -1318,7 +1318,7 @@
MemoryContext oldcontext = CurrentMemoryContext;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
char *hexbox;
initStringInfo(sql);
@@ -1346,7 +1346,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -1372,7 +1372,7 @@
static LWT_ISO_EDGE*
cb_getEdgeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
- const LWPOINT* pt, double dist, int* numelems,
+ const LWPOINT* pt, double dist, uint64_t* numelems,
int fields, int limit)
{
LWT_ISO_EDGE *edges;
@@ -1383,7 +1383,7 @@
MemoryContext oldcontext = CurrentMemoryContext;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
initStringInfo(sql);
if ( elems_requested == -1 )
@@ -1422,7 +1422,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -1467,7 +1467,7 @@
static LWT_ISO_NODE*
cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo,
- const LWPOINT* pt, double dist, int* numelems,
+ const LWPOINT* pt, double dist, uint64_t* numelems,
int fields, int limit)
{
MemoryContext oldcontext = CurrentMemoryContext;
@@ -1478,7 +1478,7 @@
StringInfoData sqldata;
StringInfo sql = &sqldata;
int elems_requested = limit;
- int i;
+ uint64_t i;
initStringInfo(sql);
if ( elems_requested == -1 )
@@ -1525,7 +1525,7 @@
cberror(topo->be_data, "unexpected return (%d) from query execution: %s",
spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -1572,13 +1572,13 @@
static int
cb_insertNodes( const LWT_BE_TOPOLOGY* topo,
- LWT_ISO_NODE* nodes, int numelems )
+ LWT_ISO_NODE* nodes, uint64_t numelems )
{
MemoryContext oldcontext = CurrentMemoryContext;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
initStringInfo(sql);
appendStringInfo(sql, "INSERT INTO \"%s\".node (", topo->name);
@@ -1610,8 +1610,8 @@
// TODO: Remove cast when numelems uses uint64 instead of int
if ( SPI_processed != (uint64) numelems )
{
- cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d",
- (uint64)SPI_processed, numelems);
+ cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
+ SPI_processed, numelems);
return 0;
}
@@ -1631,13 +1631,13 @@
static int
cb_insertEdges( const LWT_BE_TOPOLOGY* topo,
- LWT_ISO_EDGE* edges, int numelems )
+ LWT_ISO_EDGE* edges, uint64_t numelems )
{
MemoryContext oldcontext = CurrentMemoryContext;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
int needsEdgeIdReturn = 0;
initStringInfo(sql);
@@ -1669,8 +1669,8 @@
POSTGIS_DEBUGF(1, "cb_insertEdges query processed %d rows", SPI_processed);
if ( SPI_processed != (uint64) numelems )
{
- cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d",
- (uint64)SPI_processed, numelems);
+ cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
+ SPI_processed, numelems);
return -1;
}
@@ -1677,7 +1677,7 @@
if ( needsEdgeIdReturn )
{
/* Set node_id for items that need it */
- for ( i=0; i<(int)SPI_processed; ++i )
+ for ( i=0; i< SPI_processed; ++i )
{
if ( edges[i].edge_id != -1 ) continue;
fillEdgeFields(&edges[i], SPI_tuptable->vals[i],
@@ -1692,13 +1692,13 @@
static int
cb_insertFaces( const LWT_BE_TOPOLOGY* topo,
- LWT_ISO_FACE* faces, int numelems )
+ LWT_ISO_FACE* faces, uint64_t numelems )
{
MemoryContext oldcontext = CurrentMemoryContext;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
int needsFaceIdReturn = 0;
initStringInfo(sql);
@@ -1714,7 +1714,7 @@
}
if ( needsFaceIdReturn ) appendStringInfoString(sql, " RETURNING face_id");
- POSTGIS_DEBUGF(1, "cb_insertFaces query (%d elems): %s", numelems, sql->data);
+ POSTGIS_DEBUGF(1, "cb_insertFaces query (" UINT64_MAX " 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 ) )
@@ -1727,10 +1727,10 @@
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 != (uint64) numelems )
+ if ( SPI_processed != numelems )
{
- cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d",
- (uint64)SPI_processed, numelems);
+ cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected " UINT64_FORMAT,
+ SPI_processed, numelems);
return -1;
}
@@ -1842,10 +1842,10 @@
static int
cb_updateNodesById( const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_NODE* nodes, int numnodes, int fields )
+ const LWT_ISO_NODE* nodes, uint64_t numnodes, int fields )
{
MemoryContext oldcontext = CurrentMemoryContext;
- int i;
+ uint64_t i;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
@@ -1963,10 +1963,10 @@
static int
cb_updateEdgesById( const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_EDGE* edges, int numedges, int fields )
+ const LWT_ISO_EDGE* edges, uint64_t numedges, int fields )
{
MemoryContext oldcontext = CurrentMemoryContext;
- int i;
+ uint64_t i;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
@@ -2817,16 +2817,16 @@
static int
cb_deleteFacesById( const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int numelems )
+ const LWT_ELEMID* ids, uint64_t numelems )
{
MemoryContext oldcontext = CurrentMemoryContext;
- int spi_result, i;
+ int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
initStringInfo(sql);
appendStringInfo(sql, "DELETE FROM \"%s\".face WHERE face_id IN (", topo->name);
- for (i=0; i<numelems; ++i)
+ for (uint64_t i=0; i<numelems; ++i)
{
appendStringInfo(sql, "%s%" LWTFMT_ELEMID, (i?",":""), ids[i]);
}
@@ -2855,10 +2855,10 @@
static int
cb_deleteNodesById( const LWT_BE_TOPOLOGY* topo,
- const LWT_ELEMID* ids, int numelems )
+ const LWT_ELEMID* ids, uint64_t numelems )
{
MemoryContext oldcontext = CurrentMemoryContext;
- int spi_result, i;
+ int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
@@ -2865,7 +2865,7 @@
initStringInfo(sql);
appendStringInfo(sql, "DELETE FROM \"%s\".node WHERE node_id IN (",
topo->name);
- for (i=0; i<numelems; ++i)
+ for (uint64_t i=0; i<numelems; ++i)
{
appendStringInfo(sql, "%s%" LWTFMT_ELEMID, (i?",":""), ids[i]);
}
@@ -2894,13 +2894,13 @@
static LWT_ISO_NODE*
cb_getNodeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
- int* numelems, int fields, int limit )
+ uint64_t* numelems, int fields, int limit )
{
MemoryContext oldcontext = CurrentMemoryContext;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
int elems_requested = limit;
LWT_ISO_NODE* nodes;
char *hexbox;
@@ -2935,7 +2935,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -2978,13 +2978,13 @@
static LWT_ISO_EDGE*
cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
- int* numelems, int fields, int limit )
+ uint64_t* numelems, int fields, int limit )
{
MemoryContext oldcontext = CurrentMemoryContext;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
int elems_requested = limit;
LWT_ISO_EDGE* edges;
char *hexbox;
@@ -3024,7 +3024,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
@@ -3067,13 +3067,13 @@
static LWT_ISO_FACE*
cb_getFaceWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
- int* numelems, int fields, int limit )
+ uint64_t* numelems, int fields, uint64_t limit )
{
MemoryContext oldcontext = CurrentMemoryContext;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
- int i;
+ uint64_t i;
int elems_requested = limit;
LWT_ISO_FACE* faces;
char *hexbox;
@@ -3108,7 +3108,7 @@
{
cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data);
pfree(sqldata.data);
- *numelems = -1;
+ *numelems = UINT64_MAX;
return NULL;
}
pfree(sqldata.data);
More information about the postgis-tickets
mailing list