[postgis-tickets] [SCM] PostGIS branch main updated. 3.2.0alpha1-31-g7db04ad

git at osgeo.org git at osgeo.org
Mon Sep 27 03:48:09 PDT 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, main has been updated
       via  7db04adfb58750da9978ebec2d56fec6d1392913 (commit)
      from  38b77f3a01788c1e0755fd49bc45ee4ace8c1cef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7db04adfb58750da9978ebec2d56fec6d1392913
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Sep 27 12:47:56 2021 +0200

    Do not mix signedness of integers

diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index b8216eb..97e0515 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -7059,9 +7059,9 @@ lwt_GetFaceContainingPoint(LWT_TOPOLOGY* topo, const LWPOINT* pt)
   uint64_t numedges, i;
   const POINT2D *queryPoint;
   const POINT2D *closestPointOnEdge = NULL;
-  int closestSegmentIndex;
+  uint32_t closestSegmentIndex;
   int closestSegmentSide;
-  int closestPointVertex = -1;
+  uint32_t closestPointVertex;
   const POINT2D *closestSegmentP0, *closestSegmentP1;
   LWT_ELEMID closestNode = 0;
   double dist;
@@ -7139,6 +7139,10 @@ lwt_GetFaceContainingPoint(LWT_TOPOLOGY* topo, const LWPOINT* pt)
       closestNode = closestEdge->end_node;
     }
   }
+  else
+  {
+    closestPointVertex = closestEdge->geom->points->npoints;
+  }
 
   if ( closestNode != 0 )
   {
@@ -7243,7 +7247,7 @@ lwt_GetFaceContainingPoint(LWT_TOPOLOGY* topo, const LWPOINT* pt)
   }
 
   /* Find on which side of the segment the query point lays */
-  if ( closestPointVertex != -1 )
+  if ( closestPointVertex != closestEdge->geom->points->npoints )
   {
     /* Closest point is a vertex of the closest segment */
     LWDEBUGF(1, "Closest point is vertex %d of closest segment", closestPointVertex);
@@ -7257,31 +7261,31 @@ lwt_GetFaceContainingPoint(LWT_TOPOLOGY* topo, const LWPOINT* pt)
      * means the query point is on the right)
      */
 
-    int prevVertexIndex = closestPointVertex > 0 ?
-      closestPointVertex - 1 :
-      closestEdge->geom->points->npoints - 2; /* last vertex would be == first vertex, this being a closed edge */
+    uint32_t prevVertexIndex = closestPointVertex > 0 ?
+      closestPointVertex - 1u :
+      closestEdge->geom->points->npoints - 2u; /* last vertex would be == first vertex, this being a closed edge */
 
     const POINT2D *prevVertex = getPoint2d_cp(
       closestEdge->geom->points,
       prevVertexIndex
     );
 
-    LWDEBUGF(1, "Previous vertex %d is POINT(%.15g %.15g)",
+    LWDEBUGF(1, "Previous vertex %u is POINT(%.15g %.15g)",
       prevVertexIndex,
       prevVertex->x,
       prevVertex->y
     );
 
-    int nextVertexIndex = closestPointVertex == closestEdge->geom->points->npoints - 1 ?
-      1 : /* first point would be == last point, this being a closed edge */
-      closestPointVertex + 1;
+    uint32_t nextVertexIndex = closestPointVertex == closestEdge->geom->points->npoints - 1u ?
+      1u : /* first point would be == last point, this being a closed edge */
+      closestPointVertex + 1u;
 
     const POINT2D *nextVertex = getPoint2d_cp(
       closestEdge->geom->points,
       nextVertexIndex
     );
 
-    LWDEBUGF(1, "Next vertex %d is POINT(%.15g %.15g)",
+    LWDEBUGF(1, "Next vertex %u is POINT(%.15g %.15g)",
       nextVertexIndex,
       nextVertex->x,
       nextVertex->y

-----------------------------------------------------------------------

Summary of changes:
 liblwgeom/lwgeom_topo.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list