diff -ur mc-4.6.0-gentoo/src/view.c mc-4.6.0-largefile/src/view.c --- mc-4.6.0-gentoo/src/view.c 2004-09-16 03:59:30.177753168 +0400 +++ mc-4.6.0-largefile/src/view.c 2004-09-16 03:51:31.000000000 +0400 @@ -81,6 +81,12 @@ #define vwidth (view->widget.cols - (view->have_frame ? 2 : 0)) #define vheight (view->widget.lines - (view->have_frame ? 2 : 0)) +#if GLIB_MAJOR_VERSION >= 2 +# define my_g_malloc g_try_malloc +#else +# define my_g_malloc g_malloc +#endif + /* The growing buffers data types */ typedef struct block_ptr_t { unsigned char *data; @@ -580,7 +586,7 @@ view->data = mc_mmap (0, view->s.st_size, PROT_READ, MAP_FILE | MAP_SHARED, view->file, 0); - if ((caddr_t) view->data != (caddr_t) - 1) { + if (view->data != (void *)-1) { /* mmap worked */ view->first = 0; view->bytes_read = view->s.st_size; @@ -593,6 +599,9 @@ * file into memory (alex@bcs.zaporizhzhe.ua). Also, mmap can fail * for any reason, so we use this as fallback (pavel@ucw.cz) */ + /* If large file support is enabled, st_size is a 64 bit value and + * will thus on 32 bit platforms possibly be beyond the range of gulong */ + if ((gulong) view->s.st_size == view->s.st_size) view->data = (unsigned char *) g_try_malloc (view->s.st_size); else diff -ur mc-4.6.0-gentoo/vfs/local.c mc-4.6.0-largefile/vfs/local.c --- mc-4.6.0-gentoo/vfs/local.c 2002-09-23 10:45:33.000000000 +0400 +++ mc-4.6.0-largefile/vfs/local.c 2004-09-16 03:45:21.000000000 +0400 @@ -282,8 +282,8 @@ } #ifdef HAVE_MMAP -caddr_t -local_mmap (vfs *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset) +void * +local_mmap (vfs *me, void *addr, size_t len, int prot, int flags, void *data, off_t offset) { int fd = * (int *)data; @@ -291,7 +291,7 @@ } int -local_munmap (vfs *me, caddr_t addr, size_t len, void *data) +local_munmap (vfs *me, void *addr, size_t len, void *data) { return munmap (addr, len); } diff -ur mc-4.6.0-gentoo/vfs/local.h mc-4.6.0-largefile/vfs/local.h --- mc-4.6.0-gentoo/vfs/local.h 1998-12-16 01:30:55.000000000 +0300 +++ mc-4.6.0-largefile/vfs/local.h 2004-09-16 03:45:21.000000000 +0400 @@ -7,8 +7,8 @@ extern int local_errno (vfs *me); extern int local_lseek (void *data, off_t offset, int whence); #ifdef HAVE_MMAP -extern caddr_t local_mmap (vfs *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset); -extern int local_munmap (vfs *me, caddr_t addr, size_t len, void *data); +extern void *local_mmap (vfs *me, void *addr, size_t len, int prot, int flags, void *data, off_t offset); +extern int local_munmap (vfs *me, void *addr, size_t len, void *data); #endif #endif diff -ur mc-4.6.0-gentoo/vfs/samba/lib/util.c mc-4.6.0-largefile/vfs/samba/lib/util.c --- mc-4.6.0-gentoo/vfs/samba/lib/util.c 2004-09-16 01:38:29.000000000 +0400 +++ mc-4.6.0-largefile/vfs/samba/lib/util.c 2004-09-16 03:45:21.000000000 +0400 @@ -1830,7 +1830,7 @@ /* Look up the host address in the address list we just got. */ for (i = 0; hp->h_addr_list[i]; i++) { - if (memcmp(hp->h_addr_list[i], (caddr_t) & addr, sizeof(addr)) == 0) + if (memcmp(hp->h_addr_list[i], &addr, sizeof(addr)) == 0) return True; } diff -ur mc-4.6.0-gentoo/vfs/vfs.c mc-4.6.0-largefile/vfs/vfs.c --- mc-4.6.0-gentoo/vfs/vfs.c 2004-09-16 01:38:30.000000000 +0400 +++ mc-4.6.0-largefile/vfs/vfs.c 2004-09-16 03:45:21.000000000 +0400 @@ -995,27 +995,27 @@ #ifdef HAVE_MMAP static struct mc_mmapping { - caddr_t addr; + void *addr; void *vfs_info; vfs *vfs; struct mc_mmapping *next; } *mc_mmaparray = NULL; -caddr_t -mc_mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +void * +mc_mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) { vfs *vfs; - caddr_t result; + void *result; struct mc_mmapping *mcm; if (fd == -1) - return (caddr_t) -1; + return (void *)-1; vfs = vfs_op (fd); - result = vfs->mmap ? (*vfs->mmap)(vfs, addr, len, prot, flags, vfs_info (fd), offset) : (caddr_t)-1; - if (result == (caddr_t)-1){ + result = vfs->mmap ? (*vfs->mmap)(vfs, addr, len, prot, flags, vfs_info (fd), offset) : (void *)-1; + if (result == (void *)-1){ errno = ferrno (vfs); - return (caddr_t)-1; + return (void *)-1; } mcm =g_new (struct mc_mmapping, 1); mcm->addr = result; @@ -1027,7 +1027,7 @@ } int -mc_munmap (caddr_t addr, size_t len) +mc_munmap (void *addr, size_t len) { struct mc_mmapping *mcm, *mcm2 = NULL; diff -ur mc-4.6.0-gentoo/vfs/vfs.h mc-4.6.0-largefile/vfs/vfs.h --- mc-4.6.0-gentoo/vfs/vfs.h 2002-12-11 12:36:51.000000000 +0300 +++ mc-4.6.0-largefile/vfs/vfs.h 2004-09-16 03:45:21.000000000 +0400 @@ -88,9 +88,9 @@ int (*ctl) (void *vfs_info, int ctlop, int arg); int (*setctl) (vfs *me, char *path, int ctlop, char *arg); #ifdef HAVE_MMAP - caddr_t (*mmap) (vfs *me, caddr_t addr, size_t len, int prot, + void *(*mmap) (vfs *me, void *addr, size_t len, int prot, int flags, void *vfs_info, off_t offset); - int (*munmap) (vfs *me, caddr_t addr, size_t len, + int (*munmap) (vfs *me, void *addr, size_t len, void *vfs_info); #endif }; @@ -208,9 +208,9 @@ int mc_ctl (int fd, int ctlop, int arg); int mc_setctl (char *path, int ctlop, char *arg); #ifdef HAVE_MMAP - caddr_t mc_mmap (caddr_t, size_t, int, int, int, off_t); - int mc_unmap (caddr_t, size_t); - int mc_munmap (caddr_t addr, size_t len); + void *mc_mmap (void *, size_t, int, int, int, off_t); + int mc_unmap (void *, size_t); + int mc_munmap (void *addr, size_t len); #endif /* HAVE_MMAP */ #else