From e3d84407e0412c2fcc9e81dbb540b2872a37300b Mon Sep 17 00:00:00 2001 From: bubnikv <bubnikv@gmail.com> Date: Thu, 17 May 2018 10:30:20 +0200 Subject: [PATCH] Fix of https://github.com/prusa3d/Slic3r/issues/896 Fixed a bug in parsering a Point from a config file. --- xs/src/libslic3r/Config.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index 14050c6cc..bde1eb651 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -644,12 +644,9 @@ public: bool deserialize(const std::string &str, bool append = false) override { UNUSED(append); - std::istringstream iss(str); - iss >> this->value.x; - iss.ignore(std::numeric_limits<std::streamsize>::max(), ','); - iss.ignore(std::numeric_limits<std::streamsize>::max(), 'x'); - iss >> this->value.y; - return true; + char dummy; + return sscanf(str.data(), " %lf , %lf %c", &this->value.x, &this->value.y, &dummy) == 2 || + sscanf(str.data(), " %lf x %lf %c", &this->value.x, &this->value.y, &dummy) == 2; } };