Skip to content

Commit 2ba4ccf

Browse files
committed
IniReader: Use old conversion API for GetReal
Lack of support in clang and older gcc versions
1 parent 475bfeb commit 2ba4ccf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/inireader.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,18 @@ long INIReader::GetInteger(std::string_view section, std::string_view name, long
124124

125125
double INIReader::GetReal(std::string_view section, std::string_view name, double default_value) const
126126
{
127+
std::string valstr = std::string(Get(section, name, ""));
128+
const char* value = valstr.c_str();
129+
char* end;
130+
double n = strtod(value, &end);
131+
return end > value ? n : default_value;
132+
/*
133+
// FIXME: std::from_chars<double> not supported by clang and old g++ versions
127134
std::string_view valstr = Get(section, name, "");
128135
double n;
129136
auto ec = std::from_chars(valstr.data(), valstr.data() + valstr.size(), n).ec;
130137
return ec == std::errc() ? n : default_value;
138+
*/
131139
}
132140

133141
bool INIReader::GetBoolean(std::string_view section, std::string_view name, bool default_value) const

0 commit comments

Comments
 (0)