twrpinstall: Switch to ZipEntry64
The libziparchive TWRP using was outdated, not supported a zip
size more than 4 GiB. With the development of technologies,
Obviously it was not enough for ROM packages, like Xiaomi's
MIUI for Vitrual A/B devices (for example Redmi K40 [alioth])
is more than 4 GiB and TWRP couldn't handle it properly.
Since we have updated libziparchive to latest version, we could
switch ZipEntry to ZipEntry64 so that TWRP can support a ROM
package if its size more than 4 GiB.
Co-authored-by: sekaiacg <sekaiacg@gmail.com>
Signed-off-by: GarfieldHan <2652609017@qq.com>
Change-Id: Iee811554bb08e02bf2bd8e9057511f36caefdc9d
(cherry picked from commit b3f6a264222b6b6e87d32da6c6feb65f0e635d06)
diff --git a/twrpinstall/twinstall.cpp b/twrpinstall/twinstall.cpp
index 93164e1..e1f8415 100755
--- a/twrpinstall/twinstall.cpp
+++ b/twrpinstall/twinstall.cpp
@@ -74,7 +74,7 @@
return INSTALL_CORRUPT;
#else
std::string binary_name("ui.xml");
- ZipEntry binary_entry;
+ ZipEntry64 binary_entry;
if (FindEntry(Zip, binary_name, &binary_entry) != 0) {
return INSTALL_CORRUPT;
}
@@ -106,7 +106,7 @@
std::vector<string>::iterator arch;
std::string base_name = UPDATE_BINARY_NAME;
base_name += "-";
- ZipEntry binary_entry;
+ ZipEntry64 binary_entry;
std::string update_binary_string(UPDATE_BINARY_NAME);
if (FindEntry(Zip, update_binary_string, &binary_entry) != 0) {
for (arch = split.begin(); arch != split.end(); arch++) {
@@ -133,7 +133,7 @@
// If exists, extract file_contexts from the zip file
std::string file_contexts("file_contexts");
- ZipEntry file_contexts_entry;
+ ZipEntry64 file_contexts_entry;
if (FindEntry(Zip, file_contexts, &file_contexts_entry) != 0) {
LOGINFO("Zip does not contain SELinux file_contexts file in its root.\n");
} else {
@@ -309,7 +309,7 @@
time(&start);
std::string update_binary_name(UPDATE_BINARY_NAME);
- ZipEntry update_binary_entry;
+ ZipEntry64 update_binary_entry;
if (FindEntry(Zip, update_binary_name, &update_binary_entry) == 0) {
LOGINFO("Update binary zip\n");
// Additionally verify the compatibility of the package.
@@ -323,7 +323,7 @@
}
} else {
std::string ab_binary_name(AB_OTA);
- ZipEntry ab_binary_entry;
+ ZipEntry64 ab_binary_entry;
if (FindEntry(Zip, ab_binary_name, &ab_binary_entry) == 0) {
LOGINFO("AB zip\n");
gui_msg(Msg(msg::kHighlight, "flash_ab_inactive=Flashing A/B zip to inactive slot: {1}")(PartitionManager.Get_Active_Slot_Display()=="A"?"B":"A"));
@@ -353,7 +353,7 @@
}
} else {
std::string binary_name("ui.xml");
- ZipEntry binary_entry;
+ ZipEntry64 binary_entry;
if (FindEntry(Zip, binary_name, &binary_entry) != 0) {
LOGINFO("TWRP theme zip\n");
ret_val = Install_Theme(path, Zip);