Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17c943bc authored by Yi Kong's avatar Yi Kong Committed by android-build-merger
Browse files

strtoul result shouldn't be narrowed to uint32_t before checking for ULONG_MAX...

strtoul result shouldn't be narrowed to uint32_t before checking for ULONG_MAX am: 69e8325e am: 0d5b2cf5 am: 363f166f
am: 41e7b857

Change-Id: Iddbbf71f2aa763e1e7daf33a379daf7ca1f06733
parents b5807560 41e7b857
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ size_t PowerStats::parsePowerRails() {
    std::string railFileName;
    std::string spsFileName;
    uint32_t index = 0;
    uint32_t samplingRate;
    unsigned long samplingRate;
    for (const auto& path : mPm.devicePaths) {
        railFileName = path + "/enabled_rails";
        spsFileName = path + "/sampling_rate";
@@ -109,10 +109,11 @@ size_t PowerStats::parsePowerRails() {
        while (std::getline(railNames, line)) {
            std::vector<std::string> words = android::base::Split(line, ":");
            if (words.size() == 2) {
                mPm.railsInfo.emplace(words[0], RailData{.devicePath = path,
                mPm.railsInfo.emplace(
                        words[0], RailData{.devicePath = path,
                                           .index = index,
                                           .subsysName = words[1],
                                                         .samplingRate = samplingRate});
                                           .samplingRate = static_cast<uint32_t>(samplingRate)});
                index++;
            } else {
                ALOGW("Unexpected format in file: %s", railFileName.c_str());