diff options
author | 2022-11-29 11:12:18 -0800 | |
---|---|---|
committer | 2022-11-30 18:04:36 -0800 | |
commit | 9d22537ee2ef820919e03cc1bf3024ae000194d9 (patch) | |
tree | cacb03b7486f1dfbab483336c935539fb68f89b3 /libs/androidfw/LoadedArsc.cpp | |
parent | 6e8c6039254716dca878e84567d3a4e480d47a22 (diff) |
[res] Change OverlayableInfo to hold string views
No need to copy the strings as we keep them in separate
containers anyway, may just reference them
Bug: 237583012
Test: build + boot + UTs
Change-Id: I2853cd3c992ca482ed6988e0c52a4037b158d999
Diffstat (limited to 'libs/androidfw/LoadedArsc.cpp')
-rw-r--r-- | libs/androidfw/LoadedArsc.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/androidfw/LoadedArsc.cpp b/libs/androidfw/LoadedArsc.cpp index 193c8650b2be..c0fdfe25da21 100644 --- a/libs/androidfw/LoadedArsc.cpp +++ b/libs/androidfw/LoadedArsc.cpp @@ -648,10 +648,11 @@ std::unique_ptr<const LoadedPackage> LoadedPackage::Load(const Chunk& chunk, util::ReadUtf16StringFromDevice(overlayable->name, std::size(overlayable->name), &name); std::string actor; util::ReadUtf16StringFromDevice(overlayable->actor, std::size(overlayable->actor), &actor); - auto [it, inserted] = - loaded_package->overlayable_map_.emplace(name, actor); + auto [name_to_actor_it, inserted] = + loaded_package->overlayable_map_.emplace(std::move(name), std::move(actor)); if (!inserted) { - LOG(ERROR) << "Multiple <overlayable> blocks with the same name '" << it->first << "'."; + LOG(ERROR) << "Multiple <overlayable> blocks with the same name '" + << name_to_actor_it->first << "'."; return {}; } @@ -668,7 +669,6 @@ std::unique_ptr<const LoadedPackage> LoadedPackage::Load(const Chunk& chunk, LOG(ERROR) << "RES_TABLE_OVERLAYABLE_POLICY_TYPE too small."; return {}; } - if ((overlayable_child_chunk.data_size() / sizeof(ResTable_ref)) < dtohl(policy_header->entry_count)) { LOG(ERROR) << "RES_TABLE_OVERLAYABLE_POLICY_TYPE too small to hold entries."; @@ -690,8 +690,8 @@ std::unique_ptr<const LoadedPackage> LoadedPackage::Load(const Chunk& chunk, // Add the pairing of overlayable properties and resource ids to the package OverlayableInfo overlayable_info { - .name = name, - .actor = actor, + .name = name_to_actor_it->first, + .actor = name_to_actor_it->second, .policy_flags = policy_header->policy_flags }; loaded_package->overlayable_infos_.emplace_back(std::move(overlayable_info), std::move(ids)); |