Skip to content

Commit

Permalink
Fix StringTokenizer::peekNextToken (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Jan 14, 2024
1 parent e2d9909 commit 2d2febc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ xxxx-xx-xx
- Fix DiscreteHausdorffDistance for LinearRing (GH-1000, Martin Davis)
- PointOnSurface crashes with a collection containing a empty linestring (GH-1002, Paul Ramsey)
- Fix IsSimpleOp for MultiPoint with empty element (GH-1005, Martin Davis)
- Fix reading WKT with EMPTY token with white space (GH-1025, Mike Taves)

## Changes in 3.11.3
2023-11-11
Expand Down
6 changes: 2 additions & 4 deletions src/io/StringTokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ StringTokenizer::peekNextToken()
return str[pos];
}

// It's either a Number or a Word, let's
// see when it ends

pos = str.find_first_of("\n\r\t() ,", static_cast<string::size_type>(iter - str.begin()));
// It's either a Number or a Word, let's see when it ends
pos = str.find_first_of("\n\r\t() ,", pos + 1);

if(pos == string::npos) {
if(iter != str.end()) {
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/io/WKTReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,15 @@ void object::test<13>



// EMPTY token with some white space
template<>
template<>
void object::test<14>
()
{
GeomPtr geom(wktreader.read("MULTIPOINT( EMPTY, (10 10), (20 20))"));

ensure_equals(geom->getNumGeometries(), 3u);
}

} // namespace tut

0 comments on commit 2d2febc

Please sign in to comment.