From f08d8d027fc4fb7dc8fc6d5305491c32bf863244 Mon Sep 17 00:00:00 2001 From: edyfox Date: Sun, 29 Jun 2008 23:19:19 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1090 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- src/main.c | 8 +++++++- src/mbyte.c | 19 ++++++++++++++++--- src/message.c | 2 +- src/os_unix.c | 8 +++++++- src/version.c | 4 ++++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 31c11c78..53d18487 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,9 @@ #ifdef __CYGWIN__ # ifndef WIN32 -# include /* for cygwin_conv_to_posix_path() */ +# include +# include /* for cygwin_conv_to_posix_path() and/or + * cygwin_conv_path() */ # endif # include #endif @@ -2213,7 +2215,11 @@ scripterror: { char posix_path[PATH_MAX]; +# if CYGWIN_VERSION_DLL_MAJOR >= 1007 + cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, posix_path, PATH_MAX); +# else cygwin_conv_to_posix_path(p, posix_path); +# endif vim_free(p); p = vim_strsave(posix_path); if (p == NULL) diff --git a/src/mbyte.c b/src/mbyte.c index 4e905936..d6edf201 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -1387,7 +1387,7 @@ utf_ptr2char(p) return p[0]; len = utf8len_tab[p[0]]; - if ((p[1] & 0xc0) == 0x80) + if (len > 1 && (p[1] & 0xc0) == 0x80) { if (len == 2) return ((p[0] & 0x1f) << 6) + (p[1] & 0x3f); @@ -1753,14 +1753,27 @@ utfc_ptr2len_len(p, size) #endif while (len < size) { - if (p[len] < 0x80 || !UTF_COMPOSINGLIKE(p + prevlen, p + len)) + int len_next_char; + + if (p[len] < 0x80) + break; + + /* + * Next character length should not go beyond size to ensure that + * UTF_COMPOSINGLIKE(...) does not read beyond size. + */ + len_next_char = utf_ptr2len_len(p + len, size - len); + if (len_next_char > size - len) + break; + + if (!UTF_COMPOSINGLIKE(p + prevlen, p + len)) break; /* Skip over composing char */ #ifdef FEAT_ARABIC prevlen = len; #endif - len += utf_ptr2len_len(p + len, size - len); + len += len_next_char; } return len; } diff --git a/src/message.c b/src/message.c index 66936cda..cb749da7 100644 --- a/src/message.c +++ b/src/message.c @@ -1391,7 +1391,7 @@ msg_outtrans_len_attr(msgstr, len, attr) plain_start = str + 1; msg_puts_attr(s, attr == 0 ? hl_attr(HLF_8) : attr); } - retval += ptr2cells(str); + retval += char2cells(*str); ++str; } } diff --git a/src/os_unix.c b/src/os_unix.c index ef73270d..871e2742 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -58,7 +58,9 @@ static int selinux_enabled = -1; #ifdef __CYGWIN__ # ifndef WIN32 -# include /* for cygwin_conv_to_posix_path() */ +# include +# include /* for cygwin_conv_to_posix_path() and/or + * for cygwin_conv_path() */ # endif #endif @@ -2312,7 +2314,11 @@ mch_FullName(fname, buf, len, force) /* * This helps for when "/etc/hosts" is a symlink to "c:/something/hosts". */ +# if CYGWIN_VERSION_DLL_MAJOR >= 1007 + cygwin_conv_path(CCP_WIN_A_TO_POSIX, fname, posix_fname, MAXPATHL); +# else cygwin_conv_to_posix_path(fname, posix_fname); +# endif fname = posix_fname; #endif diff --git a/src/version.c b/src/version.c index 93b79578..d44cd658 100644 --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,10 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 10, +/**/ + 9, +/**/ 8, /**/ 7, -- 2.11.4.GIT