From db49efd72f65cf7d0470ea6b185ff5e9d24ee203 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 1 Nov 2015 19:44:15 -0500 Subject: [PATCH] C++11: Migrated from strtod to std::stod --- src/Config.cpp | 2 +- src/ISO8601.cpp | 2 +- src/ISO8601.h | 1 + src/Variant.cpp | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index 1bfa69cc6..3da32d102 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -578,7 +578,7 @@ double Config::getReal (const std::string& key) return getReal("urgency.next.coefficient"); if ((*this).find (key) != (*this).end ()) - return strtod ((*this)[key].c_str (), NULL); + return std::stod ((*this)[key]); return 0.0; } diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index 342899472..43f524e6a 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -1874,7 +1874,7 @@ bool ISO8601p::parse (const std::string& input, std::string::size_type& start) Lexer::isSingleCharOperator (n.next ())) { start = original_start + n.cursor (); - double quantity = strtod (number.c_str (), NULL); + double quantity = std::stod (number); // Linear lookup - should instead be logarithmic. double seconds = 1; diff --git a/src/ISO8601.h b/src/ISO8601.h index ddc661914..4bc3acd37 100644 --- a/src/ISO8601.h +++ b/src/ISO8601.h @@ -27,6 +27,7 @@ #ifndef INCLUDED_ISO8601 #define INCLUDED_ISO8601 +#include #include #include diff --git a/src/Variant.cpp b/src/Variant.cpp index 515999238..6d0434468 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -25,12 +25,12 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include #include #include #include #include #include -#include #include #include #include @@ -1873,8 +1873,8 @@ void Variant::cast (const enum type new_type) case type_integer: _integer = (int) strtol (_string.c_str (), NULL, (_string.substr (0, 2) == "0x" ? 16 : 10)); break; - case type_real: _real = strtod (_string.c_str (), NULL); break; - case type_string: break; + case type_real: _real = std::stod (_string); break; + case type_string: break; case type_date: { _date = 0;