Fixed second batch of locale-dependent calls

This commit is contained in:
Lukas Matena 2021-05-10 07:08:38 +02:00
parent 9ee2fc8275
commit fef385cd6b
13 changed files with 78 additions and 45 deletions

View file

@ -670,7 +670,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename)
std::string time_float_str = format_time_float(time_in_last_minute(it_stop->elapsed_time - it->elapsed_time));
std::string next_time_float_str = format_time_float(time_in_last_minute(it_stop->elapsed_time - next_it->elapsed_time));
is_last |= (std::stof(time_float_str) > 0.0f && std::stof(next_time_float_str) == 0.0f);
is_last |= (string_to_double_decimal_point(time_float_str) > 0. && string_to_double_decimal_point(next_time_float_str) == 0.);
}
if (is_last) {
@ -1373,7 +1373,7 @@ void GCodeProcessor::apply_config_simplify3d(const std::string& filename)
if (pos != cmt.npos) {
pos = cmt.find(',', pos);
if (pos != cmt.npos) {
out = std::stod(cmt.substr(pos + 1));
out = string_to_double_decimal_point(cmt.substr(pos+1));
return true;
}
}
@ -1523,9 +1523,9 @@ template<typename T>
else if constexpr (std::is_same_v<T, long>)
out = std::stol(str, &read);
else if constexpr (std::is_same_v<T, float>)
out = std::stof(str, &read);
out = string_to_double_decimal_point(str, &read);
else if constexpr (std::is_same_v<T, double>)
out = std::stod(str, &read);
out = string_to_double_decimal_point(str, &read);
return str.size() == read;
} catch (...) {
return false;

View file

@ -4,6 +4,7 @@
#include "../libslic3r.h"
#include "../PrintConfig.hpp"
#include "../LocalesUtils.hpp"
#include "PressureEqualizer.hpp"
@ -158,7 +159,7 @@ static inline int parse_int(const char *&line)
static inline float parse_float(const char *&line)
{
char *endptr = NULL;
float result = strtof(line, &endptr);
float result = string_to_double_decimal_point(line, &endptr);
if (endptr == NULL || !is_ws_or_eol(*endptr))
throw Slic3r::RuntimeError("PressureEqualizer: Error parsing a float");
line = endptr;