Final std::ws skipping not needed when parsing block coordinates, and it makes is.fail() == true

master
proller 2016-02-10 22:52:35 +03:00 committed by Rogier
parent 22384eb9db
commit 3ffda4ab57
1 changed files with 1 additions and 2 deletions

View File

@ -7,7 +7,7 @@ void BlockPos::operator=(const std::string &s)
std::istringstream is(s);
if (isdigit(is.peek()) || is.peek() == '-' || is.peek() == '+') {
int64_t ipos;
is >> ipos >> std::ws;
is >> ipos;
if (is.fail() || !is.eof()) {
throw std::runtime_error(std::string("Failed to decode i64 (minetest) coordinate string from database (") + s + ")" );
}
@ -23,7 +23,6 @@ void BlockPos::operator=(const std::string &s)
is >> y();
is >> c2;
is >> z();
is >> std::ws;
if (is.fail() || !is.eof() || c1 != ',' || c2 != ',') {
throw std::runtime_error(std::string("Failed to decode axyz (freeminer) coordinate string from database (") + s + ")" );
}