diff options
author | 2019-12-20 14:38:36 +0000 | |
---|---|---|
committer | 2019-12-20 14:38:36 +0000 | |
commit | 548d6dcf772ecfd14246963e9db96d286b99a8f6 (patch) | |
tree | 238e1b8685c3dd939a6ed2b80d91bf383bc22318 /libs/androidfw/Idmap.cpp | |
parent | c6af1619de2facb65f317957d6e18eadc596a1e9 (diff) | |
parent | d7e8a534d0fbf0b0f8f27f59f90dbbeb0b5641db (diff) |
Merge "idmap2: add debug information to idmap file format"
Diffstat (limited to 'libs/androidfw/Idmap.cpp')
-rw-r--r-- | libs/androidfw/Idmap.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/androidfw/Idmap.cpp b/libs/androidfw/Idmap.cpp index 773353d32d51..ce3bffff0aa5 100644 --- a/libs/androidfw/Idmap.cpp +++ b/libs/androidfw/Idmap.cpp @@ -43,6 +43,10 @@ static bool compare_overlay_entries(const Idmap_overlay_entry& e1, const uint32_ return dtohl(e1.overlay_id) < overlay_id; } +size_t Idmap_header::Size() const { + return sizeof(Idmap_header) + sizeof(uint8_t) * dtohl(debug_info_size); +} + OverlayStringPool::OverlayStringPool(const LoadedIdmap* loaded_idmap) : data_header_(loaded_idmap->data_header_), idmap_string_pool_(loaded_idmap->string_pool_.get()) { }; @@ -211,8 +215,8 @@ std::unique_ptr<const LoadedIdmap> LoadedIdmap::Load(const StringPiece& idmap_da } auto header = reinterpret_cast<const Idmap_header*>(idmap_data.data()); - const uint8_t* data_ptr = reinterpret_cast<const uint8_t*>(idmap_data.data()) + sizeof(*header); - size_t data_size = idmap_data.size() - sizeof(*header); + const uint8_t* data_ptr = reinterpret_cast<const uint8_t*>(idmap_data.data()) + header->Size(); + size_t data_size = idmap_data.size() - header->Size(); // Currently idmap2 can only generate one data block. auto data_header = reinterpret_cast<const Idmap_data_header*>(data_ptr); |