Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StringTokenizer::peekNextToken #1025

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading