Zipalign: Avoid unnecessary padding
Problem: Aligned entry always get padded to the next aligned slot.
Solution: Fix alignment test.
Bug: 199932309
Test: align_test.cpp
Change-Id: I1e61c67dcf45454dd782d0fcc6903f7e71954083
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 6037d59..f2f65a6 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -530,7 +530,7 @@
// If the alignment is not what was requested, add some padding in the extra
// so the payload ends up where is requested.
uint64_t alignDiff = alignTo - (expectedPayloadOffset % alignTo);
- if (alignDiff == 0)
+ if (alignDiff == alignTo)
return OK;
return pEntry->addPadding(alignDiff);