diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-01 17:17:39 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-01 17:17:39 +0200 |
commit | 8767f52fbfd4f053ce00a978227c95f1d7d323fe (patch) | |
tree | ac0cb33815d6e9d41f9b7a6b4ee4335e6076feaa | |
parent | 4a6c670b844a3ef9aec865a8216eaf363bab8721 (diff) |
patch 7.4.1975v7.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)
-rw-r--r-- | src/Makefile | 3 | ||||
-rw-r--r-- | src/buffer.c | 24 | ||||
-rw-r--r-- | src/diff.c | 2 | ||||
-rw-r--r-- | src/eval.c | 10 | ||||
-rw-r--r-- | src/ex_cmds.c | 6 | ||||
-rw-r--r-- | src/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/fileio.c | 53 | ||||
-rw-r--r-- | src/gui.c | 2 | ||||
-rw-r--r-- | src/gui_at_fs.c | 16 | ||||
-rw-r--r-- | src/if_cscope.c | 14 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/memfile.c | 22 | ||||
-rw-r--r-- | src/memline.c | 30 | ||||
-rw-r--r-- | src/misc1.c | 10 | ||||
-rw-r--r-- | src/misc2.c | 2 | ||||
-rw-r--r-- | src/netbeans.c | 10 | ||||
-rw-r--r-- | src/os_mswin.c | 26 | ||||
-rw-r--r-- | src/os_win32.c | 2 | ||||
-rw-r--r-- | src/proto/fileio.pro | 4 | ||||
-rw-r--r-- | src/proto/memline.pro | 4 | ||||
-rw-r--r-- | src/proto/os_mswin.pro | 2 | ||||
-rw-r--r-- | src/pty.c | 2 | ||||
-rw-r--r-- | src/quickfix.c | 2 | ||||
-rw-r--r-- | src/spell.c | 2 | ||||
-rw-r--r-- | src/structs.h | 2 | ||||
-rw-r--r-- | src/tag.c | 63 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 1 | ||||
-rw-r--r-- | src/testdir/test_largefile.vim | 30 | ||||
-rw-r--r-- | src/testdir/test_stat.vim | 64 | ||||
-rw-r--r-- | src/undo.c | 10 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 38 |
32 files changed, 299 insertions, 163 deletions
diff --git a/src/Makefile b/src/Makefile index 3577cc2de9..668f90080a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2034,7 +2034,9 @@ test_arglist \ test_increment_dbcs \ test_join \ test_json \ + test_jumps \ test_langmap \ + test_largefile \ test_lispwords \ test_man \ test_matchadd_conceal \ @@ -2054,6 +2056,7 @@ test_arglist \ test_searchpos \ test_set \ test_sort \ + test_stat \ test_statusline \ test_syn_attr \ test_syntax \ diff --git a/src/buffer.c b/src/buffer.c index ee28bc9bec..39a5bcb4d1 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -35,9 +35,9 @@ static char_u *fname_match(regmatch_T *rmp, char_u *name, int ignore_case); 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 @@ -1663,7 +1663,7 @@ buflist_new( { buf_T *buf; #ifdef UNIX - struct stat st; + stat_T st; #endif fname_expand(curbuf, &ffname, &sfname); /* will allocate ffname */ @@ -2183,7 +2183,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; @@ -2198,7 +2198,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; @@ -2847,7 +2847,7 @@ setfname( { buf_T *obuf = NULL; #ifdef UNIX - struct stat st; + stat_T st; #endif if (ffname == NULL || *ffname == NUL) @@ -3084,7 +3084,7 @@ otherfile_buf( buf_T *buf, char_u *ffname #ifdef UNIX - , struct stat *stp + , stat_T *stp #endif ) { @@ -3095,9 +3095,9 @@ otherfile_buf( return FALSE; #ifdef UNIX { - struct stat st; + stat_T st; - /* If no struct stat given, get it now */ + /* If no stat_T given, get it now */ if (stp == NULL) { if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0) @@ -3132,7 +3132,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) { @@ -3150,7 +3150,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 index 92e1a054e7..5e17943ec5 100644 --- 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 index 27c58cc5c7..59a767a0c3 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12980,7 +12980,7 @@ f_getfontname(typval_T *argvars UNUSED, typval_T *rettv) 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; @@ -13010,7 +13010,7 @@ f_getfperm(typval_T *argvars, typval_T *rettv) f_getfsize(typval_T *argvars, typval_T *rettv) { char_u *fname; - struct stat st; + stat_T st; fname = get_tv_string(&argvars[0]); @@ -13025,7 +13025,7 @@ f_getfsize(typval_T *argvars, typval_T *rettv) 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) + if ((off_T)rettv->vval.v_number != (off_T)st.st_size) rettv->vval.v_number = -2; } } @@ -13040,7 +13040,7 @@ f_getfsize(typval_T *argvars, typval_T *rettv) f_getftime(typval_T *argvars, typval_T *rettv) { char_u *fname; - struct stat st; + stat_T st; fname = get_tv_string(&argvars[0]); @@ -13057,7 +13057,7 @@ f_getftime(typval_T *argvars, typval_T *rettv) 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 index 36d7bd1959..088e1ac135 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1840,14 +1840,14 @@ write_viminfo(char_u *file, int 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; @@ -3457,7 +3457,7 @@ not_writing(void) static int check_readonly(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 index e255a13d71..07458edc0a 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3685,7 +3685,7 @@ do_source( 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 index 1ceeaa735a..1304190329 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -41,7 +41,7 @@ static char_u *readfile_charconvert(char_u *fname, char_u *fenc, int *fdp); 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); +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,7 +49,7 @@ static void set_file_time(char_u *fname, time_t atime, time_t mtime); 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); @@ -245,7 +245,7 @@ readfile( colnr_T len; long size = 0; char_u *p; - off_t filesize = 0; + off_T filesize = 0; int skip_read = FALSE; #ifdef FEAT_CRYPT char_u *cryptkey = NULL; @@ -269,7 +269,7 @@ readfile( #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; @@ -885,7 +885,7 @@ readfile( /* 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); + vim_lseek(fd, (off_T)0L, SEEK_SET); for (p = firstline; p < firstline + len; ++p) if (*p >= 0x80) { @@ -949,7 +949,7 @@ retry: read_buf_lnum = 1; read_buf_col = 0; } - else if (read_stdin || lseek(fd, (off_t)0L, SEEK_SET) != 0) + else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) { /* Can't rewind the file, give up. */ error = TRUE; @@ -2253,7 +2253,8 @@ rewind_retry: if ( try_unix && !read_stdin && (read_buffer - || lseek(fd, (off_t)0L, SEEK_SET) == 0)) + || vim_lseek(fd, (off_T)0L, SEEK_SET) + == 0)) { fileformat = EOL_UNIX; if (set_options) @@ -2958,7 +2959,7 @@ check_for_cryptkey( 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 */ + 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,7 +3146,7 @@ buf_write( 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')"; @@ -3674,7 +3675,7 @@ buf_write( 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" */ @@ -3813,7 +3814,7 @@ buf_write( 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) @@ -4343,7 +4344,7 @@ buf_write( 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) @@ -4376,7 +4377,7 @@ buf_write( restore_backup: { - struct stat st; + stat_T st; /* * If we failed to open the file, we don't need a backup. Throw it @@ -4673,7 +4674,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 +4930,7 @@ restore_backup: if (backup != NULL) { - struct stat st; + stat_T st; /* * If the original file does not exist yet @@ -5221,7 +5222,7 @@ msg_add_fileformat(int eol_type) msg_add_lines( int insert_space, long lnum, - off_t nchars) + off_T nchars) { char_u *p; @@ -5233,6 +5234,9 @@ msg_add_lines( #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,6 +5255,9 @@ msg_add_lines( #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,7 +5281,7 @@ msg_add_eol(void) * using the same timestamp but can't set the size. */ static int -check_mtime(buf_T *buf, struct stat *st) +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,7 +6448,7 @@ vim_rename(char_u *from, char_u *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 */ @@ -6469,7 +6476,7 @@ vim_rename(char_u *from, char_u *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 @@ -6768,7 +6775,7 @@ buf_check_timestamp( 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; @@ -6780,7 +6787,7 @@ buf_check_timestamp( #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) int can_reload = FALSE; #endif - off_t orig_size = buf->b_orig_size; + 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,7 +7216,7 @@ buf_reload(buf_T *buf, int orig_mode) } void -buf_store_time(buf_T *buf, struct stat *st, char_u *fname UNUSED) +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,7 +7356,7 @@ vim_tempname( static char *(tempdirs[]) = {TEMPDIRNAMES}; int i; # ifndef EEXIST - struct stat st; + stat_T st; # endif /* @@ -571,7 +571,7 @@ gui_init(void) { #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 index 0606fba9b3..e89e853ca8 100644 --- a/src/gui_at_fs.c +++ b/src/gui_at_fs.c @@ -183,7 +183,7 @@ static void SFclearList(int n, int doScroll); 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); @@ -873,7 +873,7 @@ static int SFcheckDir(int n, SFDir *dir); static int SFcheckDir(int n, SFDir *dir) { - struct stat statBuf; + stat_T statBuf; int i; if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime)) @@ -943,7 +943,7 @@ SFcheckFiles(SFDir *dir) int i; char *str; int last; - struct stat statBuf; + stat_T statBuf; result = 0; @@ -1017,7 +1017,7 @@ SFdirModTimer(XtPointer cl UNUSED, XtIntervalId *id UNUSED) /* Return a single character describing what kind of file STATBUF is. */ static char -SFstatChar(struct stat *statBuf) +SFstatChar(stat_T *statBuf) { if (S_ISDIR (statBuf->st_mode)) return '/'; @@ -1313,13 +1313,13 @@ SFdeleteEntry(SFDir *dir, SFEntry *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( char *name, int last, - struct stat *statBuf) + stat_T *statBuf) { name[last] = SFstatChar(statBuf); } @@ -1329,7 +1329,7 @@ static int SFstatAndCheck(SFDir *dir, SFEntry *entry); static int SFstatAndCheck(SFDir *dir, SFEntry *entry) { - struct stat statBuf; + stat_T statBuf; char save; int last; @@ -2059,7 +2059,7 @@ SFgetDir( 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 index c3b36bca0d..a782f38d54 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -42,7 +42,7 @@ static int cs_find_common(char *opt, char *pat, int, int, int, char_u *cmdli 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); @@ -520,7 +520,7 @@ cs_add_common( char *arg2, /* prepend path - may contain environment variables */ char *flags) { - struct stat statbuf; + stat_T statbuf; int ret; char *fname = NULL; char *fname2 = NULL; @@ -547,7 +547,7 @@ cs_add_common( 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: @@ -559,13 +559,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; } @@ -592,7 +592,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) @@ -1421,7 +1421,7 @@ cs_insert_filelist( 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 index 958e9c8fc6..989c78efe6 100644 --- a/src/main.c +++ b/src/main.c @@ -3186,7 +3186,7 @@ process_env( static int file_owned(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 index f6fda8d34c..6b1a341e22 100644 --- a/src/memfile.c +++ b/src/memfile.c @@ -81,7 +81,7 @@ static void mf_ins_free(memfile_T *, bhdr_T *); 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_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,7 +124,7 @@ static int mf_hash_grow(mf_hashtab_T *); mf_open(char_u *fname, int flags) { memfile_T *mfp; - off_t size; + off_T size; #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix) # define USE_FSTATFS struct STATFS stf; @@ -179,7 +179,7 @@ mf_open(char_u *fname, int flags) #endif if (mfp->mf_fd < 0 || (flags & (O_TRUNC|O_EXCL)) - || (size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0) + || (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,7 +966,7 @@ mf_rem_free(memfile_T *mfp) static int mf_read(memfile_T *mfp, bhdr_T *hp) { - off_t offset; + off_T offset; unsigned page_size; unsigned size; @@ -974,9 +974,9 @@ mf_read(memfile_T *mfp, bhdr_T *hp) return FAIL; page_size = mfp->mf_page_size; - offset = (off_t)page_size * hp->bh_bnum; + offset = (off_T)page_size * hp->bh_bnum; size = page_size * hp->bh_page_count; - if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset) + if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) { PERROR(_("E294: Seek error in swap file read")); return FAIL; @@ -1005,7 +1005,7 @@ mf_read(memfile_T *mfp, bhdr_T *hp) static int mf_write(memfile_T *mfp, bhdr_T *hp) { - off_t offset; /* offset in the file */ + 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,8 +1038,8 @@ mf_write(memfile_T *mfp, bhdr_T *hp) else hp2 = hp; - offset = (off_t)page_size * nr; - if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset) + 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,7 +1083,7 @@ mf_write(memfile_T *mfp, bhdr_T *hp) mf_write_block( memfile_T *mfp, bhdr_T *hp, - off_t offset UNUSED, + off_T offset UNUSED, unsigned size) { char_u *data = hp->bh_data; @@ -1247,7 +1247,7 @@ mf_do_open( 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 index 2dd465ae71..bf1e91e4fc 100644 --- a/src/memline.c +++ b/src/memline.c @@ -266,7 +266,7 @@ static long char_to_long(char_u *); 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); +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,7 +973,7 @@ ml_upd_block0(buf_T *buf, upd_block0_T what) static void set_b0_fname(ZERO_BL *b0p, buf_T *buf) { - struct stat st; + stat_T st; if (buf->b_ffname == NULL) b0p->b0_fname[0] = NUL; @@ -1114,7 +1114,7 @@ ml_recover(void) 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; @@ -1127,7 +1127,7 @@ ml_recover(void) int idx; int top; int txt_start; - off_t size; + off_T size; int called_from_main; int serious_error = TRUE; long mtime; @@ -1323,7 +1323,7 @@ ml_recover(void) msg_end(); goto theend; } - if ((size = lseek(mfp->mf_fd, (off_t)0L, SEEK_END)) <= 0) + 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,7 +1908,7 @@ recover_names( */ if (*dirp == NUL && file_count + num_files == 0 && fname != NULL) { - struct stat st; + stat_T st; char_u *swapname; swapname = modname(fname_res, @@ -2049,7 +2049,7 @@ static int process_still_running; static time_t swapfile_info(char_u *fname) { - struct stat st; + stat_T st; int fd; struct block0 b0; time_t x = (time_t)0; @@ -2262,7 +2262,7 @@ end: ml_sync_all(int check_file, int check_char) { buf_T *buf; - struct stat st; + stat_T st; for (buf = firstbuf; buf != NULL; buf = buf->b_next) { @@ -4029,7 +4029,7 @@ attention_message( buf_T *buf, /* buffer being edited */ char_u *fname) /* swap file name */ { - struct stat st; + stat_T st; time_t x, sx; char *p; @@ -4207,7 +4207,7 @@ findswapname( { 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; @@ -4296,7 +4296,7 @@ findswapname( 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 @@ -4663,7 +4663,7 @@ fnamecmp_ino( 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 */ @@ -4780,7 +4780,7 @@ ml_setflags(buf_T *buf) ml_encrypt_data( memfile_T *mfp, char_u *data, - off_t offset, + off_T offset, unsigned size) { DATA_BL *dp = (DATA_BL *)data; @@ -4825,7 +4825,7 @@ ml_encrypt_data( ml_decrypt_data( memfile_T *mfp, char_u *data, - off_t offset, + off_T offset, unsigned size) { DATA_BL *dp = (DATA_BL *)data; @@ -4859,7 +4859,7 @@ ml_decrypt_data( * Return an allocated cryptstate_T *. */ static cryptstate_T * -ml_crypt_prepare(memfile_T *mfp, off_t offset, int reading) +ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading) { buf_T *buf = mfp->mf_buffer; char_u salt[50]; diff --git a/src/misc1.c b/src/misc1.c index 7969968938..82522b5cfb 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -4056,7 +4056,7 @@ expand_env_esc( { 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; @@ -4752,7 +4752,7 @@ fullpathcmp( 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); @@ -9500,7 +9500,7 @@ preserve_exit(void) < |