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 /src/memfile.c | |
parent | 4a6c670b844a3ef9aec865a8216eaf363bab8721 (diff) | |
download | vim-git-8767f52fbfd4f053ce00a978227c95f1d7d323fe.tar.gz |
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)
Diffstat (limited to 'src/memfile.c')
-rw-r--r-- | src/memfile.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/memfile.c b/src/memfile.c index f6fda8d34..6b1a341e2 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; |