Fix clang-tidy warnings in bt.
* Add explicit keyword to conversion constructors,
or add NOLINT to implicit conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters,
or add NOLINT to keep same callback function signature.
Bug: 30407689
* Use const reference type for loop index variables to avoid unnecessary copy.
Bug: 30413223
* Use const reference type to avoid unnecessary copy.
Bug: 30413862
Test: build with WITH_TIDY=1
Change-Id: I8237d332f32d7be09ab72a8de82160fdb776dcd1
diff --git a/service/gatt_server.cc b/service/gatt_server.cc
index 9a76f66..57ac6ba 100644
--- a/service/gatt_server.cc
+++ b/service/gatt_server.cc
@@ -147,7 +147,7 @@
}
std::shared_ptr<Connection> connection;
- for (auto tmp : iter->second) {
+ for (const auto& tmp : iter->second) {
if (tmp->request_id_to_handle.find(request_id) ==
tmp->request_id_to_handle.end())
continue;
@@ -218,7 +218,7 @@
// Send the notification/indication on all matching connections.
int send_count = 0;
- for (auto conn : conn_iter->second) {
+ for (const auto& conn : conn_iter->second) {
// Make sure that one isn't already pending for this connection.
if (pending_indications_.find(conn->conn_id) !=
pending_indications_.end()) {