summaryrefslogtreecommitdiff
path: root/boost/geometry/io/wkt/read.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/io/wkt/read.hpp')
-rw-r--r--boost/geometry/io/wkt/read.hpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/boost/geometry/io/wkt/read.hpp b/boost/geometry/io/wkt/read.hpp
index 236690dc2c..9caa36cb47 100644
--- a/boost/geometry/io/wkt/read.hpp
+++ b/boost/geometry/io/wkt/read.hpp
@@ -517,11 +517,15 @@ inline bool initialize(tokenizer const& tokens,
{
it = tokens.begin();
end = tokens.end();
- if (it != end && boost::iequals(*it++, geometry_name))
+
+ if (it == end || ! boost::iequals(*it++, geometry_name))
{
- bool has_empty, has_z, has_m;
+ BOOST_THROW_EXCEPTION(read_wkt_exception(std::string("Should start with '") + geometry_name + "'", wkt));
+ }
- handle_empty_z_m(it, end, has_empty, has_z, has_m);
+ bool has_empty, has_z, has_m;
+
+ handle_empty_z_m(it, end, has_empty, has_z, has_m);
// Silence warning C4127: conditional expression is constant
#if defined(_MSC_VER)
@@ -529,25 +533,23 @@ inline bool initialize(tokenizer const& tokens,
#pragma warning(disable : 4127)
#endif
- if (has_z && dimension<Geometry>::type::value < 3)
- {
- BOOST_THROW_EXCEPTION(read_wkt_exception("Z only allowed for 3 or more dimensions", wkt));
- }
+ if (has_z && dimension<Geometry>::type::value < 3)
+ {
+ BOOST_THROW_EXCEPTION(read_wkt_exception("Z only allowed for 3 or more dimensions", wkt));
+ }
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
- if (has_empty)
- {
- check_end(it, end, wkt);
- return false;
- }
- // M is ignored at all.
-
- return true;
+ if (has_empty)
+ {
+ check_end(it, end, wkt);
+ return false;
}
- BOOST_THROW_EXCEPTION(read_wkt_exception(std::string("Should start with '") + geometry_name + "'", wkt));
+ // M is ignored at all.
+
+ return true;
}