[geos-commits] [SCM] GEOS branch master updated. 18be6c2dae08059ed901252d48ceefa1283b0c59

git at osgeo.org git at osgeo.org
Mon Nov 4 06:26:10 PST 2019


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  18be6c2dae08059ed901252d48ceefa1283b0c59 (commit)
       via  d82f245aac81e02c91fccafe93dbde04c4b1f188 (commit)
       via  3fc652822ef3a825784919423d636c9584dbd2ba (commit)
      from  eb4da1440836fedf503e1eb2c245595a0f33db5e (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 18be6c2dae08059ed901252d48ceefa1283b0c59
Author: Dan Baston <dbaston at isciences.com>
Date:   Mon Nov 4 09:24:48 2019 -0500

    Catch exception by reference

diff --git a/tests/unit/operation/geounion/CoverageUnionTest.cpp b/tests/unit/operation/geounion/CoverageUnionTest.cpp
index 2fed702..2312bfa 100644
--- a/tests/unit/operation/geounion/CoverageUnionTest.cpp
+++ b/tests/unit/operation/geounion/CoverageUnionTest.cpp
@@ -78,7 +78,7 @@ namespace tut {
         try {
             auto u1 = CoverageUnion::Union(coll.get());
             fail();
-        } catch(const geos::util::TopologyException e) {}
+        } catch(const geos::util::TopologyException & e) {}
     }
 
     template<>

commit d82f245aac81e02c91fccafe93dbde04c4b1f188
Merge: eb4da14 3fc6528
Author: Dan Baston <dbaston at isciences.com>
Date:   Mon Nov 4 09:23:43 2019 -0500

    Merge remote-tracking branch 'origin/trac-1002'


commit 3fc652822ef3a825784919423d636c9584dbd2ba
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Oct 23 21:07:23 2019 -0400

    Avoid access past end of vector
    
    In most configurations this access would be optimized out (as it is
    never used) but this is not always the case.
    
    Fixes #1002

diff --git a/src/index/chain/MonotoneChainBuilder.cpp b/src/index/chain/MonotoneChainBuilder.cpp
index be5836a..242a923 100644
--- a/src/index/chain/MonotoneChainBuilder.cpp
+++ b/src/index/chain/MonotoneChainBuilder.cpp
@@ -96,29 +96,28 @@ MonotoneChainBuilder::findChainEnd(const CoordinateSequence& pts, std::size_t st
     // (which is the starting quadrant)
     int chainQuad = Quadrant::quadrant(pts[safeStart],
                                        pts[safeStart + 1]);
-    std::size_t last = start + 1;
 
-    const Coordinate* prev = &pts[last-1]; // avoid repeated coordinate access by index (virtual call)
-    const Coordinate* curr = &pts[last];
+    const Coordinate* prev; // avoid repeated coordinate access by index (virtual call)
+    const Coordinate* curr = &pts[start];
+
+    for(size_t last = start + 1; last < npts; last++) {
+        prev = curr;
+        curr = &pts[last];
 
-    while(last < npts) {
         // skip zero-length segments, but include them in the chain
         if(!prev->equals2D(*curr)) {
             // compute quadrant for next possible segment in chain
             int quad = Quadrant::quadrant(*prev, *curr);
             if(quad != chainQuad) {
-                break;
+                return last - 1;
             }
         }
-        ++last;
-        prev = curr;
-        curr = &pts[last];
     }
 #if GEOS_DEBUG
     std::cerr << "MonotoneChainBuilder::findChainEnd() returning" << std::endl;
 #endif
 
-    return last - 1;
+    return npts - 1;
 }
 
 } // namespace geos.index.chain

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

Summary of changes:
 src/index/chain/MonotoneChainBuilder.cpp            | 17 ++++++++---------
 tests/unit/operation/geounion/CoverageUnionTest.cpp |  2 +-
 2 files changed, 9 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list