diff options
author | Brian Carlstrom <bdc@google.com> | 2014-05-23 02:47:28 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-05-23 13:52:01 -0700 |
commit | 0aa504b5bb19f0944d50941b20c8eeaca4165328 (patch) | |
tree | 8ec437c95a023c649dc96d9e88e2403d93c77392 | |
parent | 52925af1e3136bcf68bc5754fbfa407950235217 (diff) | |
download | art-0aa504b5bb19f0944d50941b20c8eeaca4165328.zip art-0aa504b5bb19f0944d50941b20c8eeaca4165328.tar.gz art-0aa504b5bb19f0944d50941b20c8eeaca4165328.tar.bz2 |
Fix ExtractToMemMap to show original zip file name in ashmem
(cherry picked from commit 1fca8e91f32dc8b13d3129b7ef4a0194839736e6)
Change-Id: Id7d22600496b090ac32150c8c6424da89964b6be
-rw-r--r-- | dex2oat/dex2oat.cc | 5 | ||||
-rw-r--r-- | runtime/dex_file.cc | 2 | ||||
-rw-r--r-- | runtime/zip_archive.cc | 9 | ||||
-rw-r--r-- | runtime/zip_archive.h | 3 |
4 files changed, 11 insertions, 8 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index f0b5750..2126625 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -295,8 +295,9 @@ class Dex2Oat { zip_filename, error_msg->c_str()); return nullptr; } - std::unique_ptr<MemMap> image_classes_file(zip_entry->ExtractToMemMap(image_classes_filename, - error_msg)); + std::unique_ptr<MemMap> image_classes_file(zip_entry->ExtractToMemMap(zip_filename, + image_classes_filename, + error_msg)); if (image_classes_file.get() == nullptr) { *error_msg = StringPrintf("Failed to extract '%s' from '%s': %s", image_classes_filename, zip_filename, error_msg->c_str()); diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 43ae308..9cb2f1b 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -245,7 +245,7 @@ const DexFile* DexFile::Open(const ZipArchive& zip_archive, const std::string& l if (zip_entry.get() == NULL) { return nullptr; } - std::unique_ptr<MemMap> map(zip_entry->ExtractToMemMap(kClassesDex, error_msg)); + std::unique_ptr<MemMap> map(zip_entry->ExtractToMemMap(location.c_str(), kClassesDex, error_msg)); if (map.get() == NULL) { *error_msg = StringPrintf("Failed to extract '%s' from '%s': %s", kClassesDex, location.c_str(), error_msg->c_str()); diff --git a/runtime/zip_archive.cc b/runtime/zip_archive.cc index 841c01a..c02f310 100644 --- a/runtime/zip_archive.cc +++ b/runtime/zip_archive.cc @@ -50,13 +50,14 @@ bool ZipEntry::ExtractToFile(File& file, std::string* error_msg) { return true; } -MemMap* ZipEntry::ExtractToMemMap(const char* entry_filename, std::string* error_msg) { +MemMap* ZipEntry::ExtractToMemMap(const char* zip_filename, const char* entry_filename, + std::string* error_msg) { std::string name(entry_filename); name += " extracted in memory from "; - name += entry_filename; + name += zip_filename; std::unique_ptr<MemMap> map(MemMap::MapAnonymous(name.c_str(), - NULL, GetUncompressedLength(), - PROT_READ | PROT_WRITE, false, error_msg)); + NULL, GetUncompressedLength(), + PROT_READ | PROT_WRITE, false, error_msg)); if (map.get() == nullptr) { DCHECK(!error_msg->empty()); return nullptr; diff --git a/runtime/zip_archive.h b/runtime/zip_archive.h index c0e2f2f..865af51 100644 --- a/runtime/zip_archive.h +++ b/runtime/zip_archive.h @@ -37,7 +37,8 @@ class MemMap; class ZipEntry { public: bool ExtractToFile(File& file, std::string* error_msg); - MemMap* ExtractToMemMap(const char* entry_filename, std::string* error_msg); + MemMap* ExtractToMemMap(const char* zip_filename, const char* entry_filename, + std::string* error_msg); virtual ~ZipEntry(); uint32_t GetUncompressedLength(); |