diff options
author | Yi Kong <yikong@google.com> | 2018-03-03 00:46:57 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-03-03 00:46:57 +0000 |
commit | 979ace46ed9c5c8166d5f01226b5ac5dd7c65d84 (patch) | |
tree | 5dfef25b26662580f5c6fb64d53189c580c30da7 /healthd | |
parent | 6027705f46ef3406d43292914c701ebec1d323c4 (diff) | |
parent | eb066ae098564e0c1f18a9aec841745c2c8d42a4 (diff) | |
download | system_core-979ace46ed9c5c8166d5f01226b5ac5dd7c65d84.tar.gz system_core-979ace46ed9c5c8166d5f01226b5ac5dd7c65d84.tar.bz2 system_core-979ace46ed9c5c8166d5f01226b5ac5dd7c65d84.zip |
Merge "healthd: Fix negativity check after cast to unsigned enum" am: 3dad67af05 am: 4734981245
am: eb066ae098
Change-Id: I2327adfd50fceb232ef2a52e535914743c25cf3a
Diffstat (limited to 'healthd')
-rw-r--r-- | healthd/BatteryMonitor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 2553ffa30..80c5afe0d 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -147,7 +147,7 @@ int BatteryMonitor::readFromFile(const String8& path, std::string* buf) { BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String8& path) { std::string buf; - BatteryMonitor::PowerSupplyType ret; + int ret; struct sysfsStringEnumMap supplyTypeMap[] = { { "Unknown", ANDROID_POWER_SUPPLY_TYPE_UNKNOWN }, { "Battery", ANDROID_POWER_SUPPLY_TYPE_BATTERY }, @@ -168,13 +168,13 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String if (readFromFile(path, &buf) <= 0) return ANDROID_POWER_SUPPLY_TYPE_UNKNOWN; - ret = (BatteryMonitor::PowerSupplyType)mapSysfsString(buf.c_str(), supplyTypeMap); + ret = mapSysfsString(buf.c_str(), supplyTypeMap); if (ret < 0) { KLOG_WARNING(LOG_TAG, "Unknown power supply type '%s'\n", buf.c_str()); ret = ANDROID_POWER_SUPPLY_TYPE_UNKNOWN; } - return ret; + return static_cast<BatteryMonitor::PowerSupplyType>(ret); } bool BatteryMonitor::getBooleanField(const String8& path) { |