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 64124d4 commit 14926fe
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 @@ -10,6 +10,7 @@ xxxx-xx-xx
- Fix IsSimpleOp for MultiPoint with empty element (GH-1005, Martin Davis)
- Fix PreparedPolygonContains for GC with MultiPoint (GH-1008, Martin Davis)
- Fix TopologyPreservingSimplifier to prevent jumping components (GH-1012, Martin Davis)
- Fix reading WKT with EMPTY token with white space (GH-1025, Mike Taves)

## Changes in 3.12.1
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 @@ -447,4 +447,15 @@ void object::test<22>
ensure_dimension("MULTIPOINT ZM ((0 0 4 3), (1 2 4 5))", true, true);
}

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

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

} // namespace tut

0 comments on commit 14926fe

Please sign in to comment.