]> granicus.if.org Git - vim/commitdiff
patch 8.1.0953: a very long file is truncated at 2^31 lines v8.1.0953
authorBram Moolenaar <Bram@vim.org>
Tue, 19 Feb 2019 20:24:54 +0000 (21:24 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 19 Feb 2019 20:24:54 +0000 (21:24 +0100)
Problem:    A very long file is truncated at 2^31 lines.
Solution:   Use LONG_MAX for MAXLNUM. (Dominique Pelle, closes #4011)

src/version.c
src/vim.h

index 16ab493919613cf6db78ec4879be2994d86d4642..a266ce08f4a62e1c7fcb59c7c62a9aceb0e8c519 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    953,
 /**/
     952,
 /**/
index 0bc6ad3ee6386166e878f862e30906e311d2e6f8..fbae72d8dbb74e5c2f09562d7f4d5f56ff0ee1ab 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -54,6 +54,9 @@
     Error: configure did not run properly.  Check auto/config.log.
 # endif
 
+// for INT_MAX, LONG_MAX et al.
+#include <limits.h>
+
 /*
  * Cygwin may have fchdir() in a newer release, but in most versions it
  * doesn't work well and avoiding it keeps the binary backward compatible.
@@ -455,9 +458,6 @@ typedef unsigned int u8char_T;      // int is 32 bits or more
 # include <errno.h>
 #endif
 
-/* for INT_MAX et al. */
-#include <limits.h>
-
 /*
  * Allow other (non-unix) systems to configure themselves now
  * These are also in os_unix.h, because osdef.sh needs them there.
@@ -1666,17 +1666,17 @@ typedef unsigned short disptick_T;      /* display tick type */
  * not a real problem. BTW:  Longer lines are split.
  */
 #ifdef __MVS__
-# define MAXCOL (0x3fffffffL)          /* maximum column number, 30 bits */
-# define MAXLNUM (0x3fffffffL)         /* maximum (invalid) line number */
+# define MAXCOL (0x3fffffffL)          // maximum column number, 30 bits
+# define MAXLNUM (0x3fffffffL)         // maximum (invalid) line number
 #else
-# define MAXCOL (0x7fffffffL)          /* maximum column number, 31 bits */
-# define MAXLNUM (0x7fffffffL)         /* maximum (invalid) line number */
+# define MAXCOL  INT_MAX               // maximum column number
+# define MAXLNUM LONG_MAX              // maximum (invalid) line number
 #endif
 
-#define SHOWCMD_COLS 10                        /* columns needed by shown command */
-#define STL_MAX_ITEM 80                        /* max nr of %<flag> in statusline */
+#define SHOWCMD_COLS 10                        // columns needed by shown command
+#define STL_MAX_ITEM 80                        // max nr of %<flag> in statusline
 
-typedef void       *vim_acl_T;         /* dummy to pass an ACL to a function */
+typedef void       *vim_acl_T;         // dummy to pass an ACL to a function
 
 #ifndef mch_memmove
 # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (size_t)(len))