summaryrefslogtreecommitdiff
path: root/libs/utils/ZipFileRO.cpp
diff options
context:
space:
mode:
author Kenny Root <kroot@google.com> 2010-09-07 19:30:22 -0700
committer Kenny Root <kroot@google.com> 2010-09-07 19:30:22 -0700
commitdc2d840ff76b406131cf0ba8f133778eeabffeab (patch)
treed3b29d5d9956edfd93c2016d5d6eb5a40ca2aecd /libs/utils/ZipFileRO.cpp
parentcfaf307ec52c5f89adf1221068e015bfe4f5febb (diff)
Revert "Free created FileMap when uncompressing files"
This reverts commit 52b8235238fb4d8cf141020cc1ae33880929dc3f. munmap() on a region that overlaps something else (e.g, the ZIP Central Directory in this case) unmaps those other regions as well making the ZipFileRO class unhappy. Revert this for now until we can have FileMap deal with this craziness.
Diffstat (limited to 'libs/utils/ZipFileRO.cpp')
-rw-r--r--libs/utils/ZipFileRO.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp
index a0e01c693d..2d53136c14 100644
--- a/libs/utils/ZipFileRO.cpp
+++ b/libs/utils/ZipFileRO.cpp
@@ -636,7 +636,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const
memcpy(buffer, ptr, uncompLen);
} else {
if (!inflateBuffer(buffer, ptr, uncompLen, compLen))
- goto unmap;
+ goto bail;
}
if (compLen > kSequentialMin)
@@ -644,8 +644,6 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const
result = true;
-unmap:
- file->release();
bail:
return result;
}
@@ -669,7 +667,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const
getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL);
- FileMap* file = createEntryFileMap(entry);
+ const FileMap* file = createEntryFileMap(entry);
if (file == NULL) {
goto bail;
}
@@ -680,23 +678,21 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const
ssize_t actual = write(fd, ptr, uncompLen);
if (actual < 0) {
LOGE("Write failed: %s\n", strerror(errno));
- goto unmap;
+ goto bail;
} else if ((size_t) actual != uncompLen) {
LOGE("Partial write during uncompress (%zd of %zd)\n",
(size_t)actual, (size_t)uncompLen);
- goto unmap;
+ goto bail;
} else {
LOGI("+++ successful write\n");
}
} else {
if (!inflateBuffer(fd, ptr, uncompLen, compLen))
- goto unmap;
+ goto bail;
}
result = true;
-unmap:
- file->release();
bail:
return result;
}