diff options
author | Narayan Kamath <narayan@google.com> | 2015-06-16 12:02:57 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2015-06-17 08:40:25 +0000 |
commit | 4600dd053dbdbd4b95f3b11057a1cc55b99f9c77 (patch) | |
tree | c4bb116de6b55b054a73083165c9512fbf21c164 /libs/androidfw/Asset.cpp | |
parent | 5e063b1da52cca1b93b19bdf7be694aabf95d336 (diff) |
ZipFileRO: Use precise widths for zip file types.
getEntryInfo crashes on 64-bit devices because "long" types
were being passed int pointers (that pointed to a stack frame)
that were reinterpret_cast'ed to long* (sigh.). To fix this issue
once and for all, use types with explicitly defined widths.
This change also removes some dead invariant checking from
Asset.cpp instead of cleaning it up.
Note that we've introduced a wart in NativeLibraryHelper, where
we need to deal with zlib's uLong type, which is "at least 32 bits
wide".
bug: 21622286
Change-Id: Iae675a9601db7aae03a8b80b40321d2cc1d97f50
Diffstat (limited to 'libs/androidfw/Asset.cpp')
-rw-r--r-- | libs/androidfw/Asset.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp index 782806e55429..4e14b13dc8bd 100644 --- a/libs/androidfw/Asset.cpp +++ b/libs/androidfw/Asset.cpp @@ -296,13 +296,13 @@ Asset::~Asset(void) * Create a new Asset from compressed data in a memory mapping. */ /*static*/ Asset* Asset::createFromCompressedMap(FileMap* dataMap, - int method, size_t uncompressedLen, AccessMode mode) + size_t uncompressedLen, AccessMode mode) { _CompressedAsset* pAsset; status_t result; pAsset = new _CompressedAsset; - result = pAsset->openChunk(dataMap, method, uncompressedLen); + result = pAsset->openChunk(dataMap, uncompressedLen); if (result != NO_ERROR) return NULL; @@ -734,18 +734,12 @@ status_t _CompressedAsset::openChunk(int fd, off64_t offset, * * Nothing is expanded until the first read call. */ -status_t _CompressedAsset::openChunk(FileMap* dataMap, int compressionMethod, - size_t uncompressedLen) +status_t _CompressedAsset::openChunk(FileMap* dataMap, size_t uncompressedLen) { assert(mFd < 0); // no re-open assert(mMap == NULL); assert(dataMap != NULL); - if (compressionMethod != ZipFileRO::kCompressDeflated) { - assert(false); - return UNKNOWN_ERROR; - } - mMap = dataMap; mStart = -1; // not used mCompressedLen = dataMap->getDataLength(); |