Duration: No longer accepts 123e456d as a duration

- Prohibits the use of [eE] in the units.
- Permits use of [+-] only in the first position.
This commit is contained in:
Paul Beckingham 2015-07-15 07:43:08 -04:00
parent f68d6fd812
commit 695185e62e

View file

@ -332,7 +332,11 @@ bool Duration::parse (const std::string& input, std::string::size_type& start)
}
}
else if (n.getNumber (number))
else if (n.getNumber (number) &&
number.find ('e') == std::string::npos &&
number.find ('E') == std::string::npos &&
(number.find ('+') == std::string::npos || number.find ('+') == 0) &&
(number.find ('-') == std::string::npos || number.find ('-') == 0))
{
n.skipWS ();
if (n.getOneOf (units, unit))