Blame SOURCES/7.4.505

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.505
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.505
22c937
Problem:    On MS-Windows when 'encoding' is a double-byte encoding a file
22c937
	    name longer than MAX_PATH bytes but shorter than that in
22c937
	    characters causes problems.
22c937
Solution:   Fail on file names longer than MAX_PATH bytes. (Ken Takata)
22c937
Files:	    src/os_win32.c
22c937
22c937
22c937
*** ../vim-7.4.504/src/os_win32.c	2014-10-16 16:16:33.970230873 +0200
22c937
--- src/os_win32.c	2014-11-05 18:32:54.624402126 +0100
22c937
***************
22c937
*** 6139,6144 ****
22c937
--- 6139,6151 ----
22c937
      }
22c937
  # endif
22c937
  
22c937
+     /* open() can open a file which name is longer than _MAX_PATH bytes
22c937
+      * and shorter than _MAX_PATH characters successfully, but sometimes it
22c937
+      * causes unexpected error in another part. We make it an error explicitly
22c937
+      * here. */
22c937
+     if (strlen(name) >= _MAX_PATH)
22c937
+ 	return -1;
22c937
+ 
22c937
      return open(name, flags, mode);
22c937
  }
22c937
  
22c937
***************
22c937
*** 6188,6193 ****
22c937
--- 6195,6207 ----
22c937
  	 * the _wfopen() fails for missing wide functions. */
22c937
      }
22c937
  
22c937
+     /* fopen() can open a file which name is longer than _MAX_PATH bytes
22c937
+      * and shorter than _MAX_PATH characters successfully, but sometimes it
22c937
+      * causes unexpected error in another part. We make it an error explicitly
22c937
+      * here. */
22c937
+     if (strlen(name) >= _MAX_PATH)
22c937
+ 	return NULL;
22c937
+ 
22c937
      return fopen(name, mode);
22c937
  }
22c937
  #endif
22c937
*** ../vim-7.4.504/src/version.c	2014-11-05 18:18:13.156423366 +0100
22c937
--- src/version.c	2014-11-05 18:33:06.684401835 +0100
22c937
***************
22c937
*** 743,744 ****
22c937
--- 743,746 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     505,
22c937
  /**/
22c937
22c937
-- 
22c937
5 out of 4 people have trouble with fractions.
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///