diff options
author | caozhiyuan <cao.zhiyuan@zte.com.cn> | 2016-03-21 20:15:49 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-03-21 20:15:49 +0100 |
commit | 9570508c0be67f75553571bed7f4b343a1cc591c (patch) | |
tree | f3ac39b3965399596f2e6c892e49bc8f0014b04b | |
parent | recovery: Move SwipeDetector into common location (diff) | |
parent | Merge "Fix: full ota package larger than 2GB fails to upgrade" (diff) | |
download | android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.tar android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.tar.gz android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.tar.bz2 android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.tar.lz android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.tar.xz android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.tar.zst android_bootable_recovery-9570508c0be67f75553571bed7f4b343a1cc591c.zip |
-rw-r--r-- | minzip/Zip.c | 16 | ||||
-rw-r--r-- | minzip/Zip.h | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/minzip/Zip.c b/minzip/Zip.c index 38f939fb2..0f89835ca 100644 --- a/minzip/Zip.c +++ b/minzip/Zip.c @@ -91,7 +91,7 @@ enum { static void dumpEntry(const ZipEntry* pEntry) { LOGI(" %p '%.*s'\n", pEntry->fileName,pEntry->fileNameLen,pEntry->fileName); - LOGI(" off=%ld comp=%ld uncomp=%ld how=%d\n", pEntry->offset, + LOGI(" off=%u comp=%u uncomp=%u how=%d\n", pEntry->offset, pEntry->compLen, pEntry->uncompLen, pEntry->compression); } #endif @@ -505,7 +505,8 @@ static bool processDeflatedEntry(const ZipArchive *pArchive, const ZipEntry *pEntry, ProcessZipEntryContentsFunction processFunction, void *cookie) { - long result = -1; + bool success = false; + unsigned long totalOut = 0; unsigned char procBuf[32 * 1024]; z_stream zstream; int zerr; @@ -569,16 +570,17 @@ static bool processDeflatedEntry(const ZipArchive *pArchive, assert(zerr == Z_STREAM_END); /* other errors should've been caught */ // success! - result = zstream.total_out; + totalOut = zstream.total_out; + success = true; z_bail: inflateEnd(&zstream); /* free up any allocated structures */ bail: - if (result != pEntry->uncompLen) { - if (result != -1) // error already shown? - LOGW("Size mismatch on inflated file (%ld vs %ld)\n", - result, pEntry->uncompLen); + if (totalOut != pEntry->uncompLen) { + if (success) { // error already shown? + LOGW("Size mismatch on inflated file (%lu vs %u)\n", totalOut, pEntry->uncompLen); + } return false; } return true; diff --git a/minzip/Zip.h b/minzip/Zip.h index 86d8db597..e6b19e1f0 100644 --- a/minzip/Zip.h +++ b/minzip/Zip.h @@ -32,9 +32,9 @@ extern "C" { typedef struct ZipEntry { unsigned int fileNameLen; const char* fileName; // not null-terminated - long offset; - long compLen; - long uncompLen; + uint32_t offset; + uint32_t compLen; + uint32_t uncompLen; int compression; long modTime; long crc32; @@ -85,10 +85,10 @@ void mzCloseZipArchive(ZipArchive* pArchive); const ZipEntry* mzFindZipEntry(const ZipArchive* pArchive, const char* entryName); -INLINE long mzGetZipEntryOffset(const ZipEntry* pEntry) { +INLINE uint32_t mzGetZipEntryOffset(const ZipEntry* pEntry) { return pEntry->offset; } -INLINE long mzGetZipEntryUncompLen(const ZipEntry* pEntry) { +INLINE uint32_t mzGetZipEntryUncompLen(const ZipEntry* pEntry) { return pEntry->uncompLen; } |