summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dex2oat/dex2oat.cc5
-rw-r--r--runtime/dex_file.cc2
-rw-r--r--runtime/zip_archive.cc9
-rw-r--r--runtime/zip_archive.h3
4 files changed, 11 insertions, 8 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index f0b575041d..2126625837 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 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();