Skip to content

Commit

Permalink
Fix StringTokenizer::peekNextToken (#1025)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews authored Jan 14, 2024
1 parent 6f70b63 commit 8d87edc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fix DiscreteHausdorffDistance for LinearRing (GH-1000, Martin Davis)
- Fix IsSimpleOp for MultiPoint with empty element (GH-1005, Martin Davis)
- Fix PreparedPolygonContains for GC with MultiPoint (GH-1008, Martin Davis)
- Fix reading WKT with EMPTY token with white space (GH-1025, Mike Taves)

## Changes in 3.12.0
2023-06-27
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
10 changes: 10 additions & 0 deletions tests/unit/io/WKTReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,5 +462,15 @@ void object::test<23>
ensure(std::isnan(coords->getY(0)));
}

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

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

} // namespace tut

0 comments on commit 8d87edc

Please sign in to comment.