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 /runtime | |
parent | 52925af1e3136bcf68bc5754fbfa407950235217 (diff) | |
download | android_art-0aa504b5bb19f0944d50941b20c8eeaca4165328.tar.gz android_art-0aa504b5bb19f0944d50941b20c8eeaca4165328.tar.bz2 android_art-0aa504b5bb19f0944d50941b20c8eeaca4165328.zip |
Fix ExtractToMemMap to show original zip file name in ashmem
(cherry picked from commit 1fca8e91f32dc8b13d3129b7ef4a0194839736e6)
Change-Id: Id7d22600496b090ac32150c8c6424da89964b6be
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/dex_file.cc | 2 | ||||
-rw-r--r-- | runtime/zip_archive.cc | 9 | ||||
-rw-r--r-- | runtime/zip_archive.h | 3 |
3 files changed, 8 insertions, 6 deletions
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index 43ae3081df..9cb2f1ba01 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 841c01a760..c02f3106be 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 c0e2f2f865..865af515d8 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(); |