diff options
| author | 2020-11-13 20:42:50 +0000 | |
|---|---|---|
| committer | 2020-11-13 20:42:50 +0000 | |
| commit | e5fd58a62d24ec3d173f1924b6fcb7fb011b7f67 (patch) | |
| tree | 9ca2a6c22daa8e7836b676eb02b5f1a3fc9bed8b /tools/zipalign/ZipAlign.cpp | |
| parent | cd4e7c023453e06603ec2b07de62e2c2aa6db1d8 (diff) | |
| parent | a720635be20f4fc3acd39c7b83b919140ced0f94 (diff) | |
Merge "Fix zipalign alignment error"
Diffstat (limited to 'tools/zipalign/ZipAlign.cpp')
| -rw-r--r-- | tools/zipalign/ZipAlign.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp index 1851ac562c..08f67ff9d0 100644 --- a/tools/zipalign/ZipAlign.cpp +++ b/tools/zipalign/ZipAlign.cpp @@ -47,7 +47,6 @@ static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfl { int numEntries = pZin->getNumEntries(); ZipEntry* pEntry; - int bias = 0; status_t status; for (int i = 0; i < numEntries; i++) { @@ -68,30 +67,20 @@ static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfl if (zopfli) { status = pZout->addRecompress(pZin, pEntry, &pNewEntry); - bias += pNewEntry->getCompressedLen() - pEntry->getCompressedLen(); } else { status = pZout->add(pZin, pEntry, padding, &pNewEntry); } } else { const int alignTo = getAlignment(pageAlignSharedLibs, alignment, pEntry); - /* - * Copy the entry, adjusting as required. We assume that the - * file position in the new file will be equal to the file - * position in the original. - */ - off_t newOffset = pEntry->getFileOffset() + bias; - padding = (alignTo - (newOffset % alignTo)) % alignTo; - //printf("--- %s: orig at %ld(+%d) len=%ld, adding pad=%d\n", // pEntry->getFileName(), (long) pEntry->getFileOffset(), // bias, (long) pEntry->getUncompressedLen(), padding); - status = pZout->add(pZin, pEntry, padding, &pNewEntry); + status = pZout->add(pZin, pEntry, alignTo, &pNewEntry); } if (status != OK) return 1; - bias += padding; //printf(" added '%s' at %ld (pad=%d)\n", // pNewEntry->getFileName(), (long) pNewEntry->getFileOffset(), // padding); |