mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
strtoul result shouldn't be narrowed to uint32_t before checking for ULONG_MAX
am: 69e8325e5d
Change-Id: Id68341a6b3b8c8f6c470581a6fe67db5ceea2cec
This commit is contained in:
@@ -87,7 +87,7 @@ size_t PowerStats::parsePowerRails() {
|
|||||||
std::string railFileName;
|
std::string railFileName;
|
||||||
std::string spsFileName;
|
std::string spsFileName;
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
uint32_t samplingRate;
|
unsigned long samplingRate;
|
||||||
for (const auto& path : mPm.devicePaths) {
|
for (const auto& path : mPm.devicePaths) {
|
||||||
railFileName = path + "/enabled_rails";
|
railFileName = path + "/enabled_rails";
|
||||||
spsFileName = path + "/sampling_rate";
|
spsFileName = path + "/sampling_rate";
|
||||||
@@ -109,10 +109,11 @@ size_t PowerStats::parsePowerRails() {
|
|||||||
while (std::getline(railNames, line)) {
|
while (std::getline(railNames, line)) {
|
||||||
std::vector<std::string> words = android::base::Split(line, ":");
|
std::vector<std::string> words = android::base::Split(line, ":");
|
||||||
if (words.size() == 2) {
|
if (words.size() == 2) {
|
||||||
mPm.railsInfo.emplace(words[0], RailData{.devicePath = path,
|
mPm.railsInfo.emplace(
|
||||||
.index = index,
|
words[0], RailData{.devicePath = path,
|
||||||
.subsysName = words[1],
|
.index = index,
|
||||||
.samplingRate = samplingRate});
|
.subsysName = words[1],
|
||||||
|
.samplingRate = static_cast<uint32_t>(samplingRate)});
|
||||||
index++;
|
index++;
|
||||||
} else {
|
} else {
|
||||||
ALOGW("Unexpected format in file: %s", railFileName.c_str());
|
ALOGW("Unexpected format in file: %s", railFileName.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user