From f8580e524596ee40b19a53fce6b17c3cd2132cfc Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Thu, 23 Feb 2023 18:27:04 +0000 Subject: Refactor zip loading in DexFileLoader Remove OpenAllDexFilesFromZip and VerifyResult. Both of those can be simplified and inlined. Bug: 266950186 Test: test.py -b --host --optimizing --64 Change-Id: Ia05edf81a70ab24654f92086599c4a3369fc2591 --- libdexfile/dex/dex_file_loader.h | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'libdexfile/dex/dex_file_loader.h') diff --git a/libdexfile/dex/dex_file_loader.h b/libdexfile/dex/dex_file_loader.h index a2a29bc44e..0b949508cc 100644 --- a/libdexfile/dex/dex_file_loader.h +++ b/libdexfile/dex/dex_file_loader.h @@ -192,12 +192,6 @@ class DexFileLoader { } protected: - enum class VerifyResult { // private - kVerifyNotAttempted, - kVerifySucceeded, - kVerifyFailed - }; - bool InitAndReadMagic(uint32_t* magic, std::string* error_msg); // Ensure we have root container. If we are backed by a file, memory-map it. @@ -211,27 +205,17 @@ class DexFileLoader { bool verify, bool verify_checksum, std::string* error_msg, - VerifyResult* verify_result); - - // Open all classesXXX.dex files from a zip archive. - bool OpenAllDexFilesFromZip(const ZipArchive& zip_archive, - const std::string& location, - bool verify, - bool verify_checksum, - bool allow_no_dex_files, - DexFileLoaderErrorCode* error_code, - std::string* error_msg, - std::vector>* dex_files) const; - - // Opens .dex file from the entry_name in a zip archive. error_code is undefined when non-null - // return. - std::unique_ptr OpenOneDexFileFromZip(const ZipArchive& zip_archive, - const char* entry_name, - const std::string& location, - bool verify, - bool verify_checksum, - DexFileLoaderErrorCode* error_code, - std::string* error_msg) const; + DexFileLoaderErrorCode* error_code); + + // Open .dex files from the entry_name in a zip archive. + bool OpenFromZipEntry(const ZipArchive& zip_archive, + const char* entry_name, + const std::string& location, + bool verify, + bool verify_checksum, + DexFileLoaderErrorCode* error_code, + std::string* error_msg, + std::vector>* dex_files) const; // The DexFileLoader can be backed either by file or by memory (i.e. DexFileContainer). // We can not just mmap the file since APKs might be unreasonably large for 32-bit system. -- cgit v1.2.3-59-g8ed1b