Loading cmds/idmap2/libidmap2/Idmap.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -45,17 +45,23 @@ namespace { #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_; }; bool WARN_UNUSED Read16(std::istream& stream, uint16_t* out) { Loading Loading @@ -379,8 +385,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); Loading cmds/idmap2/tests/BinaryStreamVisitorTests.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ #include "TestHelpers.h" using ::testing::IsNull; using ::testing::NotNull; namespace android { Loading cmds/idmap2/tests/CommandLineOptionsTests.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -38,8 +38,6 @@ #include "TestHelpers.h" using ::testing::NotNull; namespace android { namespace idmap2 { Loading cmds/idmap2/tests/PrettyPrintVisitorTests.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ #include "TestHelpers.h" using ::testing::IsNull; using ::testing::NotNull; using android::ApkAssets; Loading cmds/idmap2/tests/RawPrintVisitorTests.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include "TestHelpers.h" using ::testing::IsNull; using ::testing::NotNull; namespace android { Loading Loading
cmds/idmap2/libidmap2/Idmap.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -45,17 +45,23 @@ namespace { #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_; }; bool WARN_UNUSED Read16(std::istream& stream, uint16_t* out) { Loading Loading @@ -379,8 +385,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); Loading
cmds/idmap2/tests/BinaryStreamVisitorTests.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ #include "TestHelpers.h" using ::testing::IsNull; using ::testing::NotNull; namespace android { Loading
cmds/idmap2/tests/CommandLineOptionsTests.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -38,8 +38,6 @@ #include "TestHelpers.h" using ::testing::NotNull; namespace android { namespace idmap2 { Loading
cmds/idmap2/tests/PrettyPrintVisitorTests.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ #include "TestHelpers.h" using ::testing::IsNull; using ::testing::NotNull; using android::ApkAssets; Loading
cmds/idmap2/tests/RawPrintVisitorTests.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include "TestHelpers.h" using ::testing::IsNull; using ::testing::NotNull; namespace android { Loading