summaryrefslogtreecommitdiff
path: root/tools/zipalign/ZipFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/zipalign/ZipFile.cpp')
-rw-r--r--tools/zipalign/ZipFile.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 1e3c4135f1..f2f65a63bc 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -530,7 +530,7 @@ status_t ZipFile::alignEntry(android::ZipEntry* pEntry, uint32_t alignTo){
// 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);
@@ -654,7 +654,7 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
{
ZipEntry* pEntry = NULL;
status_t result;
- long lfhPosn, startPosn, endPosn, uncompressedLen;
+ long lfhPosn, uncompressedLen;
if (mReadOnly)
return INVALID_OPERATION;
@@ -690,7 +690,6 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
*/
lfhPosn = ftell(mZipFp);
pEntry->mLFH.write(mZipFp);
- startPosn = ftell(mZipFp);
/*
* Copy the data over.
@@ -741,18 +740,13 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
}
/*
- * Update file offsets.
- */
- endPosn = ftell(mZipFp);
-
- /*
* Success! Fill out new values.
*/
pEntry->setLFHOffset(lfhPosn);
mEOCD.mNumEntries++;
mEOCD.mTotalNumEntries++;
mEOCD.mCentralDirSize = 0; // mark invalid; set by flush()
- mEOCD.mCentralDirOffset = endPosn;
+ mEOCD.mCentralDirOffset = ftell(mZipFp);
/*
* Go back and write the LFH.