summaryrefslogtreecommitdiff
path: root/src/vim.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-07-01 17:17:39 +0200
committerBram Moolenaar <Bram@vim.org>2016-07-01 17:17:39 +0200
commit8767f52fbfd4f053ce00a978227c95f1d7d323fe (patch)
treeac0cb33815d6e9d41f9b7a6b4ee4335e6076feaa /src/vim.h
parent4a6c670b844a3ef9aec865a8216eaf363bab8721 (diff)
downloadvim-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/vim.h')
-rw-r--r--src/vim.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/vim.h b/src/vim.h
index 88a28d431..7d76504bb 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -396,6 +396,36 @@ typedef long __w64 long_i;
#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,6 +2048,14 @@ typedef int VimClipboard; /* This is required for the prototypes. */
# 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 */