package zziplib: enable mmap support

This commit is contained in:
Gregory Smith 2013-10-05 20:35:51 +10:00 committed by Tony Theodore
parent 58f8d06d3f
commit 926f4baca0
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,37 @@
This file is part of MXE.
See index.html for further information.
This patch has been taken from:
http://sourceforge.net/tracker/?func=detail&aid=2995373&group_id=6389&atid=306389
--- zziplib-0.13.59/zzip/__mmap.h 2013-10-03 22:23:32.467619238 -0400
+++ zzip-patched/zzip/__mmap.h 2013-10-04 21:44:16.412881609 -0400
@@ -63,14 +63,15 @@
return 0;
{
HANDLE hFile = (HANDLE)_get_osfhandle(fd);
+ HANDLE fileMapping = NULL;
if (hFile)
- *user = (int) CreateFileMapping (hFile, 0, PAGE_READONLY, 0, 0, NULL);
- if (*user)
+ fileMapping = CreateFileMapping(hFile, 0, PAGE_READONLY, 0, 0, NULL);
+ if (fileMapping != NULL)
{
char* p = 0;
- p = MapViewOfFile(*(HANDLE*)user, FILE_MAP_READ, 0, offs, len);
- if (p) return p + offs;
- CloseHandle (*(HANDLE*)user); *user = 1;
+ p = MapViewOfFile(fileMapping, FILE_MAP_READ, 0, offs, len);
+ CloseHandle (fileMapping);
+ if (p) return p;
}
return MAP_FAILED;
}
@@ -78,7 +79,6 @@
static void win32_munmap (long* user, char* fd_map, size_t len)
{
UnmapViewOfFile (fd_map);
- CloseHandle (*(HANDLE*)user); *user = 1;
}
#define _zzip_mmap(user, fd, offs, len) \

View File

@ -23,9 +23,9 @@ define $(PKG)_BUILD
(echo '# DISABLED'; echo 'all:'; echo 'install:') > '$(1)/docs/Makefile.in'
cd '$(1)' && ./configure \
--host='$(TARGET)' \
--disable-mmap \
--disable-shared \
--prefix='$(PREFIX)/$(TARGET)' \
CFLAGS="-O -ggdb" \
PKG_CONFIG='$(TARGET)-pkg-config'
$(MAKE) -C '$(1)' -j '$(JOBS)' bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=
$(MAKE) -C '$(1)' -j 1 install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=