# Some fixups for large file support (64bit sizes) on 32bit systems
#
# Source: Gentoo Portage
# Reference: 4.6.1
# Submit-By: Enrico Weigelt, metux IT service <weigelt metux de>
# Submit-Date: 2008-12-26
# Submit-State: new
#
diff -Naur mc-4.6.1.orig/intl/loadmsgcat.c mc-4.6.1/intl/loadmsgcat.c
old
|
new
|
|
1002 | 1002 | /* The magic number is wrong: not a message catalog file. */ |
1003 | 1003 | #ifdef HAVE_MMAP |
1004 | 1004 | if (use_mmap) |
1005 | | munmap ((caddr_t) data, size); |
| 1005 | munmap ((void *) data, size); |
1006 | 1006 | else |
1007 | 1007 | #endif |
1008 | 1008 | free (data); |
… |
… |
|
1271 | 1271 | free (domain->malloced); |
1272 | 1272 | #ifdef HAVE_MMAP |
1273 | 1273 | if (use_mmap) |
1274 | | munmap ((caddr_t) data, size); |
| 1274 | munmap ((void *) data, size); |
1275 | 1275 | else |
1276 | 1276 | #endif |
1277 | 1277 | free (data); |
… |
… |
|
1306 | 1306 | |
1307 | 1307 | # ifdef _POSIX_MAPPED_FILES |
1308 | 1308 | if (domain->use_mmap) |
1309 | | munmap ((caddr_t) domain->data, domain->mmap_size); |
| 1309 | munmap ((void *) domain->data, domain->mmap_size); |
1310 | 1310 | else |
1311 | 1311 | # endif /* _POSIX_MAPPED_FILES */ |
1312 | 1312 | free ((void *) domain->data); |
diff -Naur mc-4.6.1.orig/src/view.c mc-4.6.1/src/view.c
old
|
new
|
|
76 | 76 | #define vwidth (view->widget.cols - (view->have_frame ? 2 : 0)) |
77 | 77 | #define vheight (view->widget.lines - (view->have_frame ? 2 : 0)) |
78 | 78 | |
| 79 | #if GLIB_MAJOR_VERSION >= 2 |
| 80 | # define my_g_malloc g_try_malloc |
| 81 | #else |
| 82 | # define my_g_malloc g_malloc |
| 83 | #endif |
| 84 | |
79 | 85 | /* Offset in bytes into a file */ |
80 | 86 | typedef unsigned long offset_type; |
81 | 87 | #define INVALID_OFFSET ((offset_type) -1) |
… |
… |
|
560 | 566 | view->data = mc_mmap (0, view->s.st_size, PROT_READ, |
561 | 567 | MAP_FILE | MAP_SHARED, view->file, 0); |
562 | 568 | else |
563 | | view->data = (caddr_t) -1; |
564 | | if ((caddr_t) view->data != (caddr_t) - 1) { |
| 569 | view->data = (void *) -1; |
| 570 | if (view->data != (void *)-1) { |
565 | 571 | /* mmap worked */ |
566 | 572 | view->first = 0; |
567 | 573 | view->bytes_read = view->s.st_size; |
… |
… |
|
573 | 579 | /* For the OSes that don't provide mmap call, try to load all the |
574 | 580 | * file into memory (alex bcs zaporizhzhe ua). Also, mmap can fail |
575 | 581 | * for any reason, so we use this as fallback (pavel ucw cz) */ |
| 582 | |
| 583 | /* If large file support is enabled, st_size is a 64 bit value and |
| 584 | * will thus on 32 bit platforms possibly be beyond the range of gulong */ |
576 | 585 | |
577 | 586 | /* Make sure view->s.st_size is not truncated when passed to g_malloc */ |
578 | 587 | if ((gulong) view->s.st_size == view->s.st_size) |
diff -Naur mc-4.6.1.orig/vfs/local.c mc-4.6.1/vfs/local.c
old
|
new
|
|
243 | 243 | } |
244 | 244 | |
245 | 245 | #ifdef HAVE_MMAP |
246 | | caddr_t |
247 | | local_mmap (struct vfs_class *me, caddr_t addr, size_t len, int prot, int flags, void *data, off_t offset) |
| 246 | void * |
| 247 | local_mmap (struct vfs_class *me, void *addr, size_t len, int prot, int flags, void *data, off_t offset) |
248 | 248 | { |
249 | 249 | int fd = * (int *)data; |
250 | 250 | |
… |
… |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | int |
255 | | local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data) |
| 255 | local_munmap (struct vfs_class *me, void *addr, size_t len, void *data) |
256 | 256 | { |
257 | 257 | return munmap (addr, len); |
258 | 258 | } |
diff -Naur mc-4.6.1.orig/vfs/local.h mc-4.6.1/vfs/local.h
old
|
new
|
|
13 | 13 | extern int local_errno (struct vfs_class *me); |
14 | 14 | extern int local_lseek (void *data, off_t offset, int whence); |
15 | 15 | #ifdef HAVE_MMAP |
16 | | extern caddr_t local_mmap (struct vfs_class *me, caddr_t addr, size_t len, |
| 16 | extern void *local_mmap (struct vfs_class *me, void *addr, size_t len, |
17 | 17 | int prot, int flags, void *data, off_t offset); |
18 | | extern int local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data); |
| 18 | extern int local_munmap (struct vfs_class *me, void *addr, size_t len, void *data); |
19 | 19 | #endif |
20 | 20 | |
21 | 21 | #endif |
diff -Naur mc-4.6.1.orig/vfs/samba/lib/util.c mc-4.6.1/vfs/samba/lib/util.c
old
|
new
|
|
1836 | 1836 | |
1837 | 1837 | /* Look up the host address in the address list we just got. */ |
1838 | 1838 | for (i = 0; hp->h_addr_list[i]; i++) { |
1839 | | if (memcmp(hp->h_addr_list[i], (caddr_t) & addr, sizeof(addr)) == 0) |
| 1839 | if (memcmp(hp->h_addr_list[i], &addr, sizeof(addr)) == 0) |
1840 | 1840 | return True; |
1841 | 1841 | } |
1842 | 1842 | |
diff -Naur mc-4.6.1.orig/vfs/vfs.c mc-4.6.1/vfs/vfs.c
old
|
new
|
|
740 | 740 | |
741 | 741 | #ifdef HAVE_MMAP |
742 | 742 | static struct mc_mmapping { |
743 | | caddr_t addr; |
| 743 | void *addr; |
744 | 744 | void *vfs_info; |
745 | 745 | struct vfs_class *vfs; |
746 | 746 | struct mc_mmapping *next; |
747 | 747 | } *mc_mmaparray = NULL; |
748 | 748 | |
749 | | caddr_t |
750 | | mc_mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) |
| 749 | void * |
| 750 | mc_mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) |
751 | 751 | { |
752 | 752 | struct vfs_class *vfs; |
753 | | caddr_t result; |
| 753 | void *result; |
754 | 754 | struct mc_mmapping *mcm; |
755 | 755 | |
756 | 756 | if (fd == -1) |
757 | | return (caddr_t) -1; |
| 757 | return (void *) -1; |
758 | 758 | |
759 | 759 | vfs = vfs_op (fd); |
760 | | result = vfs->mmap ? (*vfs->mmap)(vfs, addr, len, prot, flags, vfs_info (fd), offset) : (caddr_t)-1; |
761 | | if (result == (caddr_t)-1){ |
| 760 | result = vfs->mmap ? (*vfs->mmap)(vfs, addr, len, prot, flags, vfs_info (fd), offset) : (void *)-1; |
| 761 | if (result == (void *)-1){ |
762 | 762 | errno = ferrno (vfs); |
763 | | return (caddr_t)-1; |
| 763 | return (void *)-1; |
764 | 764 | } |
765 | 765 | mcm =g_new (struct mc_mmapping, 1); |
766 | 766 | mcm->addr = result; |
… |
… |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | int |
775 | | mc_munmap (caddr_t addr, size_t len) |
| 775 | mc_munmap (void *addr, size_t len) |
776 | 776 | { |
777 | 777 | struct mc_mmapping *mcm, *mcm2 = NULL; |
778 | 778 | |
diff -Naur mc-4.6.1.orig/vfs/vfs.h mc-4.6.1/vfs/vfs.h
old
|
new
|
|
49 | 49 | int mc_ctl (int fd, int ctlop, void *arg); |
50 | 50 | int mc_setctl (const char *path, int ctlop, void *arg); |
51 | 51 | #ifdef HAVE_MMAP |
52 | | caddr_t mc_mmap (caddr_t, size_t, int, int, int, off_t); |
53 | | int mc_munmap (caddr_t addr, size_t len); |
| 52 | void *mc_mmap (void *, size_t, int, int, int, off_t); |
| 53 | int mc_munmap (void *addr, size_t len); |
54 | 54 | #endif /* HAVE_MMAP */ |
55 | 55 | |
56 | 56 | /* Operations for mc_ctl - on open file */ |
diff -Naur mc-4.6.1.orig/vfs/vfs-impl.h mc-4.6.1/vfs/vfs-impl.h
old
|
new
|
|
72 | 72 | int (*setctl) (struct vfs_class *me, const char *path, int ctlop, |
73 | 73 | void *arg); |
74 | 74 | #ifdef HAVE_MMAP |
75 | | caddr_t (*mmap) (struct vfs_class *me, caddr_t addr, size_t len, |
| 75 | void *(*mmap) (struct vfs_class *me, void *addr, size_t len, |
76 | 76 | int prot, int flags, void *vfs_info, off_t offset); |
77 | | int (*munmap) (struct vfs_class *me, caddr_t addr, size_t len, |
| 77 | int (*munmap) (struct vfs_class *me, void *addr, size_t len, |
78 | 78 | void *vfs_info); |
79 | 79 | #endif |
80 | 80 | }; |