aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/globals.h
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-16 09:24:10 -0500
committerJames McCoy <jamessan@jamessan.com>2017-06-04 22:12:13 -0400
commit953f26bace041f481e79b67b64401aa07259055c (patch)
treeaf054b1eac1ffaefa9643deca7100ecb74f89138 /src/nvim/globals.h
parent018383096c40aca83a76e1ae2a3ba8c5aac9b9af (diff)
downloadrneovim-953f26bace041f481e79b67b64401aa07259055c.tar.gz
rneovim-953f26bace041f481e79b67b64401aa07259055c.tar.bz2
rneovim-953f26bace041f481e79b67b64401aa07259055c.zip
vim-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) https://github.com/vim/vim/commit/8767f52fbfd4f053ce00a978227c95f1d7d323fe Only the off_T changes are relevant, since all the "struct stat" usage is abstracted by libuv.
Diffstat (limited to 'src/nvim/globals.h')
-rw-r--r--src/nvim/globals.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index a3657f2122..957ab6c9ce 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -97,6 +97,34 @@ typedef enum {
EXTERN long Rows INIT(= DFLT_ROWS); // nr of rows in the screen
EXTERN long Columns INIT(= DFLT_COLS); // nr of columns in the screen
+// 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.
*/