The Local File Header (LFH) offset is printed in debugging cases when
the platform is inspecting APKs. This adds the LFH offset field to the
list of contents of an APK, so that it can be checked easily against the
Central Directory (CD).
Change-Id: I08f9a13256bfe6563c1a963c4f0289789b2e7857
if (bundle->getVerbose()) {
printf("Archive: %s\n", zipFileName);
printf(
if (bundle->getVerbose()) {
printf("Archive: %s\n", zipFileName);
printf(
- " Length Method Size Ratio Date Time CRC-32 Name\n");
+ " Length Method Size Ratio Offset Date Time CRC-32 Name\n");
- "-------- ------ ------- ----- ---- ---- ------ ----\n");
+ "-------- ------ ------- ----- ------- ---- ---- ------ ----\n");
}
totalUncLen = totalCompLen = 0;
}
totalUncLen = totalCompLen = 0;
strftime(dateBuf, sizeof(dateBuf), "%m-%d-%y %H:%M",
localtime(&when));
strftime(dateBuf, sizeof(dateBuf), "%m-%d-%y %H:%M",
localtime(&when));
- printf("%8ld %-7.7s %7ld %3d%% %s %08lx %s\n",
+ printf("%8ld %-7.7s %7ld %3d%% %8zd %s %08lx %s\n",
(long) entry->getUncompressedLen(),
compressionName(entry->getCompressionMethod()),
(long) entry->getCompressedLen(),
calcPercent(entry->getUncompressedLen(),
entry->getCompressedLen()),
(long) entry->getUncompressedLen(),
compressionName(entry->getCompressionMethod()),
(long) entry->getCompressedLen(),
calcPercent(entry->getUncompressedLen(),
entry->getCompressedLen()),
+ (size_t) entry->getLFHOffset(),
dateBuf,
entry->getCRC32(),
entry->getFileName());
dateBuf,
entry->getCRC32(),
entry->getFileName());
*/
off_t getCompressedLen(void) const { return mCDE.mCompressedSize; }
*/
off_t getCompressedLen(void) const { return mCDE.mCompressedSize; }
+ /*
+ * Return the offset of the local file header.
+ */
+ off_t getLFHOffset(void) const { return mCDE.mLocalHeaderRelOffset; }
+
/*
* Return the absolute file offset of the start of the compressed or
* uncompressed data.
/*
* Return the absolute file offset of the start of the compressed or
* uncompressed data.
*/
void setModWhen(time_t when);
*/
void setModWhen(time_t when);
- /*
- * Return the offset of the local file header.
- */
- off_t getLFHOffset(void) const { return mCDE.mLocalHeaderRelOffset; }
-
/*
* Set the offset of the local file header, relative to the start of
* the current file.
/*
* Set the offset of the local file header, relative to the start of
* the current file.