summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKelvin Zhang <zhangkelvin@google.com>2020-09-16 20:06:12 +0200
committerKelvin Zhang <zhangkelvin@google.com>2020-09-16 20:21:37 +0200
commit4f81130039f6a312eba2027b3594a2be282f6b3a (patch)
tree8a910b26d07884180bcef5f5f48781ae642cf99e
parentMerge "Merge Android R" (diff)
downloadandroid_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.tar
android_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.tar.gz
android_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.tar.bz2
android_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.tar.lz
android_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.tar.xz
android_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.tar.zst
android_bootable_recovery-4f81130039f6a312eba2027b3594a2be282f6b3a.zip
-rw-r--r--applypatch/imgdiff.cpp6
-rw-r--r--applypatch/include/applypatch/imgdiff_image.h3
-rw-r--r--install/install.cpp8
-rw-r--r--install/verifier.cpp2
-rw-r--r--install/wipe_device.cpp2
-rw-r--r--tests/unit/install_test.cpp2
-rw-r--r--tests/unit/package_test.cpp2
-rw-r--r--tests/unit/zip_test.cpp2
-rw-r--r--updater/blockimg.cpp8
-rw-r--r--updater/install.cpp4
-rw-r--r--updater/target_files.cpp6
-rw-r--r--updater/updater.cpp2
12 files changed, 24 insertions, 23 deletions
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index 85860281a..d0cb687cb 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -682,9 +682,9 @@ bool ZipModeImage::InitializeChunks(const std::string& filename, ZipArchiveHandl
}
// Create a list of deflated zip entries, sorted by offset.
- std::vector<std::pair<std::string, ZipEntry>> temp_entries;
+ std::vector<std::pair<std::string, ZipEntry64>> temp_entries;
std::string name;
- ZipEntry entry;
+ ZipEntry64 entry;
while ((ret = Next(cookie, &entry, &name)) == 0) {
if (entry.method == kCompressDeflated || limit_ > 0) {
temp_entries.emplace_back(name, entry);
@@ -757,7 +757,7 @@ bool ZipModeImage::InitializeChunks(const std::string& filename, ZipArchiveHandl
}
bool ZipModeImage::AddZipEntryToChunks(ZipArchiveHandle handle, const std::string& entry_name,
- ZipEntry* entry) {
+ ZipEntry64* entry) {
size_t compressed_len = entry->compressed_length;
if (compressed_len == 0) return true;
diff --git a/applypatch/include/applypatch/imgdiff_image.h b/applypatch/include/applypatch/imgdiff_image.h
index aa8d129c3..b579e56ae 100644
--- a/applypatch/include/applypatch/imgdiff_image.h
+++ b/applypatch/include/applypatch/imgdiff_image.h
@@ -257,7 +257,8 @@ class ZipModeImage : public Image {
// Initialize image chunks based on the zip entries.
bool InitializeChunks(const std::string& filename, ZipArchiveHandle handle);
// Add the a zip entry to the list.
- bool AddZipEntryToChunks(ZipArchiveHandle handle, const std::string& entry_name, ZipEntry* entry);
+ bool AddZipEntryToChunks(ZipArchiveHandle handle, const std::string& entry_name,
+ ZipEntry64* entry);
// Return the real size of the zip file. (omit the trailing zeros that used for alignment)
bool GetZipFileSize(size_t* input_file_size);
diff --git a/install/install.cpp b/install/install.cpp
index 1c711f6b3..753373206 100644
--- a/install/install.cpp
+++ b/install/install.cpp
@@ -77,7 +77,7 @@ bool ReadMetadataFromPackage(ZipArchiveHandle zip, std::map<std::string, std::st
CHECK(metadata != nullptr);
static constexpr const char* METADATA_PATH = "META-INF/com/android/metadata";
- ZipEntry entry;
+ ZipEntry64 entry;
if (FindEntry(zip, METADATA_PATH, &entry) != 0) {
LOG(ERROR) << "Failed to find " << METADATA_PATH;
return false;
@@ -241,7 +241,7 @@ bool SetUpAbUpdateCommands(const std::string& package, ZipArchiveHandle zip, int
// For A/B updates we extract the payload properties to a buffer and obtain the RAW payload offset
// in the zip file.
static constexpr const char* AB_OTA_PAYLOAD_PROPERTIES = "payload_properties.txt";
- ZipEntry properties_entry;
+ ZipEntry64 properties_entry;
if (FindEntry(zip, AB_OTA_PAYLOAD_PROPERTIES, &properties_entry) != 0) {
LOG(ERROR) << "Failed to find " << AB_OTA_PAYLOAD_PROPERTIES;
return false;
@@ -256,7 +256,7 @@ bool SetUpAbUpdateCommands(const std::string& package, ZipArchiveHandle zip, int
}
static constexpr const char* AB_OTA_PAYLOAD = "payload.bin";
- ZipEntry payload_entry;
+ ZipEntry64 payload_entry;
if (FindEntry(zip, AB_OTA_PAYLOAD, &payload_entry) != 0) {
LOG(ERROR) << "Failed to find " << AB_OTA_PAYLOAD;
return false;
@@ -278,7 +278,7 @@ bool SetUpNonAbUpdateCommands(const std::string& package, ZipArchiveHandle zip,
// In non-A/B updates we extract the update binary from the package.
static constexpr const char* UPDATE_BINARY_NAME = "META-INF/com/google/android/update-binary";
- ZipEntry binary_entry;
+ ZipEntry64 binary_entry;
if (FindEntry(zip, UPDATE_BINARY_NAME, &binary_entry) != 0) {
LOG(ERROR) << "Failed to find update binary " << UPDATE_BINARY_NAME;
return false;
diff --git a/install/verifier.cpp b/install/verifier.cpp
index ab750442d..d8bc53f69 100644
--- a/install/verifier.cpp
+++ b/install/verifier.cpp
@@ -321,7 +321,7 @@ static std::vector<Certificate> IterateZipEntriesAndSearchForKeys(const ZipArchi
std::vector<Certificate> result;
std::string_view name;
- ZipEntry entry;
+ ZipEntry64 entry;
while ((iter_status = Next(cookie, &entry, &name)) == 0) {
std::vector<uint8_t> pem_content(entry.uncompressed_length);
if (int32_t extract_status =
diff --git a/install/wipe_device.cpp b/install/wipe_device.cpp
index 89d5d31a3..0f896c43b 100644
--- a/install/wipe_device.cpp
+++ b/install/wipe_device.cpp
@@ -49,7 +49,7 @@ std::vector<std::string> GetWipePartitionList(Package* wipe_package) {
constexpr char RECOVERY_WIPE_ENTRY_NAME[] = "recovery.wipe";
std::string partition_list_content;
- ZipEntry entry;
+ ZipEntry64 entry;
if (FindEntry(zip, RECOVERY_WIPE_ENTRY_NAME, &entry) == 0) {
uint32_t length = entry.uncompressed_length;
partition_list_content = std::string(length, '\0');
diff --git a/tests/unit/install_test.cpp b/tests/unit/install_test.cpp
index fc7c2bf2f..c3415479d 100644
--- a/tests/unit/install_test.cpp
+++ b/tests/unit/install_test.cpp
@@ -190,7 +190,7 @@ static void VerifyAbUpdateCommands(const std::string& serialno, bool success = t
ZipArchiveHandle zip;
ASSERT_EQ(0, OpenArchive(temp_file.path, &zip));
- ZipEntry payload_entry;
+ ZipEntry64 payload_entry;
ASSERT_EQ(0, FindEntry(zip, "payload.bin", &payload_entry));
std::map<std::string, std::string> metadata;
diff --git a/tests/unit/package_test.cpp b/tests/unit/package_test.cpp
index 5e31f7fa5..164a93d57 100644
--- a/tests/unit/package_test.cpp
+++ b/tests/unit/package_test.cpp
@@ -106,7 +106,7 @@ TEST_F(PackageTest, GetZipArchiveHandle_extract_entry) {
// Check that we can extract one zip entry.
std::string_view entry_name = "dir1/file3.txt";
- ZipEntry entry;
+ ZipEntry64 entry;
ASSERT_EQ(0, FindEntry(zip, entry_name, &entry));
std::vector<uint8_t> extracted(entry_name.size());
diff --git a/tests/unit/zip_test.cpp b/tests/unit/zip_test.cpp
index ec9585c79..e065bb859 100644
--- a/tests/unit/zip_test.cpp
+++ b/tests/unit/zip_test.cpp
@@ -37,7 +37,7 @@ TEST(ZipTest, OpenFromMemory) {
ASSERT_EQ(0, OpenArchiveFromMemory(map.addr, map.length, zip_path.c_str(), &handle));
static constexpr const char* BINARY_PATH = "META-INF/com/google/android/update-binary";
- ZipEntry binary_entry;
+ ZipEntry64 binary_entry;
// Make sure the package opens correctly and its entry can be read.
ASSERT_EQ(0, FindEntry(handle, BINARY_PATH, &binary_entry));
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 2d41f610b..b29aa8ce3 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -348,7 +348,7 @@ class RangeSinkWriter {
*/
struct NewThreadInfo {
ZipArchiveHandle za;
- ZipEntry entry;
+ ZipEntry64 entry{};
bool brotli_compressed;
std::unique_ptr<RangeSinkWriter> writer;
@@ -1626,7 +1626,7 @@ static bool Sha1DevicePath(const std::string& path, uint8_t digest[SHA_DIGEST_LE
static Value* PerformBlockImageUpdate(const char* name, State* state,
const std::vector<std::unique_ptr<Expr>>& argv,
const CommandMap& command_map, bool dryrun) {
- CommandParameters params = {};
+ CommandParameters params{};
stash_map.clear();
params.canwrite = !dryrun;
@@ -1687,7 +1687,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
}
std::string_view path_data(patch_data_fn->data);
- ZipEntry patch_entry;
+ ZipEntry64 patch_entry;
if (FindEntry(za, path_data, &patch_entry) != 0) {
LOG(ERROR) << name << "(): no file \"" << patch_data_fn->data << "\" in package";
return StringValue("");
@@ -1695,7 +1695,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
params.patch_start = updater->GetMappedPackageAddress() + patch_entry.offset;
std::string_view new_data(new_data_fn->data);
- ZipEntry new_entry;
+ ZipEntry64 new_entry;
if (FindEntry(za, new_data, &new_entry) != 0) {
LOG(ERROR) << name << "(): no file \"" << new_data_fn->data << "\" in package";
return StringValue("");
diff --git a/updater/install.cpp b/updater/install.cpp
index afa5195d0..cfa4d9d82 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -115,7 +115,7 @@ Value* PackageExtractFileFn(const char* name, State* state,
std::string dest_path = args[1];
ZipArchiveHandle za = state->updater->GetPackageHandle();
- ZipEntry entry;
+ ZipEntry64 entry;
if (FindEntry(za, zip_path, &entry) != 0) {
LOG(ERROR) << name << ": no " << zip_path << " in package";
return StringValue("");
@@ -165,7 +165,7 @@ Value* PackageExtractFileFn(const char* name, State* state,
const std::string& zip_path = args[0];
ZipArchiveHandle za = state->updater->GetPackageHandle();
- ZipEntry entry;
+ ZipEntry64 entry;
if (FindEntry(za, zip_path, &entry) != 0) {
return ErrorAbort(state, kPackageExtractFileFailure, "%s(): no %s in package", name,
zip_path.c_str());
diff --git a/updater/target_files.cpp b/updater/target_files.cpp
index 919ec4e04..951923293 100644
--- a/updater/target_files.cpp
+++ b/updater/target_files.cpp
@@ -115,7 +115,7 @@ bool TargetFile::EntryExists(const std::string_view name) const {
}
CHECK(handle_);
- ZipEntry img_entry;
+ ZipEntry64 img_entry;
return FindEntry(handle_, name, &img_entry) == 0;
}
@@ -126,7 +126,7 @@ bool TargetFile::ReadEntryToString(const std::string_view name, std::string* con
}
CHECK(handle_);
- ZipEntry entry;
+ ZipEntry64 entry;
if (auto find_err = FindEntry(handle_, name, &entry); find_err != 0) {
LOG(ERROR) << "failed to find " << name << " in the package: " << ErrorCodeString(find_err);
return false;
@@ -157,7 +157,7 @@ bool TargetFile::ExtractEntryToTempFile(const std::string_view name,
}
CHECK(handle_);
- ZipEntry entry;
+ ZipEntry64 entry;
if (auto find_err = FindEntry(handle_, name, &entry); find_err != 0) {
LOG(ERROR) << "failed to find " << name << " in the package: " << ErrorCodeString(find_err);
return false;
diff --git a/updater/updater.cpp b/updater/updater.cpp
index 8f4a6ede5..73ca0e532 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -163,7 +163,7 @@ void Updater::ParseAndReportErrorCode(State* state) {
bool Updater::ReadEntryToString(ZipArchiveHandle za, const std::string& entry_name,
std::string* content) {
- ZipEntry entry;
+ ZipEntry64 entry;
int find_err = FindEntry(za, entry_name, &entry);
if (find_err != 0) {
LOG(ERROR) << "failed to find " << entry_name