Patch 7.4.1975
Problem:    On MS-Windows large files (> 2Gbyte) cause problems.
Solution:   Use "off_T" instead of "off_t".  Use "stat_T" instead of "struct
            stat".  Use 64 bit system functions if available.  (Ken Takata)
Files:      src/Makefile, src/buffer.c, src/diff.c, src/eval.c, src/ex_cmds.c,
            src/ex_cmds2.c, src/fileio.c, src/gui.c, src/gui_at_fs.c,
            src/if_cscope.c, src/main.c, src/memfile.c, src/memline.c,
            src/misc1.c, src/misc2.c, src/netbeans.c, src/os_mswin.c,
            src/os_win32.c, src/proto/fileio.pro, src/proto/memline.pro,
            src/proto/os_mswin.pro, src/pty.c, src/quickfix.c, src/spell.c,
            src/structs.h, src/tag.c, src/testdir/Make_all.mak,
            src/testdir/test_largefile.vim, src/testdir/test_stat.vim,
            src/undo.c, src/vim.h


*** ../vim-7.4.1974/src/Makefile        2016-06-26 19:38:05.787014867 +0200
--- src/Makefile        2016-07-01 17:12:02.470800417 +0200
***************
*** 2034,2040 ****
--- 2034,2042 ----
        test_increment_dbcs \
        test_join \
        test_json \
+       test_jumps \
        test_langmap \
+       test_largefile \
        test_lispwords \
        test_man \
        test_matchadd_conceal \
***************
*** 2054,2059 ****
--- 2056,2062 ----
        test_searchpos \
        test_set \
        test_sort \
+       test_stat \
        test_statusline \
        test_syn_attr \
        test_syntax \
*** ../vim-7.4.1974/src/buffer.c        2016-06-04 20:25:01.173991001 +0200
--- src/buffer.c        2016-07-01 17:02:50.862814861 +0200
***************
*** 35,43 ****
  static void   buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T 
col, int copy_options);
  static wininfo_T *find_wininfo(buf_T *buf, int skip_diff_buffer);
  #ifdef UNIX
! static buf_T  *buflist_findname_stat(char_u *ffname, struct stat *st);
! static int    otherfile_buf(buf_T *buf, char_u *ffname, struct stat *stp);
! static int    buf_same_ino(buf_T *buf, struct stat *stp);
  #else
  static int    otherfile_buf(buf_T *buf, char_u *ffname);
  #endif
--- 35,43 ----
  static void   buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T 
col, int copy_options);
  static wininfo_T *find_wininfo(buf_T *buf, int skip_diff_buffer);
  #ifdef UNIX
! static buf_T  *buflist_findname_stat(char_u *ffname, stat_T *st);
! static int    otherfile_buf(buf_T *buf, char_u *ffname, stat_T *stp);
! static int    buf_same_ino(buf_T *buf, stat_T *stp);
  #else
  static int    otherfile_buf(buf_T *buf, char_u *ffname);
  #endif
***************
*** 1663,1669 ****
  {
      buf_T     *buf;
  #ifdef UNIX
!     struct stat       st;
  #endif
  
      fname_expand(curbuf, &ffname, &sfname);   /* will allocate ffname */
--- 1663,1669 ----
  {
      buf_T     *buf;
  #ifdef UNIX
!     stat_T    st;
  #endif
  
      fname_expand(curbuf, &ffname, &sfname);   /* will allocate ffname */
***************
*** 2183,2189 ****
  buflist_findname(char_u *ffname)
  {
  #ifdef UNIX
!     struct stat st;
  
      if (mch_stat((char *)ffname, &st) < 0)
        st.st_dev = (dev_T)-1;
--- 2183,2189 ----
  buflist_findname(char_u *ffname)
  {
  #ifdef UNIX
!     stat_T    st;
  
      if (mch_stat((char *)ffname, &st) < 0)
        st.st_dev = (dev_T)-1;
***************
*** 2198,2204 ****
      static buf_T *
  buflist_findname_stat(
      char_u    *ffname,
!     struct stat       *stp)
  {
  #endif
      buf_T     *buf;
--- 2198,2204 ----
      static buf_T *
  buflist_findname_stat(
      char_u    *ffname,
!     stat_T    *stp)
  {
  #endif
      buf_T     *buf;
***************
*** 2847,2853 ****
  {
      buf_T     *obuf = NULL;
  #ifdef UNIX
!     struct stat st;
  #endif
  
      if (ffname == NULL || *ffname == NUL)
--- 2847,2853 ----
  {
      buf_T     *obuf = NULL;
  #ifdef UNIX
!     stat_T    st;
  #endif
  
      if (ffname == NULL || *ffname == NUL)
***************
*** 3084,3090 ****
      buf_T             *buf,
      char_u            *ffname
  #ifdef UNIX
!     , struct stat     *stp
  #endif
      )
  {
--- 3084,3090 ----
      buf_T             *buf,
      char_u            *ffname
  #ifdef UNIX
!     , stat_T          *stp
  #endif
      )
  {
***************
*** 3095,3103 ****
        return FALSE;
  #ifdef UNIX
      {
!       struct stat     st;
  
!       /* If no struct stat given, get it now */
        if (stp == NULL)
        {
            if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
--- 3095,3103 ----
        return FALSE;
  #ifdef UNIX
      {
!       stat_T      st;
  
!       /* If no stat_T given, get it now */
        if (stp == NULL)
        {
            if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
***************
*** 3132,3138 ****
      void
  buf_setino(buf_T *buf)
  {
!     struct stat       st;
  
      if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
      {
--- 3132,3138 ----
      void
  buf_setino(buf_T *buf)
  {
!     stat_T    st;
  
      if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
      {
***************
*** 3150,3156 ****
      static int
  buf_same_ino(
      buf_T     *buf,
!     struct stat *stp)
  {
      return (buf->b_dev_valid
            && stp->st_dev == buf->b_dev
--- 3150,3156 ----
      static int
  buf_same_ino(
      buf_T     *buf,
!     stat_T    *stp)
  {
      return (buf->b_dev_valid
            && stp->st_dev == buf->b_dev
*** ../vim-7.4.1974/src/diff.c  2016-03-03 12:22:48.554554090 +0100
--- src/diff.c  2016-07-01 17:02:50.862814861 +0200
***************
*** 888,894 ****
      char_u    *browseFile = NULL;
      int               browse_flag = cmdmod.browse;
  #endif
!     struct stat st;
  
  #ifdef FEAT_BROWSE
      if (cmdmod.browse)
--- 888,894 ----
      char_u    *browseFile = NULL;
      int               browse_flag = cmdmod.browse;
  #endif
!     stat_T    st;
  
  #ifdef FEAT_BROWSE
      if (cmdmod.browse)
*** ../vim-7.4.1974/src/eval.c  2016-06-06 21:07:48.379578686 +0200
--- src/eval.c  2016-07-01 17:02:50.866814804 +0200
***************
*** 12980,12986 ****
  f_getfperm(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     struct stat st;
      char_u    *perm = NULL;
      char_u    flags[] = "rwx";
      int               i;
--- 12980,12986 ----
  f_getfperm(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     stat_T    st;
      char_u    *perm = NULL;
      char_u    flags[] = "rwx";
      int               i;
***************
*** 13010,13016 ****
  f_getfsize(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     struct stat       st;
  
      fname = get_tv_string(&argvars[0]);
  
--- 13010,13016 ----
  f_getfsize(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     stat_T    st;
  
      fname = get_tv_string(&argvars[0]);
  
***************
*** 13025,13031 ****
            rettv->vval.v_number = (varnumber_T)st.st_size;
  
            /* non-perfect check for overflow */
!           if ((off_t)rettv->vval.v_number != (off_t)st.st_size)
                rettv->vval.v_number = -2;
        }
      }
--- 13025,13031 ----
            rettv->vval.v_number = (varnumber_T)st.st_size;
  
            /* non-perfect check for overflow */
!           if ((off_T)rettv->vval.v_number != (off_T)st.st_size)
                rettv->vval.v_number = -2;
        }
      }
***************
*** 13040,13046 ****
  f_getftime(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     struct stat       st;
  
      fname = get_tv_string(&argvars[0]);
  
--- 13040,13046 ----
  f_getftime(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     stat_T    st;
  
      fname = get_tv_string(&argvars[0]);
  
***************
*** 13057,13063 ****
  f_getftype(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     struct stat st;
      char_u    *type = NULL;
      char      *t;
  
--- 13057,13063 ----
  f_getftype(typval_T *argvars, typval_T *rettv)
  {
      char_u    *fname;
!     stat_T    st;
      char_u    *type = NULL;
      char      *t;
  
*** ../vim-7.4.1974/src/ex_cmds.c       2016-07-01 14:04:36.418846179 +0200
--- src/ex_cmds.c       2016-07-01 17:02:50.870814746 +0200
***************
*** 1840,1853 ****
      FILE      *fp_in = NULL;  /* input viminfo file, if any */
      FILE      *fp_out = NULL; /* output viminfo file */
      char_u    *tempname = NULL;       /* name of temp viminfo file */
!     struct stat       st_new;         /* mch_stat() of potential new file */
      char_u    *wp;
  #if defined(UNIX) || defined(VMS)
      mode_t    umask_save;
  #endif
  #ifdef UNIX
      int               shortname = FALSE;      /* use 8.3 file name */
!     struct stat       st_old;         /* mch_stat() of existing viminfo file 
*/
  #endif
  #ifdef WIN3264
      int               hidden = FALSE;
--- 1840,1853 ----
      FILE      *fp_in = NULL;  /* input viminfo file, if any */
      FILE      *fp_out = NULL; /* output viminfo file */
      char_u    *tempname = NULL;       /* name of temp viminfo file */
!     stat_T    st_new;         /* mch_stat() of potential new file */
      char_u    *wp;
  #if defined(UNIX) || defined(VMS)
      mode_t    umask_save;
  #endif
  #ifdef UNIX
      int               shortname = FALSE;      /* use 8.3 file name */
!     stat_T    st_old;         /* mch_stat() of existing viminfo file */
  #endif
  #ifdef WIN3264
      int               hidden = FALSE;
***************
*** 3457,3463 ****
      static int
  check_readonly(int *forceit, buf_T *buf)
  {
!     struct stat       st;
  
      /* Handle a file being readonly when the 'readonly' option is set or when
       * the file exists and permissions are read-only.
--- 3457,3463 ----
      static int
  check_readonly(int *forceit, buf_T *buf)
  {
!     stat_T    st;
  
      /* Handle a file being readonly when the 'readonly' option is set or when
       * the file exists and permissions are read-only.
*** ../vim-7.4.1974/src/ex_cmds2.c      2016-07-01 15:39:35.612214172 +0200
--- src/ex_cmds2.c      2016-07-01 17:02:50.870814746 +0200
***************
*** 3685,3691 ****
      int                           save_debug_break_level = debug_break_level;
      scriptitem_T          *si = NULL;
  # ifdef UNIX
!     struct stat                   st;
      int                           stat_ok;
  # endif
  #endif
--- 3685,3691 ----
      int                           save_debug_break_level = debug_break_level;
      scriptitem_T          *si = NULL;
  # ifdef UNIX
!     stat_T                st;
      int                           stat_ok;
  # endif
  #endif
*** ../vim-7.4.1974/src/fileio.c        2016-06-13 20:00:24.976283791 +0200
--- src/fileio.c        2016-07-01 17:02:50.870814746 +0200
***************
*** 41,47 ****
  static void check_marks_read(void);
  #endif
  #ifdef FEAT_CRYPT
! static char_u *check_for_cryptkey(char_u *cryptkey, char_u *ptr, long *sizep, 
off_t *filesizep, int newfile, char_u *fname, int *did_ask);
  #endif
  #ifdef UNIX
  static void set_file_time(char_u *fname, time_t atime, time_t mtime);
--- 41,47 ----
  static void check_marks_read(void);
  #endif
  #ifdef FEAT_CRYPT
! static char_u *check_for_cryptkey(char_u *cryptkey, char_u *ptr, long *sizep, 
off_T *filesizep, int newfile, char_u *fname, int *did_ask);
  #endif
  #ifdef UNIX
  static void set_file_time(char_u *fname, time_t atime, time_t mtime);
***************
*** 49,55 ****
  static int set_rw_fname(char_u *fname, char_u *sfname);
  static int msg_add_fileformat(int eol_type);
  static void msg_add_eol(void);
! static int check_mtime(buf_T *buf, struct stat *s);
  static int time_differs(long t1, long t2);
  #ifdef FEAT_AUTOCMD
  static int apply_autocmds_exarg(event_T event, char_u *fname, char_u 
*fname_io, int force, buf_T *buf, exarg_T *eap);
--- 49,55 ----
  static int set_rw_fname(char_u *fname, char_u *sfname);
  static int msg_add_fileformat(int eol_type);
  static void msg_add_eol(void);
! static int check_mtime(buf_T *buf, stat_T *s);
  static int time_differs(long t1, long t2);
  #ifdef FEAT_AUTOCMD
  static int apply_autocmds_exarg(event_T event, char_u *fname, char_u 
*fname_io, int force, buf_T *buf, exarg_T *eap);
***************
*** 245,251 ****
      colnr_T   len;
      long      size = 0;
      char_u    *p;
!     off_t     filesize = 0;
      int               skip_read = FALSE;
  #ifdef FEAT_CRYPT
      char_u    *cryptkey = NULL;
--- 245,251 ----
      colnr_T   len;
      long      size = 0;
      char_u    *p;
!     off_T     filesize = 0;
      int               skip_read = FALSE;
  #ifdef FEAT_CRYPT
      char_u    *cryptkey = NULL;
***************
*** 269,275 ****
  #endif
      int               fileformat = 0;         /* end-of-line format */
      int               keep_fileformat = FALSE;
!     struct stat       st;
      int               file_readonly;
      linenr_T  skip_count = 0;
      linenr_T  read_count = 0;
--- 269,275 ----
  #endif
      int               fileformat = 0;         /* end-of-line format */
      int               keep_fileformat = FALSE;
!     stat_T    st;
      int               file_readonly;
      linenr_T  skip_count = 0;
      linenr_T  read_count = 0;
***************
*** 885,891 ****
                /* Read the first line (and a bit more).  Immediately rewind to
                 * the start of the file.  If the read() fails "len" is -1. */
                len = read_eintr(fd, firstline, 80);
!               lseek(fd, (off_t)0L, SEEK_SET);
                for (p = firstline; p < firstline + len; ++p)
                    if (*p >= 0x80)
                    {
--- 885,891 ----
                /* Read the first line (and a bit more).  Immediately rewind to
                 * the start of the file.  If the read() fails "len" is -1. */
                len = read_eintr(fd, firstline, 80);
!               vim_lseek(fd, (off_T)0L, SEEK_SET);
                for (p = firstline; p < firstline + len; ++p)
                    if (*p >= 0x80)
                    {
***************
*** 949,955 ****
            read_buf_lnum = 1;
            read_buf_col = 0;
        }
!       else if (read_stdin || lseek(fd, (off_t)0L, SEEK_SET) != 0)
        {
            /* Can't rewind the file, give up. */
            error = TRUE;
--- 949,955 ----
            read_buf_lnum = 1;
            read_buf_col = 0;
        }
!       else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0)
        {
            /* Can't rewind the file, give up. */
            error = TRUE;
***************
*** 2253,2259 ****
                                if (   try_unix
                                    && !read_stdin
                                    && (read_buffer
!                                       || lseek(fd, (off_t)0L, SEEK_SET) == 0))
                                {
                                    fileformat = EOL_UNIX;
                                    if (set_options)
--- 2253,2260 ----
                                if (   try_unix
                                    && !read_stdin
                                    && (read_buffer
!                                       || vim_lseek(fd, (off_T)0L, SEEK_SET)
!                                                                         == 0))
                                {
                                    fileformat = EOL_UNIX;
                                    if (set_options)
***************
*** 2958,2964 ****
      char_u    *cryptkey,      /* previous encryption key or NULL */
      char_u    *ptr,           /* pointer to read bytes */
      long      *sizep,         /* length of read bytes */
!     off_t     *filesizep,     /* nr of bytes used from file */
      int               newfile,        /* editing a new buffer */
      char_u    *fname,         /* file name to display */
      int               *did_ask)       /* flag: whether already asked for key 
*/
--- 2959,2965 ----
      char_u    *cryptkey,      /* previous encryption key or NULL */
      char_u    *ptr,           /* pointer to read bytes */
      long      *sizep,         /* length of read bytes */
!     off_T     *filesizep,     /* nr of bytes used from file */
      int               newfile,        /* editing a new buffer */
      char_u    *fname,         /* file name to display */
      int               *did_ask)       /* flag: whether already asked for key 
*/
***************
*** 3145,3151 ****
      int                   overwriting;            /* TRUE if writing over 
original */
      int                   no_eol = FALSE;         /* no end-of-line written */
      int                   device = FALSE;         /* writing to a device */
!     struct stat           st_old;
      int                   prev_got_int = got_int;
      int                   file_readonly = FALSE;  /* overwritten file is 
read-only */
      static char           *err_readonly = "is read-only (cannot override: 
\"W\" in 'cpoptions')";
--- 3146,3152 ----
      int                   overwriting;            /* TRUE if writing over 
original */
      int                   no_eol = FALSE;         /* no end-of-line written */
      int                   device = FALSE;         /* writing to a device */
!     stat_T        st_old;
      int                   prev_got_int = got_int;
      int                   file_readonly = FALSE;  /* overwritten file is 
read-only */
      static char           *err_readonly = "is read-only (cannot override: 
\"W\" in 'cpoptions')";
***************
*** 3674,3680 ****
      if (!(append && *p_pm == NUL) && !filtering && perm >= 0 && dobackup)
      {
  #if defined(UNIX) || defined(WIN32)
!       struct stat st;
  #endif
  
        if ((bkc & BKC_YES) || append)  /* "yes" */
--- 3675,3681 ----
      if (!(append && *p_pm == NUL) && !filtering && perm >= 0 && dobackup)
      {
  #if defined(UNIX) || defined(WIN32)
!       stat_T      st;
  #endif
  
        if ((bkc & BKC_YES) || append)  /* "yes" */
***************
*** 3813,3819 ****
            int         bfd;
            char_u      *copybuf, *wp;
            int         some_error = FALSE;
!           struct stat st_new;
            char_u      *dirp;
            char_u      *rootname;
  #if defined(UNIX)
--- 3814,3820 ----
            int         bfd;
            char_u      *copybuf, *wp;
            int         some_error = FALSE;
!           stat_T      st_new;
            char_u      *dirp;
            char_u      *rootname;
  #if defined(UNIX)
***************
*** 4343,4349 ****
        if (errmsg == NULL)
        {
  #ifdef UNIX
!           struct stat st;
  
            /* Don't delete the file when it's a hard or symbolic link. */
            if ((!newfile && st_old.st_nlink > 1)
--- 4344,4350 ----
        if (errmsg == NULL)
        {
  #ifdef UNIX
!           stat_T      st;
  
            /* Don't delete the file when it's a hard or symbolic link. */
            if ((!newfile && st_old.st_nlink > 1)
***************
*** 4376,4382 ****
  
  restore_backup:
        {
!           struct stat st;
  
            /*
             * If we failed to open the file, we don't need a backup. Throw it
--- 4377,4383 ----
  
  restore_backup:
        {
!           stat_T      st;
  
            /*
             * If we failed to open the file, we don't need a backup. Throw it
***************
*** 4673,4679 ****
      if (backup != NULL && !backup_copy)
      {
  # ifdef HAVE_FCHOWN
!       struct stat     st;
  
        /* don't change the owner when it's already OK, some systems remove
         * permission or ACL stuff */
--- 4674,4680 ----
      if (backup != NULL && !backup_copy)
      {
  # ifdef HAVE_FCHOWN
!       stat_T  st;
  
        /* don't change the owner when it's already OK, some systems remove
         * permission or ACL stuff */
***************
*** 4929,4935 ****
  
        if (backup != NULL)
        {
!           struct stat st;
  
            /*
             * If the original file does not exist yet
--- 4930,4936 ----
  
        if (backup != NULL)
        {
!           stat_T      st;
  
            /*
             * If the original file does not exist yet
***************
*** 5221,5227 ****
  msg_add_lines(
      int           insert_space,
      long    lnum,
!     off_t   nchars)
  {
      char_u  *p;
  
--- 5222,5228 ----
  msg_add_lines(
      int           insert_space,
      long    lnum,
!     off_T   nchars)
  {
      char_u  *p;
  
***************
*** 5233,5238 ****
--- 5234,5242 ----
  #ifdef LONG_LONG_OFF_T
        sprintf((char *)p,
                "%ldL, %lldC", lnum, (long long)nchars);
+ #elif defined(WIN3264)
+       sprintf((char *)p,
+               "%ldL, %I64dC", lnum, (__int64)nchars);
  #else
        sprintf((char *)p,
                /* Explicit typecast avoids warning on Mac OS X 10.6 */
***************
*** 5251,5256 ****
--- 5255,5263 ----
  #ifdef LONG_LONG_OFF_T
            sprintf((char *)p,
                    _("%lld characters"), (long long)nchars);
+ #elif defined(WIN3264)
+           sprintf((char *)p,
+                   _("%I64d characters"), (__int64)nchars);
  #else
            sprintf((char *)p,
                    /* Explicit typecast avoids warning on Mac OS X 10.6 */
***************
*** 5274,5280 ****
   * using the same timestamp but can't set the size.
   */
      static int
! check_mtime(buf_T *buf, struct stat *st)
  {
      if (buf->b_mtime_read != 0
            && time_differs((long)st->st_mtime, buf->b_mtime_read))
--- 5281,5287 ----
   * using the same timestamp but can't set the size.
   */
      static int
! check_mtime(buf_T *buf, stat_T *st)
  {
      if (buf->b_mtime_read != 0
            && time_differs((long)st->st_mtime, buf->b_mtime_read))
***************
*** 6441,6447 ****
  #ifdef AMIGA
      BPTR      flock;
  #endif
!     struct stat       st;
      long      perm;
  #ifdef HAVE_ACL
      vim_acl_T acl;            /* ACL from original file */
--- 6448,6454 ----
  #ifdef AMIGA
      BPTR      flock;
  #endif
!     stat_T    st;
      long      perm;
  #ifdef HAVE_ACL
      vim_acl_T acl;            /* ACL from original file */
***************
*** 6469,6475 ****
  
  #ifdef UNIX
      {
!       struct stat     st_to;
  
        /* It's possible for the source and destination to be the same file.
         * This happens when "from" and "to" differ in case and are on a FAT32
--- 6476,6482 ----
  
  #ifdef UNIX
      {
!       stat_T  st_to;
  
        /* It's possible for the source and destination to be the same file.
         * This happens when "from" and "to" differ in case and are on a FAT32
***************
*** 6768,6774 ****
      buf_T     *buf,
      int               focus UNUSED)   /* called for GUI focus event */
  {
!     struct stat       st;
      int               stat_res;
      int               retval = 0;
      char_u    *path;
--- 6775,6781 ----
      buf_T     *buf,
      int               focus UNUSED)   /* called for GUI focus event */
  {
!     stat_T    st;
      int               stat_res;
      int               retval = 0;
      char_u    *path;
***************
*** 6780,6786 ****
  #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
      int               can_reload = FALSE;
  #endif
!     off_t     orig_size = buf->b_orig_size;
      int               orig_mode = buf->b_orig_mode;
  #ifdef FEAT_GUI
      int               save_mouse_correct = need_mouse_correct;
--- 6787,6793 ----
  #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
      int               can_reload = FALSE;
  #endif
!     off_T     orig_size = buf->b_orig_size;
      int               orig_mode = buf->b_orig_mode;
  #ifdef FEAT_GUI
      int               save_mouse_correct = need_mouse_correct;
***************
*** 7209,7215 ****
  }
  
      void
! buf_store_time(buf_T *buf, struct stat *st, char_u *fname UNUSED)
  {
      buf->b_mtime = (long)st->st_mtime;
      buf->b_orig_size = st->st_size;
--- 7216,7222 ----
  }
  
      void
! buf_store_time(buf_T *buf, stat_T *st, char_u *fname UNUSED)
  {
      buf->b_mtime = (long)st->st_mtime;
      buf->b_orig_size = st->st_size;
***************
*** 7349,7355 ****
      static char       *(tempdirs[]) = {TEMPDIRNAMES};
      int               i;
  # ifndef EEXIST
!     struct stat       st;
  # endif
  
      /*
--- 7356,7362 ----
      static char       *(tempdirs[]) = {TEMPDIRNAMES};
      int               i;
  # ifndef EEXIST
!     stat_T    st;
  # endif
  
      /*
*** ../vim-7.4.1974/src/gui.c   2016-07-01 15:48:00.336721784 +0200
--- src/gui.c   2016-07-01 17:02:50.874814688 +0200
***************
*** 571,577 ****
            {
  #ifdef UNIX
                {
!                   struct stat s;
  
                    /* if ".gvimrc" file is not owned by user, set 'secure'
                     * mode */
--- 571,577 ----
            {
  #ifdef UNIX
                {
!                   stat_T s;
  
                    /* if ".gvimrc" file is not owned by user, set 'secure'
                     * mode */
*** ../vim-7.4.1974/src/gui_at_fs.c     2016-01-30 18:13:48.559479453 +0100
--- src/gui_at_fs.c     2016-07-01 17:02:50.874814688 +0200
***************
*** 183,189 ****
  static void SFbuttonPressList(Widget w, int n, XButtonPressedEvent *event);
  static void SFbuttonReleaseList(Widget w, int n, XButtonReleasedEvent *event);
  static void SFdirModTimer(XtPointer cl, XtIntervalId *id);
! static char SFstatChar(struct stat *statBuf);
  static void SFdrawStrings(Window w, SFDir *dir, int from, int to);
  static int SFnewInvertEntry(int n, XMotionEvent *event);
  static void SFinvertEntry(int n);
--- 183,189 ----
  static void SFbuttonPressList(Widget w, int n, XButtonPressedEvent *event);
  static void SFbuttonReleaseList(Widget w, int n, XButtonReleasedEvent *event);
  static void SFdirModTimer(XtPointer cl, XtIntervalId *id);
! static char SFstatChar(stat_T *statBuf);
  static void SFdrawStrings(Window w, SFDir *dir, int from, int to);
  static int SFnewInvertEntry(int n, XMotionEvent *event);
  static void SFinvertEntry(int n);
***************
*** 873,879 ****
      static int
  SFcheckDir(int n, SFDir *dir)
  {
!     struct stat       statBuf;
      int               i;
  
      if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime))
--- 873,879 ----
      static int
  SFcheckDir(int n, SFDir *dir)
  {
!     stat_T    statBuf;
      int               i;
  
      if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime))
***************
*** 943,949 ****
      int               i;
      char      *str;
      int               last;
!     struct stat       statBuf;
  
      result = 0;
  
--- 943,949 ----
      int               i;
      char      *str;
      int               last;
!     stat_T    statBuf;
  
      result = 0;
  
***************
*** 1017,1023 ****
  /* Return a single character describing what kind of file STATBUF is.  */
  
      static char
! SFstatChar(struct stat *statBuf)
  {
      if (S_ISDIR (statBuf->st_mode))
        return '/';
--- 1017,1023 ----
  /* Return a single character describing what kind of file STATBUF is.  */
  
      static char
! SFstatChar(stat_T *statBuf)
  {
      if (S_ISDIR (statBuf->st_mode))
        return '/';
***************
*** 1313,1325 ****
  #endif
  }
  
! static void SFwriteStatChar(char *name, int last, struct stat *statBuf);
  
      static void
  SFwriteStatChar(
      char      *name,
      int               last,
!     struct stat       *statBuf)
  {
      name[last] = SFstatChar(statBuf);
  }
--- 1313,1325 ----
  #endif
  }
  
! static void SFwriteStatChar(char *name, int last, stat_T *statBuf);
  
      static void
  SFwriteStatChar(
      char      *name,
      int               last,
!     stat_T    *statBuf)
  {
      name[last] = SFstatChar(statBuf);
  }
***************
*** 1329,1335 ****
      static int
  SFstatAndCheck(SFDir *dir, SFEntry *entry)
  {
!     struct stat       statBuf;
      char      save;
      int               last;
  
--- 1329,1335 ----
      static int
  SFstatAndCheck(SFDir *dir, SFEntry *entry)
  {
!     stat_T    statBuf;
      char      save;
      int               last;
  
***************
*** 2059,2065 ****
      char              *str;
      int                       len;
      int                       maxChars;
!     struct stat               statBuf;
  
      maxChars = strlen(dir->dir) - 1;
  
--- 2059,2065 ----
      char              *str;
      int                       len;
      int                       maxChars;
!     stat_T            statBuf;
  
      maxChars = strlen(dir->dir) - 1;
  
*** ../vim-7.4.1974/src/if_cscope.c     2016-06-21 23:42:11.440357102 +0200
--- src/if_cscope.c     2016-07-01 17:02:50.874814688 +0200
***************
*** 42,48 ****
  static int        cs_help(exarg_T *eap);
  static void       clear_csinfo(int i);
  static int        cs_insert_filelist(char *, char *, char *,
!                       struct stat *);
  static int        cs_kill(exarg_T *eap);
  static void       cs_kill_execute(int, char *);
  static cscmd_T *    cs_lookup_cmd(exarg_T *eap);
--- 42,48 ----
  static int        cs_help(exarg_T *eap);
  static void       clear_csinfo(int i);
  static int        cs_insert_filelist(char *, char *, char *,
!                       stat_T *);
  static int        cs_kill(exarg_T *eap);
  static void       cs_kill_execute(int, char *);
  static cscmd_T *    cs_lookup_cmd(exarg_T *eap);
***************
*** 520,526 ****
      char *arg2,           /* prepend path - may contain environment variables 
*/
      char *flags)
  {
!     struct stat statbuf;
      int               ret;
      char      *fname = NULL;
      char      *fname2 = NULL;
--- 520,526 ----
      char *arg2,           /* prepend path - may contain environment variables 
*/
      char *flags)
  {
!     stat_T    statbuf;
      int               ret;
      char      *fname = NULL;
      char      *fname2 = NULL;
***************
*** 547,553 ****
      fname = (char *)vim_strnsave((char_u *)fname, len);
      vim_free(fbuf);
  #endif
!     ret = stat(fname, &statbuf);
      if (ret < 0)
      {
  staterr:
--- 547,553 ----
      fname = (char *)vim_strnsave((char_u *)fname, len);
      vim_free(fbuf);
  #endif
!     ret = mch_stat(fname, &statbuf);
      if (ret < 0)
      {
  staterr:
***************
*** 559,571 ****
      /* get the prepend path (arg2), expand it, and try to stat it */
      if (arg2 != NULL)
      {
!       struct stat statbuf2;
  
        if ((ppath = (char *)alloc(MAXPATHL + 1)) == NULL)
            goto add_err;
  
        expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL);
!       ret = stat(ppath, &statbuf2);
        if (ret < 0)
            goto staterr;
      }
--- 559,571 ----
      /* get the prepend path (arg2), expand it, and try to stat it */
      if (arg2 != NULL)
      {
!       stat_T      statbuf2;
  
        if ((ppath = (char *)alloc(MAXPATHL + 1)) == NULL)
            goto add_err;
  
        expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL);
!       ret = mch_stat(ppath, &statbuf2);
        if (ret < 0)
            goto staterr;
      }
***************
*** 592,598 ****
        else
            (void)sprintf(fname2, "%s/%s", fname, CSCOPE_DBFILE);
  
!       ret = stat(fname2, &statbuf);
        if (ret < 0)
        {
            if (p_csverbose)
--- 592,598 ----
        else
            (void)sprintf(fname2, "%s/%s", fname, CSCOPE_DBFILE);
  
!       ret = mch_stat(fname2, &statbuf);
        if (ret < 0)
        {
            if (p_csverbose)
***************
*** 1421,1427 ****
      char *fname,
      char *ppath,
      char *flags,
!     struct stat *sb UNUSED)
  {
      short     i, j;
  #ifndef UNIX
--- 1421,1427 ----
      char *fname,
      char *ppath,
      char *flags,
!     stat_T *sb UNUSED)
  {
      short     i, j;
  #ifndef UNIX
*** ../vim-7.4.1974/src/main.c  2016-06-26 20:37:24.567968951 +0200
--- src/main.c  2016-07-01 17:02:50.874814688 +0200
***************
*** 3186,3192 ****
      static int
  file_owned(char *fname)
  {
!     struct stat s;
  # ifdef UNIX
      uid_t     uid = getuid();
  # else         /* VMS */
--- 3186,3192 ----
      static int
  file_owned(char *fname)
  {
!     stat_T    s;
  # ifdef UNIX
      uid_t     uid = getuid();
  # else         /* VMS */
*** ../vim-7.4.1974/src/memfile.c       2016-02-23 14:52:31.885232171 +0100
--- src/memfile.c       2016-07-01 17:02:50.874814688 +0200
***************
*** 81,87 ****
  static bhdr_T *mf_rem_free(memfile_T *);
  static int  mf_read(memfile_T *, bhdr_T *);
  static int  mf_write(memfile_T *, bhdr_T *);
! static int  mf_write_block(memfile_T *mfp, bhdr_T *hp, off_t offset, unsigned 
size);
  static int  mf_trans_add(memfile_T *, bhdr_T *);
  static void mf_do_open(memfile_T *, char_u *, int);
  static void mf_hash_init(mf_hashtab_T *);
--- 81,87 ----
  static bhdr_T *mf_rem_free(memfile_T *);
  static int  mf_read(memfile_T *, bhdr_T *);
  static int  mf_write(memfile_T *, bhdr_T *);
! static int  mf_write_block(memfile_T *mfp, bhdr_T *hp, off_T offset, unsigned 
size);
  static int  mf_trans_add(memfile_T *, bhdr_T *);
  static void mf_do_open(memfile_T *, char_u *, int);
  static void mf_hash_init(mf_hashtab_T *);
***************
*** 124,130 ****
  mf_open(char_u *fname, int flags)
  {
      memfile_T         *mfp;
!     off_t             size;
  #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix)
  # define USE_FSTATFS
      struct STATFS     stf;
--- 124,130 ----
  mf_open(char_u *fname, int flags)
  {
      memfile_T         *mfp;
!     off_T             size;
  #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix)
  # define USE_FSTATFS
      struct STATFS     stf;
***************
*** 179,185 ****
  #endif
  
      if (mfp->mf_fd < 0 || (flags & (O_TRUNC|O_EXCL))
!                     || (size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0)
        mfp->mf_blocknr_max = 0;        /* no file or empty file */
      else
        mfp->mf_blocknr_max = (blocknr_T)((size + mfp->mf_page_size - 1)
--- 179,185 ----
  #endif
  
      if (mfp->mf_fd < 0 || (flags & (O_TRUNC|O_EXCL))
!                 || (size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0)
        mfp->mf_blocknr_max = 0;        /* no file or empty file */
      else
        mfp->mf_blocknr_max = (blocknr_T)((size + mfp->mf_page_size - 1)
***************
*** 966,972 ****
      static int
  mf_read(memfile_T *mfp, bhdr_T *hp)
  {
!     off_t     offset;
      unsigned  page_size;
      unsigned  size;
  
--- 966,972 ----
      static int
  mf_read(memfile_T *mfp, bhdr_T *hp)
  {
!     off_T     offset;
      unsigned  page_size;
      unsigned  size;
  
***************
*** 974,982 ****
        return FAIL;
  
      page_size = mfp->mf_page_size;
!     offset = (off_t)page_size * hp->bh_bnum;
      size = page_size * hp->bh_page_count;
!     if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
      {
        PERROR(_("E294: Seek error in swap file read"));
        return FAIL;
--- 974,982 ----
        return FAIL;
  
      page_size = mfp->mf_page_size;
!     offset = (off_T)page_size * hp->bh_bnum;
      size = page_size * hp->bh_page_count;
!     if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
      {
        PERROR(_("E294: Seek error in swap file read"));
        return FAIL;
***************
*** 1005,1011 ****
      static int
  mf_write(memfile_T *mfp, bhdr_T *hp)
  {
!     off_t     offset;     /* offset in the file */
      blocknr_T nr;         /* block nr which is being written */
      bhdr_T    *hp2;
      unsigned  page_size;  /* number of bytes in a page */
--- 1005,1011 ----
      static int
  mf_write(memfile_T *mfp, bhdr_T *hp)
  {
!     off_T     offset;     /* offset in the file */
      blocknr_T nr;         /* block nr which is being written */
      bhdr_T    *hp2;
      unsigned  page_size;  /* number of bytes in a page */
***************
*** 1038,1045 ****
        else
            hp2 = hp;
  
!       offset = (off_t)page_size * nr;
!       if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
        {
            PERROR(_("E296: Seek error in swap file write"));
            return FAIL;
--- 1038,1045 ----
        else
            hp2 = hp;
  
!       offset = (off_T)page_size * nr;
!       if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
        {
            PERROR(_("E296: Seek error in swap file write"));
            return FAIL;
***************
*** 1083,1089 ****
  mf_write_block(
      memfile_T *mfp,
      bhdr_T    *hp,
!     off_t     offset UNUSED,
      unsigned  size)
  {
      char_u    *data = hp->bh_data;
--- 1083,1089 ----
  mf_write_block(
      memfile_T *mfp,
      bhdr_T    *hp,
!     off_T     offset UNUSED,
      unsigned  size)
  {
      char_u    *data = hp->bh_data;
***************
*** 1247,1253 ****
      int               flags)          /* flags for open() */
  {
  #ifdef HAVE_LSTAT
!     struct stat sb;
  #endif
  
      mfp->mf_fname = fname;
--- 1247,1253 ----
      int               flags)          /* flags for open() */
  {
  #ifdef HAVE_LSTAT
!     stat_T    sb;
  #endif
  
      mfp->mf_fname = fname;
*** ../vim-7.4.1974/src/memline.c       2016-06-13 20:23:49.905289147 +0200
--- src/memline.c       2016-07-01 17:02:50.874814688 +0200
***************
*** 266,272 ****
  static char_u *make_percent_swname(char_u *dir, char_u *name);
  #endif
  #ifdef FEAT_CRYPT
! static cryptstate_T *ml_crypt_prepare(memfile_T *mfp, off_t offset, int 
reading);
  #endif
  #ifdef FEAT_BYTEOFF
  static void ml_updatechunk(buf_T *buf, long line, long len, int updtype);
--- 266,272 ----
  static char_u *make_percent_swname(char_u *dir, char_u *name);
  #endif
  #ifdef FEAT_CRYPT
! static cryptstate_T *ml_crypt_prepare(memfile_T *mfp, off_T offset, int 
reading);
  #endif
  #ifdef FEAT_BYTEOFF
  static void ml_updatechunk(buf_T *buf, long line, long len, int updtype);
***************
*** 973,979 ****
      static void
  set_b0_fname(ZERO_BL *b0p, buf_T *buf)
  {
!     struct stat       st;
  
      if (buf->b_ffname == NULL)
        b0p->b0_fname[0] = NUL;
--- 973,979 ----
      static void
  set_b0_fname(ZERO_BL *b0p, buf_T *buf)
  {
!     stat_T    st;
  
      if (buf->b_ffname == NULL)
        b0p->b0_fname[0] = NUL;
***************
*** 1114,1120 ****
      infoptr_T *ip;
      blocknr_T bnum;
      int               page_count;
!     struct stat       org_stat, swp_stat;
      int               len;
      int               directly;
      linenr_T  lnum;
--- 1114,1120 ----
      infoptr_T *ip;
      blocknr_T bnum;
      int               page_count;
!     stat_T    org_stat, swp_stat;
      int               len;
      int               directly;
      linenr_T  lnum;
***************
*** 1127,1133 ****
      int               idx;
      int               top;
      int               txt_start;
!     off_t     size;
      int               called_from_main;
      int               serious_error = TRUE;
      long      mtime;
--- 1127,1133 ----
      int               idx;
      int               top;
      int               txt_start;
!     off_T     size;
      int               called_from_main;
      int               serious_error = TRUE;
      long      mtime;
***************
*** 1323,1329 ****
            msg_end();
            goto theend;
        }
!       if ((size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0)
            mfp->mf_blocknr_max = 0;        /* no file or empty file */
        else
            mfp->mf_blocknr_max = (blocknr_T)(size / mfp->mf_page_size);
--- 1323,1329 ----
            msg_end();
            goto theend;
        }
!       if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0)
            mfp->mf_blocknr_max = 0;        /* no file or empty file */
        else
            mfp->mf_blocknr_max = (blocknr_T)(size / mfp->mf_page_size);
***************
*** 1908,1914 ****
         */
        if (*dirp == NUL && file_count + num_files == 0 && fname != NULL)
        {
!           struct stat     st;
            char_u          *swapname;
  
            swapname = modname(fname_res,
--- 1908,1914 ----
         */
        if (*dirp == NUL && file_count + num_files == 0 && fname != NULL)
        {
!           stat_T          st;
            char_u          *swapname;
  
            swapname = modname(fname_res,
***************
*** 2049,2055 ****
      static time_t
  swapfile_info(char_u *fname)
  {
!     struct stat           st;
      int                   fd;
      struct block0   b0;
      time_t        x = (time_t)0;
--- 2049,2055 ----
      static time_t
  swapfile_info(char_u *fname)
  {
!     stat_T        st;
      int                   fd;
      struct block0   b0;
      time_t        x = (time_t)0;
***************
*** 2262,2268 ****
  ml_sync_all(int check_file, int check_char)
  {
      buf_T             *buf;
!     struct stat               st;
  
      for (buf = firstbuf; buf != NULL; buf = buf->b_next)
      {
--- 2262,2268 ----
  ml_sync_all(int check_file, int check_char)
  {
      buf_T             *buf;
!     stat_T            st;
  
      for (buf = firstbuf; buf != NULL; buf = buf->b_next)
      {
***************
*** 4029,4035 ****
      buf_T   *buf,     /* buffer being edited */
      char_u  *fname)   /* swap file name */
  {
!     struct stat st;
      time_t    x, sx;
      char      *p;
  
--- 4029,4035 ----
      buf_T   *buf,     /* buffer being edited */
      char_u  *fname)   /* swap file name */
  {
!     stat_T    st;
      time_t    x, sx;
      char      *p;
  
***************
*** 4207,4213 ****
        {
            char_u          *tail;
            char_u          *fname2;
!           struct stat     s1, s2;
            int             f1, f2;
            int             created1 = FALSE, created2 = FALSE;
            int             same = FALSE;
--- 4207,4213 ----
        {
            char_u          *tail;
            char_u          *fname2;
!           stat_T          s1, s2;
            int             f1, f2;
            int             created1 = FALSE, created2 = FALSE;
            int             same = FALSE;
***************
*** 4296,4302 ****
        if (mch_getperm(fname) < 0)     /* it does not exist */
        {
  #ifdef HAVE_LSTAT
!           struct stat sb;
  
            /*
             * Extra security check: When a swap file is a symbolic link, this
--- 4296,4302 ----
        if (mch_getperm(fname) < 0)     /* it does not exist */
        {
  #ifdef HAVE_LSTAT
!           stat_T      sb;
  
            /*
             * Extra security check: When a swap file is a symbolic link, this
***************
*** 4663,4669 ****
      char_u    *fname_s,           /* file name from swap file */
      long      ino_block0)
  {
!     struct stat       st;
      ino_t     ino_c = 0;          /* ino of current file */
      ino_t     ino_s;              /* ino of file from swap file */
      char_u    buf_c[MAXPATHL];    /* full path of fname_c */
--- 4663,4669 ----
      char_u    *fname_s,           /* file name from swap file */
      long      ino_block0)
  {
!     stat_T    st;
      ino_t     ino_c = 0;          /* ino of current file */
      ino_t     ino_s;              /* ino of file from swap file */
      char_u    buf_c[MAXPATHL];    /* full path of fname_c */
***************
*** 4780,4786 ****
  ml_encrypt_data(
      memfile_T *mfp,
      char_u    *data,
!     off_t     offset,
      unsigned  size)
  {
      DATA_BL   *dp = (DATA_BL *)data;
--- 4780,4786 ----
  ml_encrypt_data(
      memfile_T *mfp,
      char_u    *data,
!     off_T     offset,
      unsigned  size)
  {
      DATA_BL   *dp = (DATA_BL *)data;
***************
*** 4825,4831 ****
  ml_decrypt_data(
      memfile_T *mfp,
      char_u    *data,
!     off_t     offset,
      unsigned  size)
  {
      DATA_BL   *dp = (DATA_BL *)data;
--- 4825,4831 ----
  ml_decrypt_data(
      memfile_T *mfp,
      char_u    *data,
!     off_T     offset,
      unsigned  size)
  {
      DATA_BL   *dp = (DATA_BL *)data;
***************
*** 4859,4865 ****
   * Return an allocated cryptstate_T *.
   */
      static cryptstate_T *
! ml_crypt_prepare(memfile_T *mfp, off_t offset, int reading)
  {
      buf_T     *buf = mfp->mf_buffer;
      char_u    salt[50];
--- 4859,4865 ----
   * Return an allocated cryptstate_T *.
   */
      static cryptstate_T *
! ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading)
  {
      buf_T     *buf = mfp->mf_buffer;
      char_u    salt[50];
*** ../vim-7.4.1974/src/misc1.c 2016-06-04 20:14:00.302000092 +0200
--- src/misc1.c 2016-07-01 17:02:50.878814629 +0200
***************
*** 4056,4062 ****
                {
                    char_u      test[MAXPATHL], paths[MAXPATHL];
                    char_u      *path, *next_path, *ptr;
!                   struct stat st;
  
                    STRCPY(paths, USER_HOME);
                    next_path = paths;
--- 4056,4062 ----
                {
                    char_u      test[MAXPATHL], paths[MAXPATHL];
                    char_u      *path, *next_path, *ptr;
!                   stat_T      st;
  
                    STRCPY(paths, USER_HOME);
                    next_path = paths;
***************
*** 4752,4758 ****
      char_u        exp1[MAXPATHL];
      char_u        full1[MAXPATHL];
      char_u        full2[MAXPATHL];
!     struct stat           st1, st2;
      int                   r1, r2;
  
      expand_env(s1, exp1, MAXPATHL);
--- 4752,4758 ----
      char_u        exp1[MAXPATHL];
      char_u        full1[MAXPATHL];
      char_u        full2[MAXPATHL];
!     stat_T        st1, st2;
      int                   r1, r2;
  
      expand_env(s1, exp1, MAXPATHL);
***************
*** 9500,9506 ****
      int
  vim_fexists(char_u *fname)
  {
!     struct stat st;
  
      if (mch_stat((char *)fname, &st))
        return FALSE;
--- 9500,9506 ----
      int
  vim_fexists(char_u *fname)
  {
!     stat_T st;
  
      if (mch_stat((char *)fname, &st))
        return FALSE;
***************
*** 10217,10223 ****
                }
                else
                {
!                   struct stat sb;
  
                    /* no more wildcards, check if there is a match */
                    /* remove backslashes for the remaining components only */
--- 10217,10223 ----
                }
                else
                {
!                   stat_T  sb;
  
                    /* no more wildcards, check if there is a match */
                    /* remove backslashes for the remaining components only */
***************
*** 10972,10978 ****
  {
      char_u    *p;
      int               isdir;
!     struct stat sb;
  
      /* if the file/dir/link doesn't exist, may not add it */
      if (!(flags & EW_NOTFOUND) && ((flags & EW_ALLLINKS)
--- 10972,10978 ----
  {
      char_u    *p;
      int               isdir;
!     stat_T    sb;
  
      /* if the file/dir/link doesn't exist, may not add it */
      if (!(flags & EW_NOTFOUND) && ((flags & EW_ALLLINKS)
*** ../vim-7.4.1974/src/misc2.c 2016-07-01 11:59:43.177876159 +0200
--- src/misc2.c 2016-07-01 17:02:50.878814629 +0200
***************
*** 5047,5053 ****
  {
      ff_visited_T      *vp;
  #ifdef UNIX
!     struct stat               st;
      int                       url = FALSE;
  #endif
  
--- 5047,5053 ----
  {
      ff_visited_T      *vp;
  #ifdef UNIX
!     stat_T            st;
      int                       url = FALSE;
  #endif
  
*** ../vim-7.4.1974/src/netbeans.c      2016-07-01 12:50:50.056997079 +0200
--- src/netbeans.c      2016-07-01 17:02:50.878814629 +0200
***************
*** 256,262 ****
      char_u *lp;
      char_u *nlp;
  #ifdef UNIX
!     struct stat       st;
  
      /*
       * For Unix only accept the file when it's not accessible by others.
--- 256,262 ----
      char_u *lp;
      char_u *nlp;
  #ifdef UNIX
!     stat_T    st;
  
      /*
       * For Unix only accept the file when it's not accessible by others.
***************
*** 561,567 ****
                        char_u *tooltip, char_u *glyphfile,
                        char_u *fg, char_u *bg);
  static void print_read_msg(nbbuf_T *buf);
! static void print_save_msg(nbbuf_T *buf, off_t nchars);
  
  static int curPCtype = -1;
  
--- 561,567 ----
                        char_u *tooltip, char_u *glyphfile,
                        char_u *fg, char_u *bg);
  static void print_read_msg(nbbuf_T *buf);
! static void print_save_msg(nbbuf_T *buf, off_T nchars);
  
  static int curPCtype = -1;
  
***************
*** 1741,1747 ****
                buf->bufp->b_changed = TRUE;
            else
            {
!               struct stat     st;
  
                /* Assume NetBeans stored the file.  Reset the timestamp to
                 * avoid "file changed" warnings. */
--- 1741,1747 ----
                buf->bufp->b_changed = TRUE;
            else
            {
!               stat_T  st;
  
                /* Assume NetBeans stored the file.  Reset the timestamp to
                 * avoid "file changed" warnings. */
***************
*** 3470,3476 ****
  print_read_msg(nbbuf_T *buf)
  {
      int           lnum = buf->bufp->b_ml.ml_line_count;
!     off_t   nchars = buf->bufp->b_orig_size;
      char_u  c;
  
      msg_add_fname(buf->bufp, buf->bufp->b_ffname);
--- 3470,3476 ----
  print_read_msg(nbbuf_T *buf)
  {
      int           lnum = buf->bufp->b_ml.ml_line_count;
!     off_T   nchars = buf->bufp->b_orig_size;
      char_u  c;
  
      msg_add_fname(buf->bufp, buf->bufp->b_ffname);
***************
*** 3504,3510 ****
   * writing a file.
   */
      static void
! print_save_msg(nbbuf_T *buf, off_t nchars)
  {
      char_u    c;
      char_u    *p;
--- 3504,3510 ----
   * writing a file.
   */
      static void
! print_save_msg(nbbuf_T *buf, off_T nchars)
  {
      char_u    c;
      char_u    *p;
*** ../vim-7.4.1974/src/os_mswin.c      2016-05-11 21:04:59.800470737 +0200
--- src/os_mswin.c      2016-07-01 17:02:50.878814629 +0200
***************
*** 481,486 ****
--- 481,498 ----
      }
  }
  
+ /* Use 64-bit stat functions if available. */
+ #ifdef HAVE_STAT64
+ # undef stat
+ # undef _stat
+ # undef _wstat
+ # undef _fstat
+ # define stat _stat64
+ # define _stat _stat64
+ # define _wstat _wstat64
+ # define _fstat _fstat64
+ #endif
+ 
  #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
  # define OPEN_OH_ARGTYPE intptr_t
  #else
***************
*** 488,494 ****
  #endif
  
      static int
! stat_symlink_aware(const char *name, struct stat *stp)
  {
  #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__)
      /* Work around for VC12 or earlier (and MinGW). stat() can't handle
--- 500,506 ----
  #endif
  
      static int
! stat_symlink_aware(const char *name, stat_T *stp)
  {
  #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__)
      /* Work around for VC12 or earlier (and MinGW). stat() can't handle
***************
*** 527,533 ****
            int     fd, n;
  
            fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
!           n = _fstat(fd, (struct _stat*)stp);
            if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY))
                stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR;
            _close(fd);
--- 539,545 ----
            int     fd, n;
  
            fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
!           n = _fstat(fd, (struct _stat *)stp);
            if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY))
                stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR;
            _close(fd);
***************
*** 540,546 ****
  
  #ifdef FEAT_MBYTE
      static int
! wstat_symlink_aware(const WCHAR *name, struct _stat *stp)
  {
  # if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__)
      /* Work around for VC12 or earlier (and MinGW). _wstat() can't handle
--- 552,558 ----
  
  #ifdef FEAT_MBYTE
      static int
! wstat_symlink_aware(const WCHAR *name, stat_T *stp)
  {
  # if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__)
      /* Work around for VC12 or earlier (and MinGW). _wstat() can't handle
***************
*** 580,586 ****
            int     fd;
  
            fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
!           n = _fstat(fd, stp);
            if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY))
                stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR;
            _close(fd);
--- 592,598 ----
            int     fd;
  
            fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
!           n = _fstat(fd, (struct _stat *)stp);
            if ((n == 0) && (attr & FILE_ATTRIBUTE_DIRECTORY))
                stp->st_mode = (stp->st_mode & ~S_IFREG) | S_IFDIR;
            _close(fd);
***************
*** 588,594 ****
        }
      }
  # endif
!     return _wstat(name, stp);
  }
  #endif
  
--- 600,606 ----
        }
      }
  # endif
!     return _wstat(name, (struct _stat *)stp);
  }
  #endif
  
***************
*** 596,602 ****
   * stat() can't handle a trailing '/' or '\', remove it first.
   */
      int
! vim_stat(const char *name, struct stat *stp)
  {
  #ifdef FEAT_MBYTE
      /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
--- 608,614 ----
   * stat() can't handle a trailing '/' or '\', remove it first.
   */
      int
! vim_stat(const char *name, stat_T *stp)
  {
  #ifdef FEAT_MBYTE
      /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
***************
*** 641,647 ****
  
        if (wp != NULL)
        {
!           n = wstat_symlink_aware(wp, (struct _stat *)stp);
            vim_free(wp);
            if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
                return n;
--- 653,659 ----
  
        if (wp != NULL)
        {
!           n = wstat_symlink_aware(wp, stp);
            vim_free(wp);
            if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
                return n;
*** ../vim-7.4.1974/src/os_win32.c      2016-04-20 20:55:52.258605761 +0200
--- src/os_win32.c      2016-07-01 17:02:50.882814572 +0200
***************
*** 3058,3064 ****
      long
  mch_getperm(char_u *name)
  {
!     struct stat st;
      int               n;
  
      n = mch_stat((char *)name, &st);
--- 3058,3064 ----
      long
  mch_getperm(char_u *name)
  {
!     stat_T    st;
      int               n;
  
      n = mch_stat((char *)name, &st);
*** ../vim-7.4.1974/src/proto/fileio.pro        2016-06-09 22:52:56.207926413 
+0200
--- src/proto/fileio.pro        2016-07-01 17:02:50.882814572 +0200
***************
*** 7,13 ****
  int check_file_readonly(char_u *fname, int perm);
  int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, 
linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int 
filtering);
  void msg_add_fname(buf_T *buf, char_u *fname);
! void msg_add_lines(int insert_space, long lnum, off_t nchars);
  char_u *shorten_fname1(char_u *full_path);
  char_u *shorten_fname(char_u *full_path, char_u *dir_name);
  void shorten_fnames(int force);
--- 7,13 ----
  int check_file_readonly(char_u *fname, int perm);
  int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, 
linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int 
filtering);
  void msg_add_fname(buf_T *buf, char_u *fname);
! void msg_add_lines(int insert_space, long lnum, off_T nchars);
  char_u *shorten_fname1(char_u *full_path);
  char_u *shorten_fname(char_u *full_path, char_u *dir_name);
  void shorten_fnames(int force);
***************
*** 20,26 ****
  int check_timestamps(int focus);
  int buf_check_timestamp(buf_T *buf, int focus);
  void buf_reload(buf_T *buf, int orig_mode);
! void buf_store_time(buf_T *buf, struct stat *st, char_u *fname);
  void write_lnum_adjust(linenr_T offset);
  int delete_recursive(char_u *name);
  void vim_deltempdir(void);
--- 20,26 ----
  int check_timestamps(int focus);
  int buf_check_timestamp(buf_T *buf, int focus);
  void buf_reload(buf_T *buf, int orig_mode);
! void buf_store_time(buf_T *buf, stat_T *st, char_u *fname);
  void write_lnum_adjust(linenr_T offset);
  int delete_recursive(char_u *name);
  void vim_deltempdir(void);
*** ../vim-7.4.1974/src/proto/memline.pro       2016-01-19 13:21:55.841334333 
+0100
--- src/proto/memline.pro       2016-07-01 16:59:13.725956575 +0200
***************
*** 30,37 ****
  char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u 
*dir_name);
  char_u *get_file_in_dir(char_u *fname, char_u *dname);
  void ml_setflags(buf_T *buf);
! char_u *ml_encrypt_data(memfile_T *mfp, char_u *data, off_t offset, unsigned 
size);
! void ml_decrypt_data(memfile_T *mfp, char_u *data, off_t offset, unsigned 
size);
  long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp);
  void goto_byte(long cnt);
  /* vim: set ft=c : */
--- 30,37 ----
  char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u 
*dir_name);
  char_u *get_file_in_dir(char_u *fname, char_u *dname);
  void ml_setflags(buf_T *buf);
! char_u *ml_encrypt_data(memfile_T *mfp, char_u *data, off_T offset, unsigned 
size);
! void ml_decrypt_data(memfile_T *mfp, char_u *data, off_T offset, unsigned 
size);
  long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp);
  void goto_byte(long cnt);
  /* vim: set ft=c : */
*** ../vim-7.4.1974/src/proto/os_mswin.pro      2016-04-03 22:22:25.353340490 
+0200
--- src/proto/os_mswin.pro      2016-07-01 17:02:50.882814572 +0200
***************
*** 9,15 ****
  int mch_FullName(char_u *fname, char_u *buf, int len, int force);
  int mch_isFullName(char_u *fname);
  void slash_adjust(char_u *p);
! int vim_stat(const char *name, struct stat *stp);
  void mch_settmode(int tmode);
  int mch_get_shellsize(void);
  void mch_set_shellsize(void);
--- 9,15 ----
  int mch_FullName(char_u *fname, char_u *buf, int len, int force);
  int mch_isFullName(char_u *fname);
  void slash_adjust(char_u *p);
! int vim_stat(const char *name, stat_T *stp);
  void mch_settmode(int tmode);
  int mch_get_shellsize(void);
  void mch_set_shellsize(void);
*** ../vim-7.4.1974/src/pty.c   2016-01-31 17:30:47.422544414 +0100
--- src/pty.c   2016-07-01 17:02:50.882814572 +0200
***************
*** 247,253 ****
  OpenPTY(char **ttyn)
  {
      int               f;
!     struct stat buf;
      /* used for opening a new pty-pair: */
      static char TtyName[32];
  
--- 247,253 ----
  OpenPTY(char **ttyn)
  {
      int               f;
!     stat_T    buf;
      /* used for opening a new pty-pair: */
      static char TtyName[32];
  
*** ../vim-7.4.1974/src/quickfix.c      2016-07-01 14:48:02.650783921 +0200
--- src/quickfix.c      2016-07-01 17:02:50.882814572 +0200
***************
*** 3268,3274 ****
      static int        start = -1;
      static int        off = 0;
  #ifdef HAVE_LSTAT
!     struct stat       sb;
  #endif
  
      if (*p_mef == NUL)
--- 3268,3274 ----
      static int        start = -1;
      static int        off = 0;
  #ifdef HAVE_LSTAT
!     stat_T    sb;
  #endif
  
      if (*p_mef == NUL)
*** ../vim-7.4.1974/src/spell.c 2016-04-21 09:20:17.787279918 +0200
--- src/spell.c 2016-07-01 17:02:50.882814572 +0200
***************
*** 9037,9043 ****
      afffile_T *(afile[8]);
      int               i;
      int               len;
!     struct stat       st;
      int               error = FALSE;
      spellinfo_T spin;
  
--- 9037,9043 ----
      afffile_T *(afile[8]);
      int               i;
      int               len;
!     stat_T    st;
      int               error = FALSE;
      spellinfo_T spin;
  
*** ../vim-7.4.1974/src/structs.h       2016-06-26 16:44:19.519620863 +0200
--- src/structs.h       2016-07-01 16:59:13.725956575 +0200
***************
*** 1751,1757 ****
  
      long      b_mtime;        /* last change time of original file */
      long      b_mtime_read;   /* last change time when reading */
!     off_t     b_orig_size;    /* size of original file in bytes */
      int               b_orig_mode;    /* mode of original file */
  
      pos_T     b_namedm[NMARKS]; /* current named marks (mark.c) */
--- 1751,1757 ----
  
      long      b_mtime;        /* last change time of original file */
      long      b_mtime_read;   /* last change time when reading */
!     off_T     b_orig_size;    /* size of original file in bytes */
      int               b_orig_mode;    /* mode of original file */
  
      pos_T     b_namedm[NMARKS]; /* current named marks (mark.c) */
*** ../vim-7.4.1974/src/tag.c   2016-05-05 18:13:59.412035344 +0200
--- src/tag.c   2016-07-01 17:02:50.882814572 +0200
***************
*** 83,97 ****
  
  static char_u *tagmatchname = NULL;   /* name of last used tag */
  
- /*
-  * We use ftello() here, if available.  It returns off_t instead of long,
-  * which helps if long is 32 bit and off_t is 64 bit.
-  * We assume that when fseeko() is available then ftello() is too.
-  */
- #ifdef HAVE_FSEEKO
- # define ftell ftello
- #endif
- 
  #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
  /*
   * Tag for preview window is remembered separately, to avoid messing up the
--- 83,88 ----
***************
*** 1297,1315 ****
      int               tag_file_sorted = NUL;  /* !_TAG_FILE_SORTED value */
      struct tag_search_info    /* Binary search file offsets */
      {
!       off_t   low_offset;     /* offset for first char of first line that
                                   could match */
!       off_t   high_offset;    /* offset of char after last line that could
                                   match */
!       off_t   curr_offset;    /* Current file offset in search range */
!       off_t   curr_offset_used; /* curr_offset used when skipping back */
!       off_t   match_offset;   /* Where the binary search found a tag */
        int     low_char;       /* first char at low_offset */
        int     high_char;      /* first char at high_offset */
      } search_info;
!     off_t     filesize;
      int               tagcmp;
!     off_t     offset;
      int               round;
  #endif
      enum
--- 1288,1306 ----
      int               tag_file_sorted = NUL;  /* !_TAG_FILE_SORTED value */
      struct tag_search_info    /* Binary search file offsets */
      {
!       off_T   low_offset;     /* offset for first char of first line that
                                   could match */
!       off_T   high_offset;    /* offset of char after last line that could
                                   match */
!       off_T   curr_offset;    /* Current file offset in search range */
!       off_T   curr_offset_used; /* curr_offset used when skipping back */
!       off_T   match_offset;   /* Where the binary search found a tag */
        int     low_char;       /* first char at low_offset */
        int     high_char;      /* first char at high_offset */
      } search_info;
!     off_T     filesize;
      int               tagcmp;
!     off_T     offset;
      int               round;
  #endif
      enum
***************
*** 1640,1664 ****
            {
                /* Adjust the search file offset to the correct position */
                search_info.curr_offset_used = search_info.curr_offset;
! #ifdef HAVE_FSEEKO
!               fseeko(fp, search_info.curr_offset, SEEK_SET);
! #else
!               fseek(fp, (long)search_info.curr_offset, SEEK_SET);
! #endif
                eof = tag_fgets(lbuf, LSIZE, fp);
                if (!eof && search_info.curr_offset != 0)
                {
                    /* The explicit cast is to work around a bug in gcc 3.4.2
                     * (repeated below). */
!                   search_info.curr_offset = ftell(fp);
                    if (search_info.curr_offset == search_info.high_offset)
                    {
                        /* oops, gone a bit too far; try from low offset */
! #ifdef HAVE_FSEEKO
!                       fseeko(fp, search_info.low_offset, SEEK_SET);
! #else
!                       fseek(fp, (long)search_info.low_offset, SEEK_SET);
! #endif
                        search_info.curr_offset = search_info.low_offset;
                    }
                    eof = tag_fgets(lbuf, LSIZE, fp);
--- 1631,1647 ----
            {
                /* Adjust the search file offset to the correct position */
                search_info.curr_offset_used = search_info.curr_offset;
!               vim_fseek(fp, search_info.curr_offset, SEEK_SET);
                eof = tag_fgets(lbuf, LSIZE, fp);
                if (!eof && search_info.curr_offset != 0)
                {
                    /* The explicit cast is to work around a bug in gcc 3.4.2
                     * (repeated below). */
!                   search_info.curr_offset = vim_ftell(fp);
                    if (search_info.curr_offset == search_info.high_offset)
                    {
                        /* oops, gone a bit too far; try from low offset */
!                       vim_fseek(fp, search_info.low_offset, SEEK_SET);
                        search_info.curr_offset = search_info.low_offset;
                    }
                    eof = tag_fgets(lbuf, LSIZE, fp);
***************
*** 1666,1679 ****
                /* skip empty and blank lines */
                while (!eof && vim_isblankline(lbuf))
                {
!                   search_info.curr_offset = ftell(fp);
                    eof = tag_fgets(lbuf, LSIZE, fp);
                }
                if (eof)
                {
                    /* Hit end of file.  Skip backwards. */
                    state = TS_SKIP_BACK;
!                   search_info.match_offset = ftell(fp);
                    search_info.curr_offset = search_info.curr_offset_used;
                    continue;
                }
--- 1649,1662 ----
                /* skip empty and blank lines */
                while (!eof && vim_isblankline(lbuf))
                {
!                   search_info.curr_offset = vim_ftell(fp);
                    eof = tag_fgets(lbuf, LSIZE, fp);
                }
                if (eof)
                {
                    /* Hit end of file.  Skip backwards. */
                    state = TS_SKIP_BACK;
!                   search_info.match_offset = vim_ftell(fp);
                    search_info.curr_offset = search_info.curr_offset_used;
                    continue;
                }
***************
*** 1899,1910 ****
                {
                    /* Get the tag file size (don't use mch_fstat(), it's not
                     * portable). */
!                   if ((filesize = lseek(fileno(fp),
!                                                  (off_t)0L, SEEK_END)) <= 0)
                        state = TS_LINEAR;
                    else
                    {
!                       lseek(fileno(fp), (off_t)0L, SEEK_SET);
  
                        /* Calculate the first read offset in the file.  Start
                         * the search in the middle of the file. */
--- 1882,1893 ----
                {
                    /* Get the tag file size (don't use mch_fstat(), it's not
                     * portable). */
!                   if ((filesize = vim_lseek(fileno(fp),
!                                                  (off_T)0L, SEEK_END)) <= 0)
                        state = TS_LINEAR;
                    else
                    {
!                       vim_lseek(fileno(fp), (off_T)0L, SEEK_SET);
  
                        /* Calculate the first read offset in the file.  Start
                         * the search in the middle of the file. */
***************
*** 1956,1966 ****
                            /* Avoid getting stuck. */
                            linear = TRUE;
                            state = TS_LINEAR;
! # ifdef HAVE_FSEEKO
!                           fseeko(fp, search_info.low_offset, SEEK_SET);
! # else
!                           fseek(fp, (long)search_info.low_offset, SEEK_SET);
! # endif
                        }
  #endif
                        continue;
--- 1939,1945 ----
                            /* Avoid getting stuck. */
                            linear = TRUE;
                            state = TS_LINEAR;
!                           vim_fseek(fp, search_info.low_offset, SEEK_SET);
                        }
  #endif
                        continue;
***************
*** 2058,2064 ****
                    }
                    if (tagcmp < 0)
                    {
!                       search_info.curr_offset = ftell(fp);
                        if (search_info.curr_offset < search_info.high_offset)
                        {
                            search_info.low_offset = search_info.curr_offset;
--- 2037,2043 ----
                    }
                    if (tagcmp < 0)
                    {
!                       search_info.curr_offset = vim_ftell(fp);
                        if (search_info.curr_offset < search_info.high_offset)
                        {
                            search_info.low_offset = search_info.curr_offset;
***************
*** 2099,2105 ****
                {
                    if (MB_STRNICMP(tagp.tagname, orgpat.head, cmplen) != 0)
                    {
!                       if ((off_t)ftell(fp) > search_info.match_offset)
                            break;      /* past last match */
                        else
                            continue;   /* before first match */
--- 2078,2084 ----
                {
                    if (MB_STRNICMP(tagp.tagname, orgpat.head, cmplen) != 0)
                    {
!                       if ((off_T)vim_ftell(fp) > search_info.match_offset)
                            break;      /* past last match */
                        else
                            continue;   /* before first match */
***************
*** 2444,2450 ****
  #ifdef FEAT_CSCOPE
            if (!use_cscope)
  #endif
!               EMSGN(_("Before byte %ld"), (long)ftell(fp));
            stop_searching = TRUE;
            line_error = FALSE;
        }
--- 2423,2429 ----
  #ifdef FEAT_CSCOPE
            if (!use_cscope)
  #endif
!               EMSGN(_("Before byte %ld"), (long)vim_ftell(fp));
            stop_searching = TRUE;
            line_error = FALSE;
        }
***************
*** 3539,3545 ****
            {
                int             do_strip = FALSE;
                char_u          saved_char;
!               struct stat     st;
  
                /* Don't strip for an erroneous file name. */
                if (!stripping_disabled)
--- 3518,3524 ----
            {
                int             do_strip = FALSE;
                char_u          saved_char;
!               stat_T          st;
  
                /* Don't strip for an erroneous file name. */
                if (!stripping_disabled)
***************
*** 3584,3590 ****
  #ifdef UNIX
                        if (do_strip)
                        {
!                           struct stat new_st;
  
                            /* On Unix, the check for the unstripped file name
                             * above works also for a symbolic link pointing to
--- 3563,3569 ----
  #ifdef UNIX
                        if (do_strip)
                        {
!                           stat_T      new_st;
  
                            /* On Unix, the check for the unstripped file name
                             * above works also for a symbolic link pointing to
*** ../vim-7.4.1974/src/testdir/Make_all.mak    2016-06-26 19:38:05.787014867 
+0200
--- src/testdir/Make_all.mak    2016-07-01 17:04:48.657107198 +0200
***************
*** 180,185 ****
--- 180,186 ----
            test_perl.res \
            test_quickfix.res \
            test_ruby.res \
+           test_stat.res \
            test_syntax.res \
            test_usercommands.res \
            test_viminfo.res \
*** ../vim-7.4.1974/src/testdir/test_largefile.vim      2016-07-01 
17:15:58.359360736 +0200
--- src/testdir/test_largefile.vim      2016-07-01 17:07:41.666595185 +0200
***************
*** 0 ****
--- 1,30 ----
+ " Tests for large files
+ " This is only executed manually: "make test_largefile".
+ " This is not run as part of "make test".
+ 
+ func Test_largefile()
+   let fname = 'Xlarge.txt'
+ 
+   call delete(fname)
+   exe "e" fname
+   " Make sure that a line break is 1 byte (LF).
+   set ff=unix
+   set undolevels=-1
+   " Input 99 'A's. The line becomes 100 bytes including a line break.
+   exe "normal 99iA\<Esc>"
+   yank
+   " Put 39,999,999 times. The file becomes 4,000,000,000 bytes.
+   normal 39999999p
+   " Moving around in the file randomly.
+   normal G
+   normal 10%
+   normal 90%
+   normal 50%
+   normal gg
+   w
+   " Check if the file size is larger than 2^31 - 1 bytes.
+   " Note that getfsize() returns -2 if a Number is 32 bits.
+   let fsize=getfsize(fname)
+   call assert_true(fsize > 2147483647 || fsize == -2)
+   "call delete(fname)
+ endfunc
*** ../vim-7.4.1974/src/testdir/test_stat.vim   2016-07-01 17:15:58.367360620 
+0200
--- src/testdir/test_stat.vim   2016-07-01 17:04:48.657107198 +0200
***************
*** 0 ****
--- 1,64 ----
+ " Tests for stat functions and checktime
+ 
+ func Test_existent_file()
+   let fname='Xtest.tmp'
+ 
+   let ts=localtime()
+   sleep 1
+   let fl=['Hello World!']
+   call writefile(fl, fname)
+   let tf=getftime(fname)
+   sleep 1
+   let te=localtime()
+ 
+   call assert_true(ts <= tf && tf <= te)
+   call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
+   call assert_equal('file', getftype(fname))
+   call assert_equal('rw-', getfperm(fname)[0:2])
+ endfunc
+ 
+ func Test_existent_directory()
+   let dname='.'
+ 
+   call assert_equal(0, getfsize(dname))
+   call assert_equal('dir', getftype(dname))
+   call assert_equal('rwx', getfperm(dname)[0:2])
+ endfunc
+ 
+ func Test_checktime()
+   let fname='Xtest.tmp'
+ 
+   let fl=['Hello World!']
+   call writefile(fl, fname)
+   set autoread
+   exec 'e' fname
+   sleep 2
+   let fl=readfile(fname)
+   let fl[0] .= ' - checktime'
+   call writefile(fl, fname)
+   checktime
+   call assert_equal(fl[0], getline(1))
+ endfunc
+ 
+ func Test_nonexistent_file()
+   let fname='Xtest.tmp'
+ 
+   call delete(fname)
+   call assert_equal(-1, getftime(fname))
+   call assert_equal(-1, getfsize(fname))
+   call assert_equal('', getftype(fname))
+   call assert_equal('', getfperm(fname))
+ endfunc
+ 
+ func Test_win32_symlink_dir()
+   " On Windows, non-admin users cannot create symlinks.
+   " So we use an existing symlink for this test.
+   if has('win32')
+     " Check if 'C:\Users\All Users' is a symlink to a directory.
+     let res=system('dir C:\Users /a')
+     if match(res, '\C<SYMLINKD> *All Users') >= 0
+       " Get the filetype of the symlink.
+       call assert_equal('dir', getftype('C:\Users\All Users'))
+     endif
+   endif
+ endfunc
*** ../vim-7.4.1974/src/undo.c  2016-03-15 17:43:51.633786581 +0100
--- src/undo.c  2016-07-01 17:02:50.882814572 +0200
***************
*** 778,784 ****
      char_u    *undo_file_name = NULL;
      int               dir_len;
      char_u    *p;
!     struct stat st;
      char_u    *ffname = buf_ffname;
  #ifdef HAVE_READLINK
      char_u    fname_buf[MAXPATHL];
--- 778,784 ----
      char_u    *undo_file_name = NULL;
      int               dir_len;
      char_u    *p;
!     stat_T    st;
      char_u    *ffname = buf_ffname;
  #ifdef HAVE_READLINK
      char_u    fname_buf[MAXPATHL];
***************
*** 1522,1529 ****
      int               write_ok = FALSE;
  #ifdef UNIX
      int               st_old_valid = FALSE;
!     struct stat       st_old;
!     struct stat       st_new;
  #endif
      bufinfo_T bi;
  
--- 1522,1529 ----
      int               write_ok = FALSE;
  #ifdef UNIX
      int               st_old_valid = FALSE;
!     stat_T    st_old;
!     stat_T    st_new;
  #endif
      bufinfo_T bi;
  
***************
*** 1804,1811 ****
      int               *uhp_table_used;
  #endif
  #ifdef UNIX
!     struct stat       st_orig;
!     struct stat       st_undo;
  #endif
      bufinfo_T bi;
  
--- 1804,1811 ----
      int               *uhp_table_used;
  #endif
  #ifdef UNIX
!     stat_T    st_orig;
!     stat_T    st_undo;
  #endif
      bufinfo_T bi;
  
*** ../vim-7.4.1974/src/vim.h   2016-06-26 16:44:19.519620863 +0200
--- src/vim.h   2016-07-01 17:02:50.886814514 +0200
***************
*** 396,401 ****
--- 396,431 ----
  #endif
  
  /*
+  * We use 64-bit file functions here, if available.  E.g. ftello() returns
+  * off_t instead of long, which helps if long is 32 bit and off_t is 64 bit.
+  * We assume that when fseeko() is available then ftello() is too.
+  * Note that Windows has different function names.
+  */
+ #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
+ typedef __int64 off_T;
+ # ifdef __MINGW32__
+ #  define vim_lseek lseek64
+ #  define vim_fseek fseeko64
+ #  define vim_ftell ftello64
+ # else
+ #  define vim_lseek _lseeki64
+ #  define vim_fseek _fseeki64
+ #  define vim_ftell _ftelli64
+ # endif
+ #else
+ typedef off_t off_T;
+ # ifdef HAVE_FSEEKO
+ #  define vim_lseek lseek
+ #  define vim_ftell ftello
+ #  define vim_fseek fseeko
+ # else
+ #  define vim_lseek lseek
+ #  define vim_ftell ftell
+ #  define vim_fseek(a, b, c)  fseek(a, (long)b, c)
+ # endif
+ #endif
+ 
+ /*
   * The characters and attributes cached for the screen.
   */
  typedef char_u schar_T;
***************
*** 2018,2023 ****
--- 2048,2061 ----
  # define stat(a,b) (access(a,0) ? -1 : stat(a,b))
  #endif
  
+ /* Use 64-bit stat structure if available. */
+ #if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
+ # define HAVE_STAT64
+ typedef struct _stat64 stat_T;
+ #else
+ typedef struct stat stat_T;
+ #endif
+ 
  #include "ex_cmds.h"      /* Ex command defines */
  #include "proto.h"        /* function prototypes */
  
*** ../vim-7.4.1974/src/version.c       2016-07-01 15:48:00.336721784 +0200
--- src/version.c       2016-07-01 17:15:15.603984673 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     1975,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
172. You join listservers just for the extra e-mail.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui