Merge "Use const auto&/auto&& in adb."
This commit is contained in:
commit
21f99c089e
5 changed files with 12 additions and 12 deletions
|
@ -245,7 +245,7 @@ void parse_banner(const std::string& banner, atransport* t) {
|
|||
|
||||
if (pieces.size() > 2) {
|
||||
const std::string& props = pieces[2];
|
||||
for (auto& prop : android::base::Split(props, ";")) {
|
||||
for (const auto& prop : android::base::Split(props, ";")) {
|
||||
// The list of properties was traditionally ;-terminated rather than ;-separated.
|
||||
if (prop.empty()) continue;
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ static void get_vendor_keys(struct listnode* key_list) {
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto& path : android::base::Split(adb_keys_path, ENV_PATH_SEPARATOR_STR)) {
|
||||
for (const auto& path : android::base::Split(adb_keys_path, ENV_PATH_SEPARATOR_STR)) {
|
||||
if (!read_key(path.c_str(), key_list)) {
|
||||
D("Failed to read '%s'", path.c_str());
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ void fdevent_del(fdevent* fde, unsigned events) {
|
|||
|
||||
static std::string dump_pollfds(const std::vector<pollfd>& pollfds) {
|
||||
std::string result;
|
||||
for (auto& pollfd : pollfds) {
|
||||
for (const auto& pollfd : pollfds) {
|
||||
std::string op;
|
||||
if (pollfd.events & POLLIN) {
|
||||
op += "R";
|
||||
|
@ -214,8 +214,8 @@ static std::string dump_pollfds(const std::vector<pollfd>& pollfds) {
|
|||
|
||||
static void fdevent_process() {
|
||||
std::vector<pollfd> pollfds;
|
||||
for (auto it = g_poll_node_map.begin(); it != g_poll_node_map.end(); ++it) {
|
||||
pollfds.push_back(it->second.pollfd);
|
||||
for (const auto& pair : g_poll_node_map) {
|
||||
pollfds.push_back(pair.second.pollfd);
|
||||
}
|
||||
CHECK_GT(pollfds.size(), 0u);
|
||||
D("poll(), pollfds = %s", dump_pollfds(pollfds).c_str());
|
||||
|
@ -224,7 +224,7 @@ static void fdevent_process() {
|
|||
PLOG(ERROR) << "poll(), ret = " << ret;
|
||||
return;
|
||||
}
|
||||
for (auto& pollfd : pollfds) {
|
||||
for (const auto& pollfd : pollfds) {
|
||||
if (pollfd.revents != 0) {
|
||||
D("for fd %d, revents = %x", pollfd.fd, pollfd.revents);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ static bool secure_mkdirs(const std::string& path) {
|
|||
path_components.pop_back(); // For "/system/bin/sh", only create "/system/bin".
|
||||
|
||||
std::string partial_path;
|
||||
for (auto& path_component : path_components) {
|
||||
for (const auto& path_component : path_components) {
|
||||
if (partial_path.back() != OS_PATH_SEPARATOR) partial_path += OS_PATH_SEPARATOR;
|
||||
partial_path += path_component;
|
||||
|
||||
|
|
|
@ -825,7 +825,7 @@ void atransport::RemoveDisconnect(adisconnect* disconnect) {
|
|||
}
|
||||
|
||||
void atransport::RunDisconnects() {
|
||||
for (auto& disconnect : disconnects_) {
|
||||
for (const auto& disconnect : disconnects_) {
|
||||
disconnect->func(disconnect->opaque, this);
|
||||
}
|
||||
disconnects_.clear();
|
||||
|
@ -872,7 +872,7 @@ static void append_transport(const atransport* t, std::string* result,
|
|||
std::string list_transports(bool long_listing) {
|
||||
std::string result;
|
||||
adb_mutex_lock(&transport_lock);
|
||||
for (const auto t : transport_list) {
|
||||
for (const auto& t : transport_list) {
|
||||
append_transport(t, &result, long_listing);
|
||||
}
|
||||
adb_mutex_unlock(&transport_lock);
|
||||
|
@ -882,7 +882,7 @@ std::string list_transports(bool long_listing) {
|
|||
/* hack for osx */
|
||||
void close_usb_devices() {
|
||||
adb_mutex_lock(&transport_lock);
|
||||
for (auto t : transport_list) {
|
||||
for (const auto& t : transport_list) {
|
||||
if (!t->kicked) {
|
||||
t->kicked = 1;
|
||||
t->kick(t);
|
||||
|
@ -908,7 +908,7 @@ int register_socket_transport(int s, const char *serial, int port, int local) {
|
|||
}
|
||||
|
||||
adb_mutex_lock(&transport_lock);
|
||||
for (auto transport : pending_list) {
|
||||
for (const auto& transport : pending_list) {
|
||||
if (transport->serial && strcmp(serial, transport->serial) == 0) {
|
||||
adb_mutex_unlock(&transport_lock);
|
||||
delete t;
|
||||
|
@ -916,7 +916,7 @@ int register_socket_transport(int s, const char *serial, int port, int local) {
|
|||
}
|
||||
}
|
||||
|
||||
for (auto transport : transport_list) {
|
||||
for (const auto& transport : transport_list) {
|
||||
if (transport->serial && strcmp(serial, transport->serial) == 0) {
|
||||
adb_mutex_unlock(&transport_lock);
|
||||
delete t;
|
||||
|
|
Loading…
Reference in a new issue