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

Commit cf281360 authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Todd Kennedy
Browse files

idmap2: fix clang-tidy warnings [misc-*]

Bug: 120024673
Test: mmm frameworks/base/cmds/idmap2; check output
Change-Id: I48c1cf25d2f1cf243dca67ec9d7e8fd50e6f9f32
parent 7e72f129
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -43,17 +43,23 @@ namespace idmap2 {

#define EXTRACT_ENTRY(resid) (0x0000ffff & (resid))

struct MatchingResources {
class MatchingResources {
 public:
  void Add(ResourceId target_resid, ResourceId overlay_resid) {
    TypeId target_typeid = EXTRACT_TYPE(target_resid);
    if (map.find(target_typeid) == map.end()) {
      map.emplace(target_typeid, std::set<std::pair<ResourceId, ResourceId>>());
    if (map_.find(target_typeid) == map_.end()) {
      map_.emplace(target_typeid, std::set<std::pair<ResourceId, ResourceId>>());
    }
    map[target_typeid].insert(std::make_pair(target_resid, overlay_resid));
    map_[target_typeid].insert(std::make_pair(target_resid, overlay_resid));
  }

  inline const std::map<TypeId, std::set<std::pair<ResourceId, ResourceId>>>& Map() const {
    return map_;
  }

 private:
  // target type id -> set { pair { overlay entry id, overlay entry id } }
  std::map<TypeId, std::set<std::pair<ResourceId, ResourceId>>> map;
  std::map<TypeId, std::set<std::pair<ResourceId, ResourceId>>> map_;
};

static bool WARN_UNUSED Read16(std::istream& stream, uint16_t* out) {
@@ -375,8 +381,8 @@ std::unique_ptr<const Idmap> Idmap::FromApkAssets(const std::string& target_apk_

  // encode idmap data
  std::unique_ptr<IdmapData> data(new IdmapData());
  const auto types_end = matching_resources.map.cend();
  for (auto ti = matching_resources.map.cbegin(); ti != types_end; ++ti) {
  const auto types_end = matching_resources.Map().cend();
  for (auto ti = matching_resources.Map().cbegin(); ti != types_end; ++ti) {
    auto ei = ti->second.cbegin();
    std::unique_ptr<IdmapData::TypeEntry> type(new IdmapData::TypeEntry());
    type->target_type_id_ = EXTRACT_TYPE(ei->first);
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@

#include "TestHelpers.h"

using ::testing::IsNull;
using ::testing::NotNull;

namespace android {
+0 −2
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@

#include "TestHelpers.h"

using ::testing::NotNull;

namespace android {
namespace idmap2 {

+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@

#include "TestHelpers.h"

using ::testing::IsNull;
using ::testing::NotNull;

using android::ApkAssets;
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@

#include "TestHelpers.h"

using ::testing::IsNull;
using ::testing::NotNull;

namespace android {