summaryrefslogtreecommitdiffstats
path: root/thresholds.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-10-12 16:20:38 -0500
committerMatt Spinler <spinler@us.ibm.com>2017-10-12 16:20:38 -0500
commit325456cb281ffec46286a0cbd398e0073f4a8274 (patch)
treea5c6fc179deb46a4322be533bc3f43ff94f32af1 /thresholds.hpp
parent9b65f76daeec9f9783b0a14f61f3889dba0c87e0 (diff)
downloadphosphor-hwmon-325456cb281ffec46286a0cbd398e0073f4a8274.tar.gz
phosphor-hwmon-325456cb281ffec46286a0cbd398e0073f4a8274.zip
use stoll() to convert threshold string to number
The stoi() and stol() functions will throw out of range exceptions when trying to convert valid threshold values, such as power numbers in microwatts. Change-Id: Ifd4c12fb37d6bd905c73633a468f35361b544fa7 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'thresholds.hpp')
-rw-r--r--thresholds.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/thresholds.hpp b/thresholds.hpp
index d0b7f0b..5639615 100644
--- a/thresholds.hpp
+++ b/thresholds.hpp
@@ -91,8 +91,8 @@ auto addThreshold(const SensorSet::key_type& sensor,
if (!tLo.empty() && !tHi.empty())
{
iface = std::make_shared<T>(bus, objPath.c_str(), deferSignals);
- auto lo = stoi(tLo);
- auto hi = stoi(tHi);
+ auto lo = stoll(tLo);
+ auto hi = stoll(tHi);
(*iface.*Thresholds<T>::setLo)(lo);
(*iface.*Thresholds<T>::setHi)(hi);
(*iface.*Thresholds<T>::alarmLo)(value < lo);
OpenPOWER on IntegriCloud