diff options
author | 2015-06-16 12:02:57 +0100 | |
---|---|---|
committer | 2015-06-17 08:40:25 +0000 | |
commit | 4600dd053dbdbd4b95f3b11057a1cc55b99f9c77 (patch) | |
tree | c4bb116de6b55b054a73083165c9512fbf21c164 /include/androidfw/ZipUtils.h | |
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 'include/androidfw/ZipUtils.h')
-rw-r--r-- | include/androidfw/ZipUtils.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/androidfw/ZipUtils.h b/include/androidfw/ZipUtils.h index 6bea25af808e..094eaa8dd214 100644 --- a/include/androidfw/ZipUtils.h +++ b/include/androidfw/ZipUtils.h @@ -20,6 +20,7 @@ #ifndef __LIBS_ZIPUTILS_H #define __LIBS_ZIPUTILS_H +#include <stdint.h> #include <stdio.h> #include <time.h> @@ -63,8 +64,8 @@ public: /* * Utility function to convert ZIP's time format to a timespec struct. */ - static inline void zipTimeToTimespec(long when, struct tm* timespec) { - const long date = when >> 16; + static inline void zipTimeToTimespec(uint32_t when, struct tm* timespec) { + const uint32_t date = when >> 16; timespec->tm_year = ((date >> 9) & 0x7F) + 80; // Zip is years since 1980 timespec->tm_mon = (date >> 5) & 0x0F; timespec->tm_mday = date & 0x1F; |