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

Commit 5b198933 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Fix performance-for-range-copy warnings

Bug: 30413223
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance*
Change-Id: I7d5537c24c39d5c42ac17c8a67646e4b9321d6bb
parent 032498c1
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -346,7 +346,8 @@ void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state,

  // This function may be called on any thread, we need to make sure that the
  // device update happens on the main thread.
  for (auto device : instance_->connection_handler_->GetListOfDevices()) {
  for (const auto& device :
       instance_->connection_handler_->GetListOfDevices()) {
    do_in_main_thread(FROM_HERE, base::Bind(&Device::SendMediaUpdate,
                                            base::Unretained(device.get()),
                                            track_changed, play_state, queue));
@@ -361,7 +362,8 @@ void AvrcpService::SendFolderUpdate(bool available_players,
            << " uids=" << uids;

  // Ensure that the update is posted to the correct thread
  for (auto device : instance_->connection_handler_->GetListOfDevices()) {
  for (const auto& device :
       instance_->connection_handler_->GetListOfDevices()) {
    do_in_main_thread(
        FROM_HERE,
        base::Bind(&Device::SendFolderUpdate, base::Unretained(device.get()),
@@ -457,7 +459,7 @@ void AvrcpService::DebugDump(int fd) {
  std::stringstream stream;
  {
    ScopedIndent indent(stream);
    for (auto device : device_list) {
    for (const auto& device : device_list) {
      stream << *device << std::endl;
    }
  }
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ bool GetElementAttributesResponseBuilder::Serialize(
  VendorPacketBuilder::PushHeader(pkt, size() - VendorPacket::kMinSize());

  AddPayloadOctets1(pkt, entries_.size());
  for (auto attribute_entry : entries_) {
  for (const auto& attribute_entry : entries_) {
    PushAttributeValue(pkt, attribute_entry);
  }

+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ bool GetItemAttributesResponseBuilder::Serialize(
  if (status_ != Status::NO_ERROR) return true;

  AddPayloadOctets1(pkt, entries_.size());
  for (auto entry : entries_) {
  for (const auto& entry : entries_) {
    AddPayloadOctets4(pkt, base::ByteSwap((uint32_t)entry.attribute()));
    uint16_t character_set = 0x006a;  // UTF-8
    AddPayloadOctets2(pkt, base::ByteSwap(character_set));
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ bool ConnectionHandler::DisconnectDevice(const RawAddress& bdaddr) {
std::vector<std::shared_ptr<Device>> ConnectionHandler::GetListOfDevices()
    const {
  std::vector<std::shared_ptr<Device>> list;
  for (auto device : device_map_) {
  for (const auto& device : device_map_) {
    list.push_back(device.second);
  }
  return list;
+1 −1
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ void HandleDisable(IBluetooth* bt_iface, const vector<string>& args) {
void HandleEnable(IBluetooth* bt_iface, const vector<string>& args) {
  bool is_restricted_mode = false;

  for (auto iter : args) {
  for (const auto& iter : args) {
    const std::string& arg = iter;
    if (arg == "-h") {
      static const char kUsage[] =