diff options
author | 2018-11-28 19:32:25 +0100 | |
---|---|---|
committer | 2018-12-20 15:30:49 -0800 | |
commit | cf28136041559a50e85cd9ca360b9eb56f0acd6a (patch) | |
tree | 1ce61dc4d4a44c7695db294e507418308203c29b | |
parent | 7e72f129c6d5734a544c2579477c37765b2af2e7 (diff) |
idmap2: fix clang-tidy warnings [misc-*]
Bug: 120024673
Test: mmm frameworks/base/cmds/idmap2; check output
Change-Id: I48c1cf25d2f1cf243dca67ec9d7e8fd50e6f9f32
-rw-r--r-- | cmds/idmap2/libidmap2/Idmap.cpp | 20 | ||||
-rw-r--r-- | cmds/idmap2/tests/BinaryStreamVisitorTests.cpp | 1 | ||||
-rw-r--r-- | cmds/idmap2/tests/CommandLineOptionsTests.cpp | 2 | ||||
-rw-r--r-- | cmds/idmap2/tests/PrettyPrintVisitorTests.cpp | 1 | ||||
-rw-r--r-- | cmds/idmap2/tests/RawPrintVisitorTests.cpp | 1 |
5 files changed, 13 insertions, 12 deletions
diff --git a/cmds/idmap2/libidmap2/Idmap.cpp b/cmds/idmap2/libidmap2/Idmap.cpp index 1ef326793cb4..49bb7d855b9e 100644 --- a/cmds/idmap2/libidmap2/Idmap.cpp +++ b/cmds/idmap2/libidmap2/Idmap.cpp @@ -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); diff --git a/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp b/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp index 8b552dcc1265..7d2e8ee90103 100644 --- a/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp +++ b/cmds/idmap2/tests/BinaryStreamVisitorTests.cpp @@ -29,7 +29,6 @@ #include "TestHelpers.h" -using ::testing::IsNull; using ::testing::NotNull; namespace android { diff --git a/cmds/idmap2/tests/CommandLineOptionsTests.cpp b/cmds/idmap2/tests/CommandLineOptionsTests.cpp index b04b25660ee4..7d1f56b8b509 100644 --- a/cmds/idmap2/tests/CommandLineOptionsTests.cpp +++ b/cmds/idmap2/tests/CommandLineOptionsTests.cpp @@ -38,8 +38,6 @@ #include "TestHelpers.h" -using ::testing::NotNull; - namespace android { namespace idmap2 { diff --git a/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp b/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp index da9779211f81..0c4f493e9f6c 100644 --- a/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp +++ b/cmds/idmap2/tests/PrettyPrintVisitorTests.cpp @@ -29,7 +29,6 @@ #include "TestHelpers.h" -using ::testing::IsNull; using ::testing::NotNull; using android::ApkAssets; diff --git a/cmds/idmap2/tests/RawPrintVisitorTests.cpp b/cmds/idmap2/tests/RawPrintVisitorTests.cpp index c28ce2e02ea9..6285f217b21e 100644 --- a/cmds/idmap2/tests/RawPrintVisitorTests.cpp +++ b/cmds/idmap2/tests/RawPrintVisitorTests.cpp @@ -27,7 +27,6 @@ #include "TestHelpers.h" -using ::testing::IsNull; using ::testing::NotNull; namespace android { |