Hi,

2016/1/30 Sat 12:51:11 UTC+9 Ken Takata wrote:
> Hi,
> 
> 2016/1/21 Thu 7:11:51 UTC+9 Bram Moolenaar wrote:
> > Ken Takata wrote:
> > 
> > > 2016/1/20 Wed 7:47:18 UTC+9 Ken Takata wrote:
> > > > Hi Bram,
> > > > 
> > > > 2016/1/20 Wed 3:33:18 UTC+9 Bram Moolenaar wrote:
> > > > > Ken Takata wrote:
> > > > > 
> > > > > > (The original thread was in vim_use:
> > > > > > https://groups.google.com/d/topic/vim_use/RLM8Vqa_aME/discussion )
> > > > > > 
> > > > > > I have updated the patches for supporting large files on Windows.
> > > > > > I also converted the test to the new style.  And I also added a new 
> > > > > > test for
> > > > > > large files: test_largefile.vim.  This creates a 4GB file, moving 
> > > > > > around it,
> > > > > > and write it to disk.  This uses over 8GB disk spaces, and consumes 
> > > > > > CPU
> > > > > > powers.  So I don't add this test to src/testdir/Make_all.mak.  I 
> > > > > > confirmed
> > > > > > that when running the test without my fix, gvim.exe (32-bit) 
> > > > > > stopped with
> > > > > > "E342: Out of memory!" (takes about 10min), but it succeeded with 
> > > > > > my fix
> > > > > > (takes about 5min).
> > > > > > Please check the attached patches.
> > > > > > 
> > > > > > Note: Please apply the following patch before them to avoid 
> > > > > > conflicts.
> > > > > > https://groups.google.com/d/topic/vim_dev/JHbE4twU4dk/discussion
> > > > > 
> > > > > Thanks.  In what order do the patches need to be applied?
> > > > > Looks like the stat_T patch comes after the others?
> > > > 
> > > > Yes.
> > > > use-stat_T.patch must be applied after 
> > > > support-largefiles-on-windows.patch.
> > > > Other two are independent.
> > > > 
> > > > 
> > > > > For the test, we can add a "torture" target.
> > > > > 
> > > > > I have this old note in the todo file:
> > > > > 
> > > > > Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 
> > > > > 12)
> > > > > More tests May 14. Update May 29.  Update Aug 10.
> > > > > 
> > > > > I assume that is related to this?
> > > > 
> > > > Yes, the stat_T patch is a patch for this.
> > > > Without this patch, getfsize() returns a broken value (e.g. 
> > > > -294967296), if
> > > > the size of a file is larger than 2 GiB and smaller than 4 GiB. And if 
> > > > the
> > > > size is larger than 4 GiB, getfsize() and other stat functions return 
> > > > -1.
> > > > MSVC's 32-bit stat() always returns error if the filesize is larger 
> > > > than 4 GiB.
> > > 
> > > I wrote an additional patch to fix display of off_T value.
> > > add-stat-test.patch is updated to fix conflicts with 7.4.1142.
> > > Please apply in the following order:
> > > 
> > > 1. support-largefiles-on-windows.patch (previous mail)
> > > 2. fix-off_T-display.patch  (this mail)
> > > 3. use-stat_T.patch     (previous mail)
> > > 4. add-stat-test.patch  (this mail)
> > > 5. test_largefile.patch (previous mail)
> > 
> > Thanks!
> 
> Here are the updated large files patch for 7.4.1202.

And... this is for 7.4.1205.

Regards,
Ken Takata

-- 
-- 
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.
# HG changeset patch
# Parent a1d2cd2af94c52ff4d3e82f9241fdd5cbec88c6e
# Parent  d88b950f8082dd7bc4fde5356adf3181516af949

diff --git a/src/buffer.c b/src/buffer.c
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -35,9 +35,9 @@ static char_u	*fname_match(regmatch_T *r
 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);
+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
@@ -1650,7 +1650,7 @@ buflist_new(
 {
     buf_T	*buf;
 #ifdef UNIX
-    struct stat	st;
+    stat_T	st;
 #endif
 
     fname_expand(curbuf, &ffname, &sfname);	/* will allocate ffname */
@@ -2170,7 +2170,7 @@ buflist_findname_exp(char_u *fname)
 buflist_findname(char_u *ffname)
 {
 #ifdef UNIX
-    struct stat st;
+    stat_T	st;
 
     if (mch_stat((char *)ffname, &st) < 0)
 	st.st_dev = (dev_T)-1;
@@ -2185,7 +2185,7 @@ buflist_findname(char_u *ffname)
     static buf_T *
 buflist_findname_stat(
     char_u	*ffname,
-    struct stat	*stp)
+    stat_T	*stp)
 {
 #endif
     buf_T	*buf;
@@ -2834,7 +2834,7 @@ setfname(
 {
     buf_T	*obuf = NULL;
 #ifdef UNIX
-    struct stat st;
+    stat_T	st;
 #endif
 
     if (ffname == NULL || *ffname == NUL)
@@ -3073,7 +3073,7 @@ otherfile_buf(
     buf_T		*buf,
     char_u		*ffname
 #ifdef UNIX
-    , struct stat	*stp
+    , stat_T		*stp
 #endif
     )
 {
@@ -3084,9 +3084,9 @@ otherfile_buf(
 	return FALSE;
 #ifdef UNIX
     {
-	struct stat	st;
-
-	/* If no struct stat given, get it now */
+	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)
@@ -3121,7 +3121,7 @@ otherfile_buf(
     void
 buf_setino(buf_T *buf)
 {
-    struct stat	st;
+    stat_T	st;
 
     if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
     {
@@ -3139,7 +3139,7 @@ buf_setino(buf_T *buf)
     static int
 buf_same_ino(
     buf_T	*buf,
-    struct stat *stp)
+    stat_T	*stp)
 {
     return (buf->b_dev_valid
 	    && stp->st_dev == buf->b_dev
diff --git a/src/diff.c b/src/diff.c
--- a/src/diff.c
+++ b/src/diff.c
@@ -888,7 +888,7 @@ ex_diffpatch(exarg_T *eap)
     char_u	*browseFile = NULL;
     int		browse_flag = cmdmod.browse;
 #endif
-    struct stat st;
+    stat_T	st;
 
 #ifdef FEAT_BROWSE
     if (cmdmod.browse)
diff --git a/src/eval.c b/src/eval.c
--- a/src/eval.c
+++ b/src/eval.c
@@ -11923,7 +11923,7 @@ f_getfontname(typval_T *argvars UNUSED, 
 f_getfperm(typval_T *argvars, typval_T *rettv)
 {
     char_u	*fname;
-    struct stat st;
+    stat_T	st;
     char_u	*perm = NULL;
     char_u	flags[] = "rwx";
     int		i;
@@ -11953,7 +11953,7 @@ f_getfperm(typval_T *argvars, typval_T *
 f_getfsize(typval_T *argvars, typval_T *rettv)
 {
     char_u	*fname;
-    struct stat	st;
+    stat_T	st;
 
     fname = get_tv_string(&argvars[0]);
 
@@ -11983,7 +11983,7 @@ f_getfsize(typval_T *argvars, typval_T *
 f_getftime(typval_T *argvars, typval_T *rettv)
 {
     char_u	*fname;
-    struct stat	st;
+    stat_T	st;
 
     fname = get_tv_string(&argvars[0]);
 
@@ -12000,7 +12000,7 @@ f_getftime(typval_T *argvars, typval_T *
 f_getftype(typval_T *argvars, typval_T *rettv)
 {
     char_u	*fname;
-    struct stat st;
+    stat_T	st;
     char_u	*type = NULL;
     char	*t;
 
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1853,14 +1853,14 @@ write_viminfo(file, forceit)
     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 */
+    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 */
-    struct stat	st_old;		/* mch_stat() of existing viminfo file */
+    stat_T	st_old;		/* mch_stat() of existing viminfo file */
 #endif
 #ifdef WIN3264
     int		hidden = FALSE;
@@ -3110,7 +3110,7 @@ check_readonly(forceit, buf)
     int		*forceit;
     buf_T	*buf;
 {
-    struct stat	st;
+    stat_T	st;
 
     /* Handle a file being readonly when the 'readonly' option is set or when
      * the file exists and permissions are read-only.
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -3287,7 +3287,7 @@ do_source(fname, check_other, is_vimrc)
     int			    save_debug_break_level = debug_break_level;
     scriptitem_T	    *si = NULL;
 # ifdef UNIX
-    struct stat		    st;
+    stat_T		    st;
     int			    stat_ok;
 # endif
 #endif
diff --git a/src/fileio.c b/src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -49,7 +49,7 @@ static void set_file_time(char_u *fname,
 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 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);
@@ -257,7 +257,7 @@ readfile(fname, sfname, from, lines_to_s
 #endif
     int		fileformat = 0;		/* end-of-line format */
     int		keep_fileformat = FALSE;
-    struct stat	st;
+    stat_T	st;
     int		file_readonly;
     linenr_T	skip_count = 0;
     linenr_T	read_count = 0;
@@ -3128,7 +3128,7 @@ buf_write(buf, fname, sfname, start, end
     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;
+    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')";
@@ -3657,7 +3657,7 @@ buf_write(buf, fname, sfname, start, end
     if (!(append && *p_pm == NUL) && !filtering && perm >= 0 && dobackup)
     {
 #if defined(UNIX) || defined(WIN32)
-	struct stat st;
+	stat_T	    st;
 #endif
 
 	if ((bkc & BKC_YES) || append)	/* "yes" */
@@ -3796,7 +3796,7 @@ buf_write(buf, fname, sfname, start, end
 	    int		bfd;
 	    char_u	*copybuf, *wp;
 	    int		some_error = FALSE;
-	    struct stat	st_new;
+	    stat_T	st_new;
 	    char_u	*dirp;
 	    char_u	*rootname;
 #if defined(UNIX) && !defined(SHORT_FNAME)
@@ -4338,7 +4338,7 @@ buf_write(buf, fname, sfname, start, end
 	if (errmsg == NULL)
 	{
 #ifdef UNIX
-	    struct stat	st;
+	    stat_T	st;
 
 	    /* Don't delete the file when it's a hard or symbolic link. */
 	    if ((!newfile && st_old.st_nlink > 1)
@@ -4371,7 +4371,7 @@ buf_write(buf, fname, sfname, start, end
 
 restore_backup:
 	{
-	    struct stat st;
+	    stat_T	st;
 
 	    /*
 	     * If we failed to open the file, we don't need a backup. Throw it
@@ -4668,7 +4668,7 @@ restore_backup:
     if (backup != NULL && !backup_copy)
     {
 # ifdef HAVE_FCHOWN
-	struct stat	st;
+	stat_T	st;
 
 	/* don't change the owner when it's already OK, some systems remove
 	 * permission or ACL stuff */
@@ -4929,7 +4929,7 @@ restore_backup:
 
 	if (backup != NULL)
 	{
-	    struct stat st;
+	    stat_T	st;
 
 	    /*
 	     * If the original file does not exist yet
@@ -5285,7 +5285,7 @@ msg_add_eol()
     static int
 check_mtime(buf, st)
     buf_T		*buf;
-    struct stat		*st;
+    stat_T		*st;
 {
     if (buf->b_mtime_read != 0
 	    && time_differs((long)st->st_mtime, buf->b_mtime_read))
@@ -6487,7 +6487,7 @@ vim_rename(from, to)
 #ifdef AMIGA
     BPTR	flock;
 #endif
-    struct stat	st;
+    stat_T	st;
     long	perm;
 #ifdef HAVE_ACL
     vim_acl_T	acl;		/* ACL from original file */
@@ -6515,7 +6515,7 @@ vim_rename(from, to)
 
 #ifdef UNIX
     {
-	struct stat	st_to;
+	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
@@ -6816,7 +6816,7 @@ buf_check_timestamp(buf, focus)
     buf_T	*buf;
     int		focus UNUSED;	/* called for GUI focus event */
 {
-    struct stat	st;
+    stat_T	st;
     int		stat_res;
     int		retval = 0;
     char_u	*path;
@@ -7261,7 +7261,7 @@ buf_reload(buf, orig_mode)
     void
 buf_store_time(buf, st, fname)
     buf_T	*buf;
-    struct stat	*st;
+    stat_T	*st;
     char_u	*fname UNUSED;
 {
     buf->b_mtime = (long)st->st_mtime;
@@ -7404,7 +7404,7 @@ vim_tempname(extra_char, keep)
     static char	*(tempdirs[]) = {TEMPDIRNAMES};
     int		i;
 # ifndef EEXIST
-    struct stat	st;
+    stat_T	st;
 # endif
 
     /*
diff --git a/src/gui.c b/src/gui.c
--- a/src/gui.c
+++ b/src/gui.c
@@ -573,7 +573,7 @@ gui_init()
 	    {
 #ifdef UNIX
 		{
-		    struct stat s;
+		    stat_T s;
 
 		    /* if ".gvimrc" file is not owned by user, set 'secure'
 		     * mode */
diff --git a/src/gui_at_fs.c b/src/gui_at_fs.c
--- a/src/gui_at_fs.c
+++ b/src/gui_at_fs.c
@@ -183,7 +183,7 @@ static void SFclearList(int n, int doScr
 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 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);
@@ -889,7 +889,7 @@ SFcheckDir(n, dir)
     int		n;
     SFDir		*dir;
 {
-    struct stat	statBuf;
+    stat_T	statBuf;
     int		i;
 
     if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime))
@@ -960,7 +960,7 @@ SFcheckFiles(dir)
     int		i;
     char	*str;
     int		last;
-    struct stat	statBuf;
+    stat_T	statBuf;
 
     result = 0;
 
@@ -1037,7 +1037,7 @@ SFdirModTimer(cl, id)
 
     static char
 SFstatChar(statBuf)
-    struct stat *statBuf;
+    stat_T *statBuf;
 {
     if (S_ISDIR (statBuf->st_mode))
 	return '/';
@@ -1337,13 +1337,13 @@ SFdeleteEntry(dir, entry)
 #endif
 }
 
-static void SFwriteStatChar(char *name, int last, struct stat *statBuf);
+static void SFwriteStatChar(char *name, int last, stat_T *statBuf);
 
     static void
 SFwriteStatChar(name, last, statBuf)
     char	*name;
     int		last;
-    struct stat	*statBuf;
+    stat_T	*statBuf;
 {
     name[last] = SFstatChar(statBuf);
 }
@@ -1355,7 +1355,7 @@ SFstatAndCheck(dir, entry)
     SFDir	*dir;
     SFEntry	*entry;
 {
-    struct stat	statBuf;
+    stat_T	statBuf;
     char	save;
     int		last;
 
@@ -2119,7 +2119,7 @@ SFgetDir(dir)
     char		*str;
     int			len;
     int			maxChars;
-    struct stat		statBuf;
+    stat_T		statBuf;
 
     maxChars = strlen(dir->dir) - 1;
 
diff --git a/src/if_cscope.c b/src/if_cscope.c
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -42,7 +42,7 @@ static int	    cs_find_common(char *opt,
 static int	    cs_help(exarg_T *eap);
 static void	    clear_csinfo(int i);
 static int	    cs_insert_filelist(char *, char *, char *,
-			struct stat *);
+			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);
@@ -533,7 +533,7 @@ cs_add_common(arg1, arg2, flags)
     char *arg2;	    /* prepend path - may contain environment variables */
     char *flags;
 {
-    struct stat statbuf;
+    stat_T	statbuf;
     int		ret;
     char	*fname = NULL;
     char	*fname2 = NULL;
@@ -560,7 +560,7 @@ cs_add_common(arg1, arg2, flags)
     fname = (char *)vim_strnsave((char_u *)fname, len);
     vim_free(fbuf);
 #endif
-    ret = stat(fname, &statbuf);
+    ret = mch_stat(fname, &statbuf);
     if (ret < 0)
     {
 staterr:
@@ -572,13 +572,13 @@ staterr:
     /* get the prepend path (arg2), expand it, and try to stat it */
     if (arg2 != NULL)
     {
-	struct stat statbuf2;
+	stat_T	    statbuf2;
 
 	if ((ppath = (char *)alloc(MAXPATHL + 1)) == NULL)
 	    goto add_err;
 
 	expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL);
-	ret = stat(ppath, &statbuf2);
+	ret = mch_stat(ppath, &statbuf2);
 	if (ret < 0)
 	    goto staterr;
     }
@@ -605,7 +605,7 @@ staterr:
 	else
 	    (void)sprintf(fname2, "%s/%s", fname, CSCOPE_DBFILE);
 
-	ret = stat(fname2, &statbuf);
+	ret = mch_stat(fname2, &statbuf);
 	if (ret < 0)
 	{
 	    if (p_csverbose)
@@ -1434,7 +1434,7 @@ cs_insert_filelist(fname, ppath, flags, 
     char *fname;
     char *ppath;
     char *flags;
-    struct stat *sb UNUSED;
+    stat_T *sb UNUSED;
 {
     short	i, j;
 #ifndef UNIX
diff --git a/src/main.c b/src/main.c
--- a/src/main.c
+++ b/src/main.c
@@ -3170,7 +3170,7 @@ process_env(env, is_viminit)
 file_owned(fname)
     char	*fname;
 {
-    struct stat s;
+    stat_T	s;
 # ifdef UNIX
     uid_t	uid = getuid();
 # else	 /* VMS */
diff --git a/src/memfile.c b/src/memfile.c
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -1300,7 +1300,7 @@ mf_do_open(mfp, fname, flags)
     int		flags;		/* flags for open() */
 {
 #ifdef HAVE_LSTAT
-    struct stat sb;
+    stat_T	sb;
 #endif
 
     mfp->mf_fname = fname;
diff --git a/src/memline.c b/src/memline.c
--- a/src/memline.c
+++ b/src/memline.c
@@ -995,7 +995,7 @@ set_b0_fname(b0p, buf)
     ZERO_BL	*b0p;
     buf_T	*buf;
 {
-    struct stat	st;
+    stat_T	st;
 
     if (buf->b_ffname == NULL)
 	b0p->b0_fname[0] = NUL;
@@ -1138,7 +1138,7 @@ ml_recover()
     infoptr_T	*ip;
     blocknr_T	bnum;
     int		page_count;
-    struct stat	org_stat, swp_stat;
+    stat_T	org_stat, swp_stat;
     int		len;
     int		directly;
     linenr_T	lnum;
@@ -1932,7 +1932,7 @@ recover_names(fname, list, nr, fname_out
 	 */
 	if (*dirp == NUL && file_count + num_files == 0 && fname != NULL)
 	{
-	    struct stat	    st;
+	    stat_T	    st;
 	    char_u	    *swapname;
 
 	    swapname = modname(fname_res,
@@ -2076,7 +2076,7 @@ static int process_still_running;
 swapfile_info(fname)
     char_u	*fname;
 {
-    struct stat	    st;
+    stat_T	    st;
     int		    fd;
     struct block0   b0;
     time_t	    x = (time_t)0;
@@ -2303,7 +2303,7 @@ ml_sync_all(check_file, check_char)
     int	    check_char;
 {
     buf_T		*buf;
-    struct stat		st;
+    stat_T		st;
 
     for (buf = firstbuf; buf != NULL; buf = buf->b_next)
     {
@@ -4099,7 +4099,7 @@ attention_message(buf, fname)
     buf_T   *buf;	/* buffer being edited */
     char_u  *fname;	/* swap file name */
 {
-    struct stat st;
+    stat_T	st;
     time_t	x, sx;
     char	*p;
 
@@ -4282,7 +4282,7 @@ findswapname(buf, dirp, old_fname)
 	{
 	    char_u	    *tail;
 	    char_u	    *fname2;
-	    struct stat	    s1, s2;
+	    stat_T	    s1, s2;
 	    int		    f1, f2;
 	    int		    created1 = FALSE, created2 = FALSE;
 	    int		    same = FALSE;
@@ -4371,7 +4371,7 @@ findswapname(buf, dirp, old_fname)
 	if (mch_getperm(fname) < 0)	/* it does not exist */
 	{
 #ifdef HAVE_LSTAT
-	    struct stat sb;
+	    stat_T	sb;
 
 	    /*
 	     * Extra security check: When a swap file is a symbolic link, this
@@ -4741,7 +4741,7 @@ fnamecmp_ino(fname_c, fname_s, ino_block
     char_u	*fname_s;	    /* file name from swap file */
     long	ino_block0;
 {
-    struct stat	st;
+    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 */
diff --git a/src/misc1.c b/src/misc1.c
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -4122,7 +4122,7 @@ expand_env_esc(srcp, dst, dstlen, esc, o
 		{
 		    char_u	test[MAXPATHL], paths[MAXPATHL];
 		    char_u	*path, *next_path, *ptr;
-		    struct stat	st;
+		    stat_T	st;
 
 		    STRCPY(paths, USER_HOME);
 		    next_path = paths;
@@ -4828,7 +4828,7 @@ fullpathcmp(s1, s2, checkname)
     char_u	    exp1[MAXPATHL];
     char_u	    full1[MAXPATHL];
     char_u	    full2[MAXPATHL];
-    struct stat	    st1, st2;
+    stat_T	    st1, st2;
     int		    r1, r2;
 
     expand_env(s1, exp1, MAXPATHL);
@@ -9642,7 +9642,7 @@ preserve_exit()
 vim_fexists(fname)
     char_u  *fname;
 {
-    struct stat st;
+    stat_T st;
 
     if (mch_stat((char *)fname, &st))
 	return FALSE;
@@ -10408,7 +10408,7 @@ unix_expandpath(gap, path, wildoff, flag
 		}
 		else
 		{
-		    struct stat sb;
+		    stat_T  sb;
 
 		    /* no more wildcards, check if there is a match */
 		    /* remove backslashes for the remaining components only */
@@ -11178,7 +11178,7 @@ addfile(gap, f, flags)
 {
     char_u	*p;
     int		isdir;
-    struct stat sb;
+    stat_T	sb;
 
     /* if the file/dir/link doesn't exist, may not add it */
     if (!(flags & EW_NOTFOUND) && ((flags & EW_ALLLINKS)
diff --git a/src/misc2.c b/src/misc2.c
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -5181,7 +5181,7 @@ ff_check_visited(visited_list, fname
 {
     ff_visited_T	*vp;
 #ifdef UNIX
-    struct stat		st;
+    stat_T		st;
     int			url = FALSE;
 #endif
 
diff --git a/src/netbeans.c b/src/netbeans.c
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -253,7 +253,7 @@ getConnInfo(char *file, char **host, cha
     char_u *lp;
     char_u *nlp;
 #ifdef UNIX
-    struct stat	st;
+    stat_T	st;
 
     /*
      * For Unix only accept the file when it's not accessible by others.
@@ -1733,7 +1733,7 @@ nb_do_cmd(
 		buf->bufp->b_changed = TRUE;
 	    else
 	    {
-		struct stat	st;
+		stat_T	st;
 
 		/* Assume NetBeans stored the file.  Reset the timestamp to
 		 * avoid "file changed" warnings. */
diff --git a/src/os_mswin.c b/src/os_mswin.c
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -499,6 +499,18 @@ slash_adjust(p)
     }
 }
 
+/* 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
@@ -506,7 +518,7 @@ slash_adjust(p)
 #endif
 
     static int
-stat_symlink_aware(const char *name, struct stat *stp)
+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
@@ -545,7 +557,7 @@ stat_symlink_aware(const char *name, str
 	    int	    fd, n;
 
 	    fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
-	    n = _fstat(fd, (struct _stat*)stp);
+	    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);
@@ -558,7 +570,7 @@ stat_symlink_aware(const char *name, str
 
 #ifdef FEAT_MBYTE
     static int
-wstat_symlink_aware(const WCHAR *name, struct _stat *stp)
+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
@@ -598,7 +610,7 @@ wstat_symlink_aware(const WCHAR *name, s
 	    int	    fd;
 
 	    fd = _open_osfhandle((OPEN_OH_ARGTYPE)h, _O_RDONLY);
-	    n = _fstat(fd, stp);
+	    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);
@@ -606,7 +618,7 @@ wstat_symlink_aware(const WCHAR *name, s
 	}
     }
 # endif
-    return _wstat(name, stp);
+    return _wstat(name, (struct _stat *)stp);
 }
 #endif
 
@@ -614,7 +626,7 @@ wstat_symlink_aware(const WCHAR *name, s
  * stat() can't handle a trailing '/' or '\', remove it first.
  */
     int
-vim_stat(const char *name, struct stat *stp)
+vim_stat(const char *name, stat_T *stp)
 {
 #ifdef FEAT_MBYTE
     /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
@@ -659,7 +671,7 @@ vim_stat(const char *name, struct stat *
 
 	if (wp != NULL)
 	{
-	    n = wstat_symlink_aware(wp, (struct _stat *)stp);
+	    n = wstat_symlink_aware(wp, stp);
 	    vim_free(wp);
 	    if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
 		return n;
diff --git a/src/os_win32.c b/src/os_win32.c
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -3065,7 +3065,7 @@ mch_dirname(
     long
 mch_getperm(char_u *name)
 {
-    struct stat st;
+    stat_T	st;
     int		n;
 
     n = mch_stat(name, &st);
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -20,7 +20,7 @@ int vim_rename(char_u *from, char_u *to)
 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 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);
diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro
--- a/src/proto/os_mswin.pro
+++ b/src/proto/os_mswin.pro
@@ -9,7 +9,7 @@ int mch_can_restore_icon(void);
 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);
+int vim_stat(const char *name, stat_T *stp);
 void mch_settmode(int tmode);
 int mch_get_shellsize(void);
 void mch_set_shellsize(void);
diff --git a/src/pty.c b/src/pty.c
--- a/src/pty.c
+++ b/src/pty.c
@@ -253,7 +253,7 @@ OpenPTY(ttyn)
     char **ttyn;
 {
     int		f;
-    struct stat buf;
+    stat_T	buf;
     /* used for opening a new pty-pair: */
     static char TtyName[32];
 
diff --git a/src/quickfix.c b/src/quickfix.c
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2941,7 +2941,7 @@ get_mef_name()
     static int	start = -1;
     static int	off = 0;
 #ifdef HAVE_LSTAT
-    struct stat	sb;
+    stat_T	sb;
 #endif
 
     if (*p_mef == NUL)
diff --git a/src/spell.c b/src/spell.c
--- a/src/spell.c
+++ b/src/spell.c
@@ -9156,7 +9156,7 @@ mkspell(fcount, fnames, ascii, over_writ
     afffile_T	*(afile[8]);
     int		i;
     int		len;
-    struct stat	st;
+    stat_T	st;
     int		error = FALSE;
     spellinfo_T spin;
 
diff --git a/src/tag.c b/src/tag.c
--- a/src/tag.c
+++ b/src/tag.c
@@ -3528,7 +3528,7 @@ simplify_filename(filename)
 	    {
 		int		do_strip = FALSE;
 		char_u		saved_char;
-		struct stat	st;
+		stat_T		st;
 
 		/* Don't strip for an erroneous file name. */
 		if (!stripping_disabled)
@@ -3573,7 +3573,7 @@ simplify_filename(filename)
 #ifdef UNIX
 			if (do_strip)
 			{
-			    struct stat	new_st;
+			    stat_T	new_st;
 
 			    /* On Unix, the check for the unstripped file name
 			     * above works also for a symbolic link pointing to
diff --git a/src/undo.c b/src/undo.c
--- a/src/undo.c
+++ b/src/undo.c
@@ -783,7 +783,7 @@ u_get_undo_file_name(buf_ffname, reading
     char_u	*undo_file_name = NULL;
     int		dir_len;
     char_u	*p;
-    struct stat st;
+    stat_T	st;
     char_u	*ffname = buf_ffname;
 #ifdef HAVE_READLINK
     char_u	fname_buf[MAXPATHL];
@@ -1568,8 +1568,8 @@ u_write_undo(name, forceit, buf, hash)
     int		write_ok = FALSE;
 #ifdef UNIX
     int		st_old_valid = FALSE;
-    struct stat	st_old;
-    struct stat	st_new;
+    stat_T	st_old;
+    stat_T	st_new;
 #endif
     bufinfo_T	bi;
 
@@ -1853,8 +1853,8 @@ u_read_undo(name, hash, orig_name)
     int		*uhp_table_used;
 #endif
 #ifdef UNIX
-    struct stat	st_orig;
-    struct stat	st_undo;
+    stat_T	st_orig;
+    stat_T	st_undo;
 #endif
     bufinfo_T	bi;
 
diff --git a/src/vim.h b/src/vim.h
--- a/src/vim.h
+++ b/src/vim.h
@@ -2010,17 +2010,12 @@ typedef int sock_T;
 # endif
 #endif
 
-/* Use 64-bit stat functions if available. */
-#if ((defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)) \
-					&& !defined(IN_PERL_FILE)
-# undef stat
-# undef _stat
-# undef _wstat
-# undef _fstat
-# define stat _stat64
-# define _stat _stat64
-# define _wstat _wstat64
-# define _fstat _fstat64
+/* 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 */

Raspunde prin e-mail lui