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

Commit 2f651584 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix clang-tidy performance warnings in frameworks/native."

parents 41e9cf9e cb057c2e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -481,8 +481,8 @@ static bool setClock()
        newClock = "global";
    }

    size_t begin = clockStr.find("[") + 1;
    size_t end = clockStr.find("]");
    size_t begin = clockStr.find('[') + 1;
    size_t end = clockStr.find(']');
    if (newClock.compare(0, std::string::npos, clockStr, begin, end-begin) == 0) {
        return true;
    }
@@ -543,7 +543,7 @@ static void pokeHalServices()
    auto listRet = sm->list([&](const auto &interfaces) {
        for (size_t i = 0; i < interfaces.size(); i++) {
            string fqInstanceName = interfaces[i];
            string::size_type n = fqInstanceName.find("/");
            string::size_type n = fqInstanceName.find('/');
            if (n == std::string::npos || interfaces[i].size() == n+1)
                continue;
            hidl_string fqInterfaceName = fqInstanceName.substr(0, n);
+2 −2
Original line number Diff line number Diff line
@@ -691,7 +691,7 @@ bool Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd) {
    std::string valid_name = entry_name;

    // Rename extension if necessary.
    size_t idx = entry_name.rfind(".");
    size_t idx = entry_name.rfind('.');
    if (idx != std::string::npos) {
        std::string extension = entry_name.substr(idx);
        std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
@@ -1432,7 +1432,7 @@ bool Dumpstate::FinishZipFile() {
    return true;
}

static std::string SHA256_file_hash(std::string filepath) {
static std::string SHA256_file_hash(const std::string& filepath) {
    android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filepath.c_str(), O_RDONLY | O_NONBLOCK
            | O_CLOEXEC | O_NOFOLLOW)));
    if (fd == -1) {
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ int Dumpsys::main(int argc, char* const argv[]) {
    }

    for (size_t i = 0; i < N; i++) {
        String16 service_name = std::move(services[i]);
        const String16& service_name = std::move(services[i]);
        if (IsSkipped(skippedServices, service_name)) continue;

        sp<IBinder> service = sm_->checkService(service_name);
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ MATCHER_P(AndroidElementsAre, expected, "") {
    }
    int i = 0;
    std::ostringstream actual_stream, expected_stream;
    for (String16 actual : arg) {
    for (const String16& actual : arg) {
        std::string actual_str = String8(actual).c_str();
        std::string expected_str = expected[i];
        actual_stream << "'" << actual_str << "' ";
+2 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ void CacheTracker::loadStats() {

    ATRACE_BEGIN("loadStats tree");
    cacheUsed = 0;
    for (auto path : mDataPaths) {
    for (const auto& path : mDataPaths) {
        auto cachePath = read_path_inode(path, "cache", kXattrInodeCache);
        auto codeCachePath = read_path_inode(path, "code_cache", kXattrInodeCodeCache);
        calculate_tree_size(cachePath, &cacheUsed);
@@ -170,7 +170,7 @@ void CacheTracker::loadItems() {
    items.clear();

    ATRACE_BEGIN("loadItems");
    for (auto path : mDataPaths) {
    for (const auto& path : mDataPaths) {
        loadItemsFrom(read_path_inode(path, "cache", kXattrInodeCache));
        loadItemsFrom(read_path_inode(path, "code_cache", kXattrInodeCodeCache));
    }
Loading