Ticket #94: largefile-64-gentoo.patch

File largefile-64-gentoo.patch, 7.0 KB (added by slavazanko, 10 years ago)
  • intl/loadmsgcat.c

    # 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  
    10021002      /* The magic number is wrong: not a message catalog file.  */ 
    10031003#ifdef HAVE_MMAP 
    10041004      if (use_mmap) 
    1005         munmap ((caddr_t) data, size); 
     1005        munmap ((void *) data, size); 
    10061006      else 
    10071007#endif 
    10081008        free (data); 
     
    12711271        free (domain->malloced); 
    12721272#ifdef HAVE_MMAP 
    12731273      if (use_mmap) 
    1274         munmap ((caddr_t) data, size); 
     1274        munmap ((void *) data, size); 
    12751275      else 
    12761276#endif 
    12771277        free (data); 
     
    13061306 
    13071307# ifdef _POSIX_MAPPED_FILES 
    13081308  if (domain->use_mmap) 
    1309     munmap ((caddr_t) domain->data, domain->mmap_size); 
     1309    munmap ((void *) domain->data, domain->mmap_size); 
    13101310  else 
    13111311# endif /* _POSIX_MAPPED_FILES */ 
    13121312    free ((void *) domain->data); 
  • src/view.c

    diff -Naur mc-4.6.1.orig/src/view.c mc-4.6.1/src/view.c
    old new  
    7676#define vwidth (view->widget.cols - (view->have_frame ? 2 : 0)) 
    7777#define vheight (view->widget.lines - (view->have_frame ? 2 : 0)) 
    7878 
     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 
    7985/* Offset in bytes into a file */ 
    8086typedef unsigned long offset_type; 
    8187#define INVALID_OFFSET ((offset_type) -1) 
     
    560566        view->data = mc_mmap (0, view->s.st_size, PROT_READ, 
    561567                              MAP_FILE | MAP_SHARED, view->file, 0); 
    562568    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) { 
    565571        /* mmap worked */ 
    566572        view->first = 0; 
    567573        view->bytes_read = view->s.st_size; 
     
    573579    /* For the OSes that don't provide mmap call, try to load all the 
    574580     * file into memory (alex bcs zaporizhzhe ua).  Also, mmap can fail 
    575581     * 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 */ 
    576585 
    577586    /* Make sure view->s.st_size is not truncated when passed to g_malloc */ 
    578587    if ((gulong) view->s.st_size == view->s.st_size) 
  • vfs/local.c

    diff -Naur mc-4.6.1.orig/vfs/local.c mc-4.6.1/vfs/local.c
    old new  
    243243} 
    244244 
    245245#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) 
     246void * 
     247local_mmap (struct vfs_class *me, void *addr, size_t len, int prot, int flags, void *data, off_t offset) 
    248248{ 
    249249    int fd = * (int *)data; 
    250250 
     
    252252} 
    253253 
    254254int 
    255 local_munmap (struct vfs_class *me, caddr_t addr, size_t len, void *data) 
     255local_munmap (struct vfs_class *me, void *addr, size_t len, void *data) 
    256256{ 
    257257    return munmap (addr, len); 
    258258} 
  • vfs/local.h

    diff -Naur mc-4.6.1.orig/vfs/local.h mc-4.6.1/vfs/local.h
    old new  
    1313extern int local_errno (struct vfs_class *me); 
    1414extern int local_lseek (void *data, off_t offset, int whence); 
    1515#ifdef HAVE_MMAP 
    16 extern caddr_t local_mmap (struct vfs_class *me, caddr_t addr, size_t len, 
     16extern void *local_mmap (struct vfs_class *me, void *addr, size_t len, 
    1717                           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); 
     18extern int local_munmap (struct vfs_class *me, void *addr, size_t len, void *data); 
    1919#endif 
    2020 
    2121#endif 
  • vfs/samba/lib/util.c

    diff -Naur mc-4.6.1.orig/vfs/samba/lib/util.c mc-4.6.1/vfs/samba/lib/util.c
    old new  
    18361836         
    18371837  /* Look up the host address in the address list we just got. */ 
    18381838  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) 
    18401840      return True; 
    18411841  } 
    18421842 
  • vfs/vfs.c

    diff -Naur mc-4.6.1.orig/vfs/vfs.c mc-4.6.1/vfs/vfs.c
    old new  
    740740 
    741741#ifdef HAVE_MMAP 
    742742static struct mc_mmapping { 
    743     caddr_t addr; 
     743    void *addr; 
    744744    void *vfs_info; 
    745745    struct vfs_class *vfs; 
    746746    struct mc_mmapping *next; 
    747747} *mc_mmaparray = NULL; 
    748748 
    749 caddr_t 
    750 mc_mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) 
     749void * 
     750mc_mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) 
    751751{ 
    752752    struct vfs_class *vfs; 
    753     caddr_t result; 
     753    void *result; 
    754754    struct mc_mmapping *mcm; 
    755755 
    756756    if (fd == -1) 
    757         return (caddr_t) -1; 
     757        return (void *) -1; 
    758758     
    759759    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){ 
    762762        errno = ferrno (vfs); 
    763         return (caddr_t)-1; 
     763        return (void *)-1; 
    764764    } 
    765765    mcm =g_new (struct mc_mmapping, 1); 
    766766    mcm->addr = result; 
     
    772772} 
    773773 
    774774int 
    775 mc_munmap (caddr_t addr, size_t len) 
     775mc_munmap (void *addr, size_t len) 
    776776{ 
    777777    struct mc_mmapping *mcm, *mcm2 = NULL; 
    778778     
  • vfs/vfs.h

    diff -Naur mc-4.6.1.orig/vfs/vfs.h mc-4.6.1/vfs/vfs.h
    old new  
    4949int mc_ctl (int fd, int ctlop, void *arg); 
    5050int mc_setctl (const char *path, int ctlop, void *arg); 
    5151#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); 
     52void *mc_mmap (void *, size_t, int, int, int, off_t); 
     53int mc_munmap (void *addr, size_t len); 
    5454#endif                          /* HAVE_MMAP */ 
    5555 
    5656/* Operations for mc_ctl - on open file */ 
  • vfs/vfs-impl.h

    diff -Naur mc-4.6.1.orig/vfs/vfs-impl.h mc-4.6.1/vfs/vfs-impl.h
    old new  
    7272    int (*setctl) (struct vfs_class *me, const char *path, int ctlop, 
    7373                   void *arg); 
    7474#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, 
    7676                     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, 
    7878                   void *vfs_info); 
    7979#endif 
    8080};