Fix: full ota package larger than 2GB fails to upgrade
Change-Id: I45d9fab8739cc6fa8a0bacaca9238896118d9d7f
Signed-off-by: diruomeng <di.ruomeng@zte.com.cn>
Signed-off-by: caozhiyuan <cao.zhiyuan@zte.com.cn>
diff --git a/minzip/Zip.c b/minzip/Zip.c
index 38f939f..0f89835 100644
--- a/minzip/Zip.c
+++ b/minzip/Zip.c
@@ -91,7 +91,7 @@
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 @@
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 @@
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;