[geos-commits] [SCM] GEOS branch master updated. f8f42a730f709a144d6f3193e9aa319775f8d3dc

git at osgeo.org git at osgeo.org
Tue Dec 8 16:07:30 PST 2020


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 "GEOS".

The branch, master has been updated
       via  f8f42a730f709a144d6f3193e9aa319775f8d3dc (commit)
       via  4396072d882ad213048ee95f65b2c399b76dc6cf (commit)
       via  ca0f29afa0194d448f90a51e95e948d230890e4f (commit)
       via  b3f8ed5252241b335c60fc868553afa322aba5ce (commit)
       via  29c6d4e1b374d200c9ab73c8d55ecfafe5135ce1 (commit)
      from  aceb9697b4a0d02a3f899eaf0346098c322932ef (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 f8f42a730f709a144d6f3193e9aa319775f8d3dc
Author: EC2 Default User <ec2-user at ip-172-31-55-124.us-west-2.compute.internal>
Date:   Tue Dec 8 23:14:28 2020 +0000

    Add fp-contract=off flag to builds to avoid precision mistakes in the double-double code

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9e2e32..60cb109 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -154,6 +154,21 @@ add_library(geos_cxx_flags INTERFACE)
 target_compile_features(geos_cxx_flags INTERFACE cxx_std_11)
 
 #-----------------------------------------------------------------------------
+# Add flags to prevent 'fused multiply-add' operations on targets (ARM64)
+# that allow it, as it breaks calculations in DD.cpp. 
+# TODO: Replace DD calculations with 'long float' where target supports
+# true long float, and remove other cases where FMA causes regression
+# failures.
+#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98207
+#-----------------------------------------------------------------------------
+
+target_compile_options(geos_cxx_flags INTERFACE 
+	"$<$<CXX_COMPILER_ID:Clang>:-ffp-contract=off>"
+	"$<$<CXX_COMPILER_ID:GNU>:-ffp-contract=off>"
+	"$<$<CXX_COMPILER_ID:MSVC>:/fp:precise>"
+	)
+	
+#-----------------------------------------------------------------------------
 # Target geos_cxx_flags: common compilation flags
 #-----------------------------------------------------------------------------
 option(DISABLE_GEOS_INLINE "Disable inlining" OFF)
diff --git a/configure.ac b/configure.ac
index 472253b..9d0b772 100644
--- a/configure.ac
+++ b/configure.ac
@@ -195,22 +195,33 @@ dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP()
 dnl
 AC_LIBTOOL_LANG_CXX_CONFIG
 
-# Set default AM_CXXFLAGS and AM_CFLAGS
-# -pedantic: ISO does not support long long
-# we add -Wno-long-long to avoid those messages
+dnl Set default AM_CXXFLAGS and AM_CFLAGS
+dnl -pedantic: ISO does not support long long
+dnl we add -Wno-long-long to avoid those messages
 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_wno_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
 
-# To make numerical computation more stable, we use --ffloat-store
-# on 32-bit platforms
+dnl -----------------------------------------------------------------------------
+dnl To make numerical computation more stable, we use --ffloat-store
+dnl on 32-bit platforms
 NUMERICFLAGS=""
-# 32-bit platforms have a 4-byte pointer
+dnl 32-bit platforms have a 4-byte pointer
 AC_CHECK_SIZEOF([void *])
 if test $ac_cv_sizeof_void_p -eq 4 ; then
   AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
 fi
 
+dnl -----------------------------------------------------------------------------
+dnl Add flags to prevent 'fused multiply-add' operations on targets (ARM64)
+dnl that allow it, as it breaks calculations in math/DD.cpp.
+dnl TODO: Replace DD calculations with 'long float' where target supports
+dnl true long float, and remove other cases where FMA causes regression
+dnl failures.
+dnl     https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98207
+NUMERICFLAGS="$NUMERICFLAGS -ffp-contract=off"
+
+dnl -----------------------------------------------------------------------------
 HUSHWARNING="-DUSE_UNSTABLE_GEOS_CPP_API"
 DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS} ${HUSHWARNING} ${OVERLAYNG_FLAGS}"
 

commit 4396072d882ad213048ee95f65b2c399b76dc6cf
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Dec 8 14:26:59 2020 -0800

    Quiet compiler warnings

diff --git a/include/geos/geomgraph/EdgeEndStar.h b/include/geos/geomgraph/EdgeEndStar.h
index 054ddc2..6aae885 100644
--- a/include/geos/geomgraph/EdgeEndStar.h
+++ b/include/geos/geomgraph/EdgeEndStar.h
@@ -123,7 +123,7 @@ public:
 
     virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
 
-    virtual void propagateSideLabels(int geomIndex);
+    virtual void propagateSideLabels(uint32_t geomIndex);
     // throw(TopologyException *);
 
     //virtual int findIndex(EdgeEnd *eSearch);
@@ -150,7 +150,7 @@ protected:
 
 private:
 
-    virtual geom::Location getLocation(int geomIndex,
+    virtual geom::Location getLocation(uint32_t geomIndex,
                                        const geom::Coordinate& p,
                                        std::vector<GeometryGraph*>* geom);
 
@@ -162,7 +162,7 @@ private:
 
     virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
 
-    virtual bool checkAreaLabelsConsistent(int geomIndex);
+    virtual bool checkAreaLabelsConsistent(uint32_t geomIndex);
 
 };
 
diff --git a/include/geos/util/GeometricShapeFactory.h b/include/geos/util/GeometricShapeFactory.h
index 776aa13..f87cf5d 100644
--- a/include/geos/util/GeometricShapeFactory.h
+++ b/include/geos/util/GeometricShapeFactory.h
@@ -85,7 +85,7 @@ protected:
     const geom::GeometryFactory* geomFact; // externally owned
     const geom::PrecisionModel* precModel; // externally owned
     Dimensions dim;
-    int nPts;
+    uint32_t nPts;
 
     geom::Coordinate coord(double x, double y) const;
 
@@ -171,7 +171,7 @@ public:
     /**
      * \brief Sets the total number of points in the created Geometry
      */
-    void setNumPoints(int nNPts);
+    void setNumPoints(uint32_t nNPts);
 
     /**
      * \brief
diff --git a/src/algorithm/Orientation.cpp b/src/algorithm/Orientation.cpp
index e490e4b..383f36a 100644
--- a/src/algorithm/Orientation.cpp
+++ b/src/algorithm/Orientation.cpp
@@ -45,12 +45,13 @@ bool
 Orientation::isCCW(const geom::CoordinateSequence* ring)
 {
     // # of points without closing endpoint
-    int nPts = static_cast<int>(ring->size()) - 1;
+    int inPts = static_cast<int>(ring->size()) - 1;
     // sanity check
-    if (nPts < 3)
+    if (inPts < 3)
         throw util::IllegalArgumentException(
             "Ring has fewer than 4 points, so orientation cannot be determined");
 
+    uint32_t nPts = static_cast<uint32_t>(inPts);
     /**
      * Find first highest point after a lower point, if one exists
      * (e.g. a rising segment)
diff --git a/src/geom/Polygon.cpp b/src/geom/Polygon.cpp
index 9c3a300..903ef82 100644
--- a/src/geom/Polygon.cpp
+++ b/src/geom/Polygon.cpp
@@ -473,7 +473,7 @@ Polygon::isRectangle() const
 
     // check vertices have correct values
     const Envelope& env = *getEnvelopeInternal();
-    for(int i = 0; i < 5; i++) {
+    for(uint32_t i = 0; i < 5; i++) {
         double x = seq.getX(i);
         if(!(x == env.getMinX() || x == env.getMaxX())) {
             return false;
diff --git a/src/geomgraph/Depth.cpp b/src/geomgraph/Depth.cpp
index 4cfbed7..fe497fa 100644
--- a/src/geomgraph/Depth.cpp
+++ b/src/geomgraph/Depth.cpp
@@ -68,8 +68,8 @@ Depth::normalize()
 void
 Depth::add(const Label& lbl)
 {
-    for(int i = 0; i < 2; i++) {
-        for(int j = 1; j < 3; j++) {
+    for(uint32_t i = 0; i < 2; i++) {
+        for(uint32_t j = 1; j < 3; j++) {
             Location loc = lbl.getLocation(i, j);
             if(loc == Location::EXTERIOR || loc == Location::INTERIOR) {
                 // initialize depth if it is null, otherwise
diff --git a/src/geomgraph/DirectedEdge.cpp b/src/geomgraph/DirectedEdge.cpp
index 295937b..1400a0a 100644
--- a/src/geomgraph/DirectedEdge.cpp
+++ b/src/geomgraph/DirectedEdge.cpp
@@ -151,7 +151,7 @@ bool
 DirectedEdge::isInteriorAreaEdge()
 {
     bool p_isInteriorAreaEdge = true;
-    for(int i = 0; i < 2; i++) {
+    for(uint32_t i = 0; i < 2; i++) {
         if(!(label.isArea(i)
                 && label.getLocation(i, Position::LEFT) == Location::INTERIOR
                 && label.getLocation(i, Position::RIGHT) == Location::INTERIOR)) {
diff --git a/src/geomgraph/DirectedEdgeStar.cpp b/src/geomgraph/DirectedEdgeStar.cpp
index 62326a7..41cc490 100644
--- a/src/geomgraph/DirectedEdgeStar.cpp
+++ b/src/geomgraph/DirectedEdgeStar.cpp
@@ -148,7 +148,7 @@ DirectedEdgeStar::computeLabelling(std::vector<GeometryGraph*>* geom)
         Edge* e = ee->getEdge();
         assert(e);
         const Label& eLabel = e->getLabel();
-        for(int i = 0; i < 2; ++i) {
+        for(uint32_t i = 0; i < 2; ++i) {
             Location eLoc = eLabel.getLocation(i);
             if(eLoc == Location::INTERIOR || eLoc == Location::BOUNDARY) {
                 label.setLocation(i, Location::INTERIOR);
diff --git a/src/geomgraph/EdgeEndStar.cpp b/src/geomgraph/EdgeEndStar.cpp
index f1c70f2..d1de587 100644
--- a/src/geomgraph/EdgeEndStar.cpp
+++ b/src/geomgraph/EdgeEndStar.cpp
@@ -161,7 +161,7 @@ EdgeEndStar::computeLabelling(std::vector<GeometryGraph*>* geomGraph)
         EdgeEnd* e = *it;
         assert(e);
         Label& label = e->getLabel();
-        for(int geomi = 0; geomi < 2; ++geomi) {
+        for(uint32_t geomi = 0; geomi < 2; ++geomi) {
             if(label.isAnyNull(geomi)) {
                 Location loc = Location::NONE;
                 if(hasDimensionalCollapseEdge[geomi]) {
@@ -192,7 +192,7 @@ EdgeEndStar::computeEdgeEndLabels(
 
 /*public*/
 Location
-EdgeEndStar::getLocation(int geomIndex,
+EdgeEndStar::getLocation(uint32_t geomIndex,
                          const Coordinate& p, std::vector<GeometryGraph*>* geom)
 {
     // compute location only on demand
@@ -213,7 +213,7 @@ EdgeEndStar::isAreaLabelsConsistent(const GeometryGraph& geomGraph)
 
 /*private*/
 bool
-EdgeEndStar::checkAreaLabelsConsistent(int geomIndex)
+EdgeEndStar::checkAreaLabelsConsistent(uint32_t geomIndex)
 {
     // Since edges are stored in CCW order around the node,
     // As we move around the ring we move from the right to
@@ -262,7 +262,7 @@ EdgeEndStar::checkAreaLabelsConsistent(int geomIndex)
 
 /*public*/
 void
-EdgeEndStar::propagateSideLabels(int geomIndex)
+EdgeEndStar::propagateSideLabels(uint32_t geomIndex)
 //throw(TopologyException *)
 {
     // Since edges are stored in CCW order around the node,
diff --git a/src/util/GeometricShapeFactory.cpp b/src/util/GeometricShapeFactory.cpp
index 3d9b234..af15880 100644
--- a/src/util/GeometricShapeFactory.cpp
+++ b/src/util/GeometricShapeFactory.cpp
@@ -58,7 +58,7 @@ GeometricShapeFactory::setCentre(const Coordinate& centre)
 }
 
 void
-GeometricShapeFactory::setNumPoints(int nNPts)
+GeometricShapeFactory::setNumPoints(uint32_t nNPts)
 {
     nPts = nNPts;
 }
@@ -86,7 +86,7 @@ GeometricShapeFactory::createRectangle()
 {
     int i;
     int ipt = 0;
-    int nSide = nPts / 4;
+    uint32_t nSide = nPts / 4;
     if(nSide < 1) {
         nSide = 1;
     }

commit ca0f29afa0194d448f90a51e95e948d230890e4f
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Dec 8 14:09:49 2020 -0800

    Quite compiler warnings

diff --git a/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp b/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp
index f86f0c6..70b1a9f 100644
--- a/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp
+++ b/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp
@@ -65,7 +65,7 @@ int main(int argc, char** argv) {
     auto num_lines = std::atol(argv[1]);
     auto num_reps = argc > 2 ? std::atol(argv[2]) : 1;
 
-    for (int i = 0; i < num_reps; i++) {
+    for (std::size_t i = 0; i < num_reps; i++) {
         tester.test(num_lines);
     }
-}
\ No newline at end of file
+}
diff --git a/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp b/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp
index f010948..4665748 100644
--- a/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp
+++ b/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp
@@ -87,7 +87,7 @@ int main(int argc, char** argv) {
 
     GEOSPreparedContainsPerfTest tester;
 
-    int n = std::atoi(argv[2]);
+    std::size_t n = static_cast<std::size_t>(std::atoi(argv[2]));
     std::cout << "Performing " << n << " point-in-polygon tests." << std::endl;
 
     std::string fname{argv[1]};
diff --git a/tests/bigtest/GeometryTestFactory.cpp b/tests/bigtest/GeometryTestFactory.cpp
index ca7f337..56bccf0 100644
--- a/tests/bigtest/GeometryTestFactory.cpp
+++ b/tests/bigtest/GeometryTestFactory.cpp
@@ -70,7 +70,7 @@ GeometryTestFactory::createBox(double minx, double miny, int nSide, double segLe
  * @param nPts the number of points in the star
  */
 CoordinateSequence*
-GeometryTestFactory::createCircle(double basex, double basey, double size, int nPts)
+GeometryTestFactory::createCircle(double basex, double basey, double size, uint32_t nPts)
 {
     CoordinateArraySequence* pts = new CoordinateArraySequence(nPts + 1);
     double len = size / 2.0;
@@ -86,7 +86,7 @@ GeometryTestFactory::createCircle(double basex, double basey, double size, int n
 }
 
 Polygon*
-GeometryTestFactory::createCircle(GeometryFactory* fact, double basex, double basey, double size, int nPts)
+GeometryTestFactory::createCircle(GeometryFactory* fact, double basex, double basey, double size, uint32_t nPts)
 {
     CoordinateSequence* pts = createCircle(basex, basey, size, nPts);
     return fact->createPolygon(fact->createLinearRing(pts), nullptr);
diff --git a/tests/bigtest/bigtest.h b/tests/bigtest/bigtest.h
index dcc2924..b4e24af 100644
--- a/tests/bigtest/bigtest.h
+++ b/tests/bigtest/bigtest.h
@@ -35,8 +35,8 @@ class GeometryTestFactory {
 public:
     static geom::Polygon* createBox(geom::GeometryFactory* fact, double minx, double miny, int nSide, double segLen);
     static geom::CoordinateSequence* createBox(double minx, double miny, int nSide, double segLen);
-    static geom::CoordinateSequence* createCircle(double basex, double basey, double size, int nPts);
-    static geom::Polygon* createCircle(geom::GeometryFactory* fact, double basex, double basey, double size, int nPts);
+    static geom::CoordinateSequence* createCircle(double basex, double basey, double size, uint32_t nPts);
+    static geom::Polygon* createCircle(geom::GeometryFactory* fact, double basex, double basey, double size, uint32_t nPts);
     static geom::CoordinateSequence* createSineStar(double basex, double basey, double size, double armLen, int nArms,
             int nPts);
     static geom::Polygon* createSineStar(geom::GeometryFactory* fact, double basex, double basey, double size,

commit b3f8ed5252241b335c60fc868553afa322aba5ce
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Dec 8 14:04:54 2020 -0800

    Remove more CI warnings

diff --git a/include/geos/geomgraph/Label.h b/include/geos/geomgraph/Label.h
index c554a02..cda32dd 100644
--- a/include/geos/geomgraph/Label.h
+++ b/include/geos/geomgraph/Label.h
@@ -148,7 +148,7 @@ public:
 
     bool isLine(uint32_t geomIndex) const;
 
-    bool isEqualOnSide(const Label& lbl, int side) const;
+    bool isEqualOnSide(const Label& lbl, uint32_t side) const;
 
     bool allPositionsEqual(uint32_t geomIndex, geom::Location loc) const;
 
diff --git a/include/geos/geomgraph/Label.inl b/include/geos/geomgraph/Label.inl
index 1cb7ad6..999f430 100644
--- a/include/geos/geomgraph/Label.inl
+++ b/include/geos/geomgraph/Label.inl
@@ -34,7 +34,7 @@ INLINE Label
 Label::toLineLabel(const Label& label)
 {
     Label lineLabel(geom::Location::NONE);
-    for(int i = 0; i < 2; i++) {
+    for(uint32_t i = 0; i < 2; i++) {
         lineLabel.setLocation(i, label.getLocation(i));
     }
     return lineLabel;
@@ -52,7 +52,7 @@ INLINE
 Label::Label(uint32_t geomIndex, geom::Location onLoc) :
     elt{TopologyLocation(geom::Location::NONE), TopologyLocation(geom::Location::NONE)}
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     elt[geomIndex].setLocation(onLoc);
 }
 
@@ -230,7 +230,7 @@ Label::isLine(uint32_t geomIndex) const
 
 /*public*/
 INLINE bool
-Label::isEqualOnSide(const Label& lbl, int side) const
+Label::isEqualOnSide(const Label& lbl, uint32_t side) const
 {
     return elt[0].isEqualOnSide(lbl.elt[0], side)
             && elt[1].isEqualOnSide(lbl.elt[1], side);
diff --git a/include/geos/geomgraph/TopologyLocation.h b/include/geos/geomgraph/TopologyLocation.h
index f9e9664..4cbbacb 100644
--- a/include/geos/geomgraph/TopologyLocation.h
+++ b/include/geos/geomgraph/TopologyLocation.h
@@ -96,7 +96,7 @@ public:
      */
     bool isAnyNull() const;
 
-    bool isEqualOnSide(const TopologyLocation& le, std::size_t locIndex) const;
+    bool isEqualOnSide(const TopologyLocation& le, uint32_t locIndex) const;
 
     bool isArea() const;
 
diff --git a/include/geos/geomgraph/TopologyLocation.inl b/include/geos/geomgraph/TopologyLocation.inl
index 55af297..5852428 100644
--- a/include/geos/geomgraph/TopologyLocation.inl
+++ b/include/geos/geomgraph/TopologyLocation.inl
@@ -105,7 +105,7 @@ TopologyLocation::isAnyNull() const
 
 /*public*/
 INLINE bool
-TopologyLocation::isEqualOnSide(const TopologyLocation& le, std::size_t locIndex) const
+TopologyLocation::isEqualOnSide(const TopologyLocation& le, uint32_t locIndex) const
 {
     return location[locIndex] == le.location[locIndex];
 }

commit 29c6d4e1b374d200c9ab73c8d55ecfafe5135ce1
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Dec 8 13:49:12 2020 -0800

    Quiet some compiler warnings

diff --git a/include/geos/algorithm/LineIntersector.h b/include/geos/algorithm/LineIntersector.h
index b9b9c03..b38c0a8 100644
--- a/include/geos/algorithm/LineIntersector.h
+++ b/include/geos/algorithm/LineIntersector.h
@@ -298,8 +298,8 @@ private:
 
     void computeIntLineIndex(size_t segmentIndex);
 
-    int computeCollinearIntersection(const geom::Coordinate& p1, const geom::Coordinate& p2,
-                                     const geom::Coordinate& q1, const geom::Coordinate& q2);
+    uint8_t computeCollinearIntersection(const geom::Coordinate& p1, const geom::Coordinate& p2,
+                                         const geom::Coordinate& q1, const geom::Coordinate& q2);
 
     /** \brief
      * This method computes the actual value of the intersection point.
diff --git a/include/geos/geomgraph/Label.h b/include/geos/geomgraph/Label.h
index 065703a..c554a02 100644
--- a/include/geos/geomgraph/Label.h
+++ b/include/geos/geomgraph/Label.h
@@ -81,7 +81,7 @@ public:
      * Other geometry location will be set to
      * Location::NONE.
      */
-    Label(int geomIndex, geom::Location onLoc);
+    Label(uint32_t geomIndex, geom::Location onLoc);
 
     /** \brief
      * Construct a Label with On, Left and Right locations for both Geometries.
@@ -108,21 +108,21 @@ public:
      * Initialize the locations for the other Geometry to
      * Location::NONE
      */
-    Label(int geomIndex, geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc);
+    Label(uint32_t geomIndex, geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc);
 
     void flip();
 
-    geom::Location getLocation(int geomIndex, int posIndex) const;
+    geom::Location getLocation(uint32_t geomIndex, uint32_t posIndex) const;
 
-    geom::Location getLocation(int geomIndex) const;
+    geom::Location getLocation(uint32_t geomIndex) const;
 
-    void setLocation(int geomIndex, int posIndex, geom::Location location);
+    void setLocation(uint32_t geomIndex, uint32_t posIndex, geom::Location location);
 
-    void setLocation(int geomIndex, geom::Location location);
+    void setLocation(uint32_t geomIndex, geom::Location location);
 
-    void setAllLocations(int geomIndex, geom::Location location);
+    void setAllLocations(uint32_t geomIndex, geom::Location location);
 
-    void setAllLocationsIfNull(int geomIndex, geom::Location location);
+    void setAllLocationsIfNull(uint32_t geomIndex, geom::Location location);
 
     void setAllLocationsIfNull(geom::Location location);
 
@@ -138,24 +138,24 @@ public:
 
     bool isNull() const;
 
-    bool isNull(int geomIndex) const;
+    bool isNull(uint32_t geomIndex) const;
 
-    bool isAnyNull(int geomIndex) const;
+    bool isAnyNull(uint32_t geomIndex) const;
 
     bool isArea() const;
 
-    bool isArea(int geomIndex) const;
+    bool isArea(uint32_t geomIndex) const;
 
-    bool isLine(int geomIndex) const;
+    bool isLine(uint32_t geomIndex) const;
 
     bool isEqualOnSide(const Label& lbl, int side) const;
 
-    bool allPositionsEqual(int geomIndex, geom::Location loc) const;
+    bool allPositionsEqual(uint32_t geomIndex, geom::Location loc) const;
 
     /** \brief
      * Converts one GeometryLocation to a Line location
      */
-    void toLine(int geomIndex);
+    void toLine(uint32_t geomIndex);
 
     std::string toString() const;
 
diff --git a/include/geos/geomgraph/Label.inl b/include/geos/geomgraph/Label.inl
index eb1c614..1cb7ad6 100644
--- a/include/geos/geomgraph/Label.inl
+++ b/include/geos/geomgraph/Label.inl
@@ -49,7 +49,7 @@ Label::Label(geom::Location onLoc) :
 
 /*public*/
 INLINE
-Label::Label(int geomIndex, geom::Location onLoc) :
+Label::Label(uint32_t geomIndex, geom::Location onLoc) :
     elt{TopologyLocation(geom::Location::NONE), TopologyLocation(geom::Location::NONE)}
 {
     assert(geomIndex >= 0 && geomIndex < 2);
@@ -88,7 +88,7 @@ Label::operator=(const Label& l)
 
 /*public*/
 INLINE
-Label::Label(int geomIndex, geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc)
+Label::Label(uint32_t geomIndex, geom::Location onLoc, geom::Location leftLoc, geom::Location rightLoc)
 {
     elt[0] = TopologyLocation(geom::Location::NONE, geom::Location::NONE, geom::Location::NONE);
     elt[1] = TopologyLocation(geom::Location::NONE, geom::Location::NONE, geom::Location::NONE);
@@ -105,49 +105,49 @@ Label::flip()
 
 /*public*/
 INLINE geom::Location
-Label::getLocation(int geomIndex, int posIndex) const
+Label::getLocation(uint32_t geomIndex, uint32_t posIndex) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].get(posIndex);
 }
 
 /*public*/
 INLINE geom::Location
-Label::getLocation(int geomIndex) const
+Label::getLocation(uint32_t geomIndex) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].get(Position::ON);
 }
 
 /*public*/
 INLINE void
-Label::setLocation(int geomIndex, int posIndex, geom::Location location)
+Label::setLocation(uint32_t geomIndex, uint32_t posIndex, geom::Location location)
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     elt[geomIndex].setLocation(posIndex, location);
 }
 
 /*public*/
 INLINE void
-Label::setLocation(int geomIndex, geom::Location location)
+Label::setLocation(uint32_t geomIndex, geom::Location location)
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     elt[geomIndex].setLocation(Position::ON, location);
 }
 
 /*public*/
 INLINE void
-Label::setAllLocations(int geomIndex, geom::Location location)
+Label::setAllLocations(uint32_t geomIndex, geom::Location location)
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     elt[geomIndex].setAllLocations(location);
 }
 
 /*public*/
 INLINE void
-Label::setAllLocationsIfNull(int geomIndex, geom::Location location)
+Label::setAllLocationsIfNull(uint32_t geomIndex, geom::Location location)
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     elt[geomIndex].setAllLocationsIfNull(location);
 }
 
@@ -184,9 +184,9 @@ Label::getGeometryCount() const
 
 /*public*/
 INLINE bool
-Label::isNull(int geomIndex) const
+Label::isNull(uint32_t geomIndex) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].isNull();
 }
 
@@ -199,9 +199,9 @@ Label::isNull() const
 
 /*public*/
 INLINE bool
-Label::isAnyNull(int geomIndex) const
+Label::isAnyNull(uint32_t geomIndex) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].isAnyNull();
 }
 
@@ -214,17 +214,17 @@ Label::isArea() const
 
 /*public*/
 INLINE bool
-Label::isArea(int geomIndex) const
+Label::isArea(uint32_t geomIndex) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].isArea();
 }
 
 /*public*/
 INLINE bool
-Label::isLine(int geomIndex) const
+Label::isLine(uint32_t geomIndex) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].isLine();
 }
 
@@ -238,17 +238,17 @@ Label::isEqualOnSide(const Label& lbl, int side) const
 
 /*public*/
 INLINE bool
-Label::allPositionsEqual(int geomIndex, geom::Location loc) const
+Label::allPositionsEqual(uint32_t geomIndex, geom::Location loc) const
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     return elt[geomIndex].allPositionsEqual(loc);
 }
 
 /*public*/
 INLINE void
-Label::toLine(int geomIndex)
+Label::toLine(uint32_t geomIndex)
 {
-    assert(geomIndex >= 0 && geomIndex < 2);
+    assert(geomIndex < 2);
     if(elt[geomIndex].isArea()) {
         elt[geomIndex] = TopologyLocation(elt[geomIndex].getLocations()[0]);
     }
diff --git a/include/geos/geomgraph/TopologyLocation.h b/include/geos/geomgraph/TopologyLocation.h
index 046f08f..f9e9664 100644
--- a/include/geos/geomgraph/TopologyLocation.h
+++ b/include/geos/geomgraph/TopologyLocation.h
@@ -96,7 +96,7 @@ public:
      */
     bool isAnyNull() const;
 
-    bool isEqualOnSide(const TopologyLocation& le, int locIndex) const;
+    bool isEqualOnSide(const TopologyLocation& le, std::size_t locIndex) const;
 
     bool isArea() const;
 
diff --git a/include/geos/geomgraph/TopologyLocation.inl b/include/geos/geomgraph/TopologyLocation.inl
index 2dd2677..55af297 100644
--- a/include/geos/geomgraph/TopologyLocation.inl
+++ b/include/geos/geomgraph/TopologyLocation.inl
@@ -105,7 +105,7 @@ TopologyLocation::isAnyNull() const
 
 /*public*/
 INLINE bool
-TopologyLocation::isEqualOnSide(const TopologyLocation& le, int locIndex) const
+TopologyLocation::isEqualOnSide(const TopologyLocation& le, std::size_t locIndex) const
 {
     return location[locIndex] == le.location[locIndex];
 }
diff --git a/src/algorithm/LineIntersector.cpp b/src/algorithm/LineIntersector.cpp
index 6f9d101..388431d 100644
--- a/src/algorithm/LineIntersector.cpp
+++ b/src/algorithm/LineIntersector.cpp
@@ -256,7 +256,7 @@ LineIntersector::interpolateZ(const Coordinate& p,
 
     //double zgap = fabs(p2.z - p1.z);
     double zgap = p2.z - p1.z;
-    if(! zgap) {
+    if(zgap == 0.0) {
 #if GEOS_DEBUG
         cerr << " no zgap, returning " << p2.z << endl;
 #endif
@@ -471,7 +471,7 @@ LineIntersector::computeIntersect(const Coordinate& p1, const Coordinate& p2,
 }
 
 /*private*/
-int
+uint8_t
 LineIntersector::computeCollinearIntersection(const Coordinate& p1, const Coordinate& p2,
                                               const Coordinate& q1, const Coordinate& q2)
 {
diff --git a/src/algorithm/Orientation.cpp b/src/algorithm/Orientation.cpp
index 6fc701c..e490e4b 100644
--- a/src/algorithm/Orientation.cpp
+++ b/src/algorithm/Orientation.cpp
@@ -65,8 +65,8 @@ Orientation::isCCW(const geom::CoordinateSequence* ring)
     geom::Coordinate upLowPt;
     upLowPt.setNull();
     // const geom::Coordinate& upLowPt = nullptr;
-    int iUpHi = 0;
-    for (int i = 1; i <= nPts; i++) {
+    uint32_t iUpHi = 0;
+    for (uint32_t i = 1; i <= nPts; i++) {
         double py = ring->getY(i);
         /**
         * If segment is upwards and endpoint is higher, record it
@@ -88,13 +88,13 @@ Orientation::isCCW(const geom::CoordinateSequence* ring)
      * (e.g. a falling segment).
      * This must exist since ring is not flat.
      */
-    int iDownLow = iUpHi;
+    uint32_t iDownLow = iUpHi;
     do {
         iDownLow = (iDownLow + 1) % nPts;
     } while (iDownLow != iUpHi && ring->getY(iDownLow) == upHiPt.y );
 
     const geom::Coordinate& downLowPt = ring->getAt(iDownLow);
-    int iDownHi = iDownLow > 0 ? iDownLow - 1 : nPts - 1;
+    uint32_t iDownHi = iDownLow > 0 ? iDownLow - 1 : nPts - 1;
     const geom::Coordinate& downHiPt = ring->getAt(iDownHi);
 
     /**
diff --git a/tests/unit/utility.h b/tests/unit/utility.h
index 7fa2ea2..08f14e1 100644
--- a/tests/unit/utility.h
+++ b/tests/unit/utility.h
@@ -121,8 +121,8 @@ ensure_equals_geometry(T1 const* lhs, T2 const* rhs)
 {
     assert(0 != lhs);
     assert(0 != rhs);
-
     assert(!"DIFFERENT TYPES ARE NOT OF THE SAME STRUCTURE");
+    ensure(lhs != 0 && rhs != 0 && lhs != rhs);
 }
 
 template <typename T>
@@ -265,7 +265,7 @@ ensure_equals_dims(const geos::geom::CoordinateSequence *seq1,
         }
         else
         {
-            if ( tolerance )
+            if ( tolerance > 0.0 )
                 ensure_distance( val1, val2, tolerance );
             else
                 ensure_equals( val1, val2 );

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

Summary of changes:
 CMakeLists.txt                                     | 15 ++++++
 .../algorithm/UnaryUnionSegmentsPerfTest.cpp       |  4 +-
 benchmarks/capi/GEOSPreparedContainsPerfTest.cpp   |  2 +-
 configure.ac                                       | 23 ++++++---
 include/geos/algorithm/LineIntersector.h           |  4 +-
 include/geos/geomgraph/EdgeEndStar.h               |  6 +--
 include/geos/geomgraph/Label.h                     | 30 +++++------
 include/geos/geomgraph/Label.inl                   | 58 +++++++++++-----------
 include/geos/geomgraph/TopologyLocation.h          |  2 +-
 include/geos/geomgraph/TopologyLocation.inl        |  2 +-
 include/geos/util/GeometricShapeFactory.h          |  4 +-
 src/algorithm/LineIntersector.cpp                  |  4 +-
 src/algorithm/Orientation.cpp                      | 13 ++---
 src/geom/Polygon.cpp                               |  2 +-
 src/geomgraph/Depth.cpp                            |  4 +-
 src/geomgraph/DirectedEdge.cpp                     |  2 +-
 src/geomgraph/DirectedEdgeStar.cpp                 |  2 +-
 src/geomgraph/EdgeEndStar.cpp                      |  8 +--
 src/util/GeometricShapeFactory.cpp                 |  4 +-
 tests/bigtest/GeometryTestFactory.cpp              |  4 +-
 tests/bigtest/bigtest.h                            |  4 +-
 tests/unit/utility.h                               |  4 +-
 22 files changed, 114 insertions(+), 87 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list