|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.013
|
|
|
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.013
|
|
|
22c937 |
Problem: File name buffer too small for utf-8.
|
|
|
22c937 |
Solution: Use character count instead of byte count. (Ken Takata)
|
|
|
22c937 |
Files: src/os_mswin.c
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.012/src/os_mswin.c 2013-08-30 16:44:15.000000000 +0200
|
|
|
22c937 |
--- src/os_mswin.c 2013-08-30 16:47:54.000000000 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 456,462 ****
|
|
|
22c937 |
--- 456,469 ----
|
|
|
22c937 |
int
|
|
|
22c937 |
mch_isFullName(char_u *fname)
|
|
|
22c937 |
{
|
|
|
22c937 |
+ #ifdef FEAT_MBYTE
|
|
|
22c937 |
+ /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
|
|
22c937 |
+ * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
|
|
22c937 |
+ * UTF-8. */
|
|
|
22c937 |
+ char szName[_MAX_PATH * 3 + 1];
|
|
|
22c937 |
+ #else
|
|
|
22c937 |
char szName[_MAX_PATH + 1];
|
|
|
22c937 |
+ #endif
|
|
|
22c937 |
|
|
|
22c937 |
/* A name like "d:/foo" and "//server/share" is absolute */
|
|
|
22c937 |
if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 464,470 ****
|
|
|
22c937 |
return TRUE;
|
|
|
22c937 |
|
|
|
22c937 |
/* A name that can't be made absolute probably isn't absolute. */
|
|
|
22c937 |
! if (mch_FullName(fname, szName, _MAX_PATH, FALSE) == FAIL)
|
|
|
22c937 |
return FALSE;
|
|
|
22c937 |
|
|
|
22c937 |
return pathcmp(fname, szName, -1) == 0;
|
|
|
22c937 |
--- 471,477 ----
|
|
|
22c937 |
return TRUE;
|
|
|
22c937 |
|
|
|
22c937 |
/* A name that can't be made absolute probably isn't absolute. */
|
|
|
22c937 |
! if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL)
|
|
|
22c937 |
return FALSE;
|
|
|
22c937 |
|
|
|
22c937 |
return pathcmp(fname, szName, -1) == 0;
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 498,507 ****
|
|
|
22c937 |
int
|
|
|
22c937 |
vim_stat(const char *name, struct stat *stp)
|
|
|
22c937 |
{
|
|
|
22c937 |
char buf[_MAX_PATH + 1];
|
|
|
22c937 |
char *p;
|
|
|
22c937 |
|
|
|
22c937 |
! vim_strncpy((char_u *)buf, (char_u *)name, _MAX_PATH);
|
|
|
22c937 |
p = buf + strlen(buf);
|
|
|
22c937 |
if (p > buf)
|
|
|
22c937 |
mb_ptr_back(buf, p);
|
|
|
22c937 |
--- 505,521 ----
|
|
|
22c937 |
int
|
|
|
22c937 |
vim_stat(const char *name, struct stat *stp)
|
|
|
22c937 |
{
|
|
|
22c937 |
+ #ifdef FEAT_MBYTE
|
|
|
22c937 |
+ /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
|
|
22c937 |
+ * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
|
|
22c937 |
+ * UTF-8. */
|
|
|
22c937 |
+ char buf[_MAX_PATH * 3 + 1];
|
|
|
22c937 |
+ #else
|
|
|
22c937 |
char buf[_MAX_PATH + 1];
|
|
|
22c937 |
+ #endif
|
|
|
22c937 |
char *p;
|
|
|
22c937 |
|
|
|
22c937 |
! vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
|
|
|
22c937 |
p = buf + strlen(buf);
|
|
|
22c937 |
if (p > buf)
|
|
|
22c937 |
mb_ptr_back(buf, p);
|
|
|
22c937 |
*** ../vim-7.4.012/src/version.c 2013-08-30 16:44:15.000000000 +0200
|
|
|
22c937 |
--- src/version.c 2013-08-30 16:47:36.000000000 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 740,741 ****
|
|
|
22c937 |
--- 740,743 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 13,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
143. You dream in pallettes of 216 websafe colors.
|
|
|
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 ///
|