jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone
3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.013
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.013
3ef2ca
Problem:    File name buffer too small for utf-8.
3ef2ca
Solution:   Use character count instead of byte count. (Ken Takata)
3ef2ca
Files:	    src/os_mswin.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.012/src/os_mswin.c	2013-08-30 16:44:15.000000000 +0200
3ef2ca
--- src/os_mswin.c	2013-08-30 16:47:54.000000000 +0200
3ef2ca
***************
3ef2ca
*** 456,462 ****
3ef2ca
--- 456,469 ----
3ef2ca
      int
3ef2ca
  mch_isFullName(char_u *fname)
3ef2ca
  {
3ef2ca
+ #ifdef FEAT_MBYTE
3ef2ca
+     /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
3ef2ca
+      * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
3ef2ca
+      * UTF-8. */
3ef2ca
+     char szName[_MAX_PATH * 3 + 1];
3ef2ca
+ #else
3ef2ca
      char szName[_MAX_PATH + 1];
3ef2ca
+ #endif
3ef2ca
  
3ef2ca
      /* A name like "d:/foo" and "//server/share" is absolute */
3ef2ca
      if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
3ef2ca
***************
3ef2ca
*** 464,470 ****
3ef2ca
  	return TRUE;
3ef2ca
  
3ef2ca
      /* A name that can't be made absolute probably isn't absolute. */
3ef2ca
!     if (mch_FullName(fname, szName, _MAX_PATH, FALSE) == FAIL)
3ef2ca
  	return FALSE;
3ef2ca
  
3ef2ca
      return pathcmp(fname, szName, -1) == 0;
3ef2ca
--- 471,477 ----
3ef2ca
  	return TRUE;
3ef2ca
  
3ef2ca
      /* A name that can't be made absolute probably isn't absolute. */
3ef2ca
!     if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL)
3ef2ca
  	return FALSE;
3ef2ca
  
3ef2ca
      return pathcmp(fname, szName, -1) == 0;
3ef2ca
***************
3ef2ca
*** 498,507 ****
3ef2ca
      int
3ef2ca
  vim_stat(const char *name, struct stat *stp)
3ef2ca
  {
3ef2ca
      char	buf[_MAX_PATH + 1];
3ef2ca
      char	*p;
3ef2ca
  
3ef2ca
!     vim_strncpy((char_u *)buf, (char_u *)name, _MAX_PATH);
3ef2ca
      p = buf + strlen(buf);
3ef2ca
      if (p > buf)
3ef2ca
  	mb_ptr_back(buf, p);
3ef2ca
--- 505,521 ----
3ef2ca
      int
3ef2ca
  vim_stat(const char *name, struct stat *stp)
3ef2ca
  {
3ef2ca
+ #ifdef FEAT_MBYTE
3ef2ca
+     /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
3ef2ca
+      * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
3ef2ca
+      * UTF-8. */
3ef2ca
+     char	buf[_MAX_PATH * 3 + 1];
3ef2ca
+ #else
3ef2ca
      char	buf[_MAX_PATH + 1];
3ef2ca
+ #endif
3ef2ca
      char	*p;
3ef2ca
  
3ef2ca
!     vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
3ef2ca
      p = buf + strlen(buf);
3ef2ca
      if (p > buf)
3ef2ca
  	mb_ptr_back(buf, p);
3ef2ca
*** ../vim-7.4.012/src/version.c	2013-08-30 16:44:15.000000000 +0200
3ef2ca
--- src/version.c	2013-08-30 16:47:36.000000000 +0200
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     13,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
hundred-and-one symptoms of being an internet addict:
3ef2ca
143. You dream in pallettes of 216 websafe colors.
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///