diff options
Diffstat (limited to '')
-rw-r--r-- | minzip/SysUtil.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/minzip/SysUtil.c b/minzip/SysUtil.c index b160c9e3d..1858cd515 100644 --- a/minzip/SysUtil.c +++ b/minzip/SysUtil.c @@ -118,7 +118,12 @@ static int sysMapBlockFile(FILE* mapf, MemMapping* pMap) // Reserve enough contiguous address space for the whole file. unsigned char* reserve; +#if (PLATFORM_SDK_VERSION >= 21) reserve = mmap64(NULL, blocks * blksize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); +#else + // Older versions of Android do not have mmap64 so we will just use mmap instead + reserve = mmap(NULL, blocks * blksize, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); +#endif if (reserve == MAP_FAILED) { LOGW("failed to reserve address space: %s\n", strerror(errno)); return -1; @@ -140,8 +145,12 @@ static int sysMapBlockFile(FILE* mapf, MemMapping* pMap) LOGW("failed to parse range %d in block map\n", i); return -1; } - +#if (PLATFORM_SDK_VERSION >= 21) void* addr = mmap64(next, (end-start)*blksize, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, ((off64_t)start)*blksize); +#else + // Older versions of Android do not have mmap64 so we will just use mmap instead + void* addr = mmap(next, (end-start)*blksize, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, ((off64_t)start)*blksize); +#endif if (addr == MAP_FAILED) { LOGW("failed to map block %d: %s\n", i, strerror(errno)); return -1; |