C++11: Migrated from strtod to std::stod

This commit is contained in:
Paul Beckingham 2015-11-01 19:44:15 -05:00
parent abc988476d
commit db49efd72f
4 changed files with 6 additions and 5 deletions

View file

@ -578,7 +578,7 @@ double Config::getReal (const std::string& key)
return getReal("urgency.next.coefficient"); return getReal("urgency.next.coefficient");
if ((*this).find (key) != (*this).end ()) if ((*this).find (key) != (*this).end ())
return strtod ((*this)[key].c_str (), NULL); return std::stod ((*this)[key]);
return 0.0; return 0.0;
} }

View file

@ -1874,7 +1874,7 @@ bool ISO8601p::parse (const std::string& input, std::string::size_type& start)
Lexer::isSingleCharOperator (n.next ())) Lexer::isSingleCharOperator (n.next ()))
{ {
start = original_start + n.cursor (); start = original_start + n.cursor ();
double quantity = strtod (number.c_str (), NULL); double quantity = std::stod (number);
// Linear lookup - should instead be logarithmic. // Linear lookup - should instead be logarithmic.
double seconds = 1; double seconds = 1;

View file

@ -27,6 +27,7 @@
#ifndef INCLUDED_ISO8601 #ifndef INCLUDED_ISO8601
#define INCLUDED_ISO8601 #define INCLUDED_ISO8601
#include <string>
#include <Nibbler.h> #include <Nibbler.h>
#include <time.h> #include <time.h>

View file

@ -25,12 +25,12 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <cmake.h> #include <cmake.h>
#include <Variant.h>
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <Variant.h>
#include <ISO8601.h> #include <ISO8601.h>
#include <Lexer.h> #include <Lexer.h>
#include <RX.h> #include <RX.h>
@ -1873,8 +1873,8 @@ void Variant::cast (const enum type new_type)
case type_integer: case type_integer:
_integer = (int) strtol (_string.c_str (), NULL, (_string.substr (0, 2) == "0x" ? 16 : 10)); _integer = (int) strtol (_string.c_str (), NULL, (_string.substr (0, 2) == "0x" ? 16 : 10));
break; break;
case type_real: _real = strtod (_string.c_str (), NULL); break; case type_real: _real = std::stod (_string); break;
case type_string: break; case type_string: break;
case type_date: case type_date:
{ {
_date = 0; _date = 0;