mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 16:33:31 +00:00
Use strtod instead of strtof because VC++ doesn't support it
This commit is contained in:
parent
e70fdc4c7d
commit
ce50d6bedc
@ -253,7 +253,7 @@ template<>
|
||||
float lexical_cast<float, const std::string&>(const std::string& a)
|
||||
{
|
||||
char* endptr;
|
||||
float res = strtof(a.c_str(), &endptr);
|
||||
float res = static_cast<float>(strtod(a.c_str(), &endptr));
|
||||
|
||||
if (a.empty() || *endptr != '\0') {
|
||||
throw bad_lexical_cast();
|
||||
@ -266,7 +266,7 @@ template<>
|
||||
float lexical_cast<float, const char*>(const char* a)
|
||||
{
|
||||
char* endptr;
|
||||
float res = strtof(a, &endptr);
|
||||
float res = static_cast<float>(strtod(a, &endptr));
|
||||
|
||||
if (*a == '\0' || *endptr != '\0') {
|
||||
throw bad_lexical_cast();
|
||||
@ -278,7 +278,7 @@ template<>
|
||||
float lexical_cast_default<float, const std::string&>(const std::string& a, float def)
|
||||
{
|
||||
char* endptr;
|
||||
float res = strtof(a.c_str(), &endptr);
|
||||
float res = static_cast<float>(strtod(a.c_str(), &endptr));
|
||||
|
||||
if (a.empty() || *endptr != '\0') {
|
||||
return def;;
|
||||
@ -291,7 +291,7 @@ template<>
|
||||
float lexical_cast_default<float, const char*>(const char* a, float def)
|
||||
{
|
||||
char* endptr;
|
||||
float res = strtof(a, &endptr);
|
||||
float res = static_cast<float>(strtod(a, &endptr));
|
||||
|
||||
if (*a == '\0' || *endptr != '\0') {
|
||||
return def;
|
||||
|
Loading…
x
Reference in New Issue
Block a user