Loading cmds/atrace/atrace.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -482,8 +482,8 @@ static bool setClock() newClock = "global"; newClock = "global"; } } size_t begin = clockStr.find("[") + 1; size_t begin = clockStr.find('[') + 1; size_t end = clockStr.find("]"); size_t end = clockStr.find(']'); if (newClock.compare(0, std::string::npos, clockStr, begin, end-begin) == 0) { if (newClock.compare(0, std::string::npos, clockStr, begin, end-begin) == 0) { return true; return true; } } Loading Loading @@ -544,7 +544,7 @@ static void pokeHalServices() auto listRet = sm->list([&](const auto &interfaces) { auto listRet = sm->list([&](const auto &interfaces) { for (size_t i = 0; i < interfaces.size(); i++) { for (size_t i = 0; i < interfaces.size(); i++) { string fqInstanceName = interfaces[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) if (n == std::string::npos || interfaces[i].size() == n+1) continue; continue; hidl_string fqInterfaceName = fqInstanceName.substr(0, n); hidl_string fqInterfaceName = fqInstanceName.substr(0, n); Loading cmds/dumpstate/dumpstate.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -692,7 +692,7 @@ bool Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd) { std::string valid_name = entry_name; std::string valid_name = entry_name; // Rename extension if necessary. // Rename extension if necessary. size_t idx = entry_name.rfind("."); size_t idx = entry_name.rfind('.'); if (idx != std::string::npos) { if (idx != std::string::npos) { std::string extension = entry_name.substr(idx); std::string extension = entry_name.substr(idx); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); Loading Loading @@ -1434,7 +1434,7 @@ bool Dumpstate::FinishZipFile() { return true; 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 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filepath.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOFOLLOW))); | O_CLOEXEC | O_NOFOLLOW))); if (fd == -1) { if (fd == -1) { Loading cmds/dumpsys/dumpsys.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -176,7 +176,7 @@ int Dumpsys::main(int argc, char* const argv[]) { } } for (size_t i = 0; i < N; i++) { 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; if (IsSkipped(skippedServices, service_name)) continue; sp<IBinder> service = sm_->checkService(service_name); sp<IBinder> service = sm_->checkService(service_name); Loading cmds/dumpsys/tests/dumpsys_test.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -95,7 +95,7 @@ MATCHER_P(AndroidElementsAre, expected, "") { } } int i = 0; int i = 0; std::ostringstream actual_stream, expected_stream; 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 actual_str = String8(actual).c_str(); std::string expected_str = expected[i]; std::string expected_str = expected[i]; actual_stream << "'" << actual_str << "' "; actual_stream << "'" << actual_str << "' "; Loading cmds/installd/CacheTracker.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -60,7 +60,7 @@ void CacheTracker::loadStats() { ATRACE_BEGIN("loadStats tree"); ATRACE_BEGIN("loadStats tree"); cacheUsed = 0; cacheUsed = 0; for (auto path : mDataPaths) { for (const auto& path : mDataPaths) { auto cachePath = read_path_inode(path, "cache", kXattrInodeCache); auto cachePath = read_path_inode(path, "cache", kXattrInodeCache); auto codeCachePath = read_path_inode(path, "code_cache", kXattrInodeCodeCache); auto codeCachePath = read_path_inode(path, "code_cache", kXattrInodeCodeCache); calculate_tree_size(cachePath, &cacheUsed); calculate_tree_size(cachePath, &cacheUsed); Loading Loading @@ -170,7 +170,7 @@ void CacheTracker::loadItems() { items.clear(); items.clear(); ATRACE_BEGIN("loadItems"); ATRACE_BEGIN("loadItems"); for (auto path : mDataPaths) { for (const auto& path : mDataPaths) { loadItemsFrom(read_path_inode(path, "cache", kXattrInodeCache)); loadItemsFrom(read_path_inode(path, "cache", kXattrInodeCache)); loadItemsFrom(read_path_inode(path, "code_cache", kXattrInodeCodeCache)); loadItemsFrom(read_path_inode(path, "code_cache", kXattrInodeCodeCache)); } } Loading Loading
cmds/atrace/atrace.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -482,8 +482,8 @@ static bool setClock() newClock = "global"; newClock = "global"; } } size_t begin = clockStr.find("[") + 1; size_t begin = clockStr.find('[') + 1; size_t end = clockStr.find("]"); size_t end = clockStr.find(']'); if (newClock.compare(0, std::string::npos, clockStr, begin, end-begin) == 0) { if (newClock.compare(0, std::string::npos, clockStr, begin, end-begin) == 0) { return true; return true; } } Loading Loading @@ -544,7 +544,7 @@ static void pokeHalServices() auto listRet = sm->list([&](const auto &interfaces) { auto listRet = sm->list([&](const auto &interfaces) { for (size_t i = 0; i < interfaces.size(); i++) { for (size_t i = 0; i < interfaces.size(); i++) { string fqInstanceName = interfaces[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) if (n == std::string::npos || interfaces[i].size() == n+1) continue; continue; hidl_string fqInterfaceName = fqInstanceName.substr(0, n); hidl_string fqInterfaceName = fqInstanceName.substr(0, n); Loading
cmds/dumpstate/dumpstate.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -692,7 +692,7 @@ bool Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd) { std::string valid_name = entry_name; std::string valid_name = entry_name; // Rename extension if necessary. // Rename extension if necessary. size_t idx = entry_name.rfind("."); size_t idx = entry_name.rfind('.'); if (idx != std::string::npos) { if (idx != std::string::npos) { std::string extension = entry_name.substr(idx); std::string extension = entry_name.substr(idx); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); Loading Loading @@ -1434,7 +1434,7 @@ bool Dumpstate::FinishZipFile() { return true; 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 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filepath.c_str(), O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOFOLLOW))); | O_CLOEXEC | O_NOFOLLOW))); if (fd == -1) { if (fd == -1) { Loading
cmds/dumpsys/dumpsys.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -176,7 +176,7 @@ int Dumpsys::main(int argc, char* const argv[]) { } } for (size_t i = 0; i < N; i++) { 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; if (IsSkipped(skippedServices, service_name)) continue; sp<IBinder> service = sm_->checkService(service_name); sp<IBinder> service = sm_->checkService(service_name); Loading
cmds/dumpsys/tests/dumpsys_test.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -95,7 +95,7 @@ MATCHER_P(AndroidElementsAre, expected, "") { } } int i = 0; int i = 0; std::ostringstream actual_stream, expected_stream; 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 actual_str = String8(actual).c_str(); std::string expected_str = expected[i]; std::string expected_str = expected[i]; actual_stream << "'" << actual_str << "' "; actual_stream << "'" << actual_str << "' "; Loading
cmds/installd/CacheTracker.cpp +2 −2 Original line number Original line Diff line number Diff line Loading @@ -60,7 +60,7 @@ void CacheTracker::loadStats() { ATRACE_BEGIN("loadStats tree"); ATRACE_BEGIN("loadStats tree"); cacheUsed = 0; cacheUsed = 0; for (auto path : mDataPaths) { for (const auto& path : mDataPaths) { auto cachePath = read_path_inode(path, "cache", kXattrInodeCache); auto cachePath = read_path_inode(path, "cache", kXattrInodeCache); auto codeCachePath = read_path_inode(path, "code_cache", kXattrInodeCodeCache); auto codeCachePath = read_path_inode(path, "code_cache", kXattrInodeCodeCache); calculate_tree_size(cachePath, &cacheUsed); calculate_tree_size(cachePath, &cacheUsed); Loading Loading @@ -170,7 +170,7 @@ void CacheTracker::loadItems() { items.clear(); items.clear(); ATRACE_BEGIN("loadItems"); ATRACE_BEGIN("loadItems"); for (auto path : mDataPaths) { for (const auto& path : mDataPaths) { loadItemsFrom(read_path_inode(path, "cache", kXattrInodeCache)); loadItemsFrom(read_path_inode(path, "cache", kXattrInodeCache)); loadItemsFrom(read_path_inode(path, "code_cache", kXattrInodeCodeCache)); loadItemsFrom(read_path_inode(path, "code_cache", kXattrInodeCodeCache)); } } Loading