[Summary] This part of code worker incorrectly on Windows:

atof() on Windows expects "," (comma) as float delimeter and ignores "." (dot). So on windows atof("0.1") would return 0.
Unlike MAC.

Proposed fix should work on all platforms.
This commit is contained in:
Greg Zharun 2015-01-08 15:39:58 +02:00
parent 85bcda2a6e
commit 31a9cefa57

View file

@ -49,7 +49,15 @@ xml_property (const XMLNode &node, const char *prop_name, const XMLNodeMap& styl
if (property.empty()) {
return default_value;
}
return atof(property.c_str());
// get float value from string
double value;
std::istringstream ss (property);
// set classic locale with "." float delimeter as default
ss.imbue(std::locale("C"));
ss >> value;
return value;
}
double