aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/file_search.c15
-rw-r--r--src/nvim/path.c13
-rw-r--r--src/nvim/version.c2
3 files changed, 18 insertions, 12 deletions
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index b213a42c52..8c4a2f8275 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -1057,7 +1057,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
*/
static int ff_wc_equal(char_u *s1, char_u *s2)
{
- int i;
+ int i, j;
int prev1 = NUL;
int prev2 = NUL;
@@ -1067,18 +1067,19 @@ static int ff_wc_equal(char_u *s1, char_u *s2)
if (s1 == NULL || s2 == NULL)
return FALSE;
- if (STRLEN(s1) != STRLEN(s2))
- return FAIL;
-
- for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i)) {
+ for (i = 0, j = 0; s1[i] != NUL;) {
int c1 = PTR2CHAR(s1 + i);
- int c2 = PTR2CHAR(s2 + i);
+ int c2 = PTR2CHAR(s2 + j);
if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2)
- && (prev1 != '*' || prev2 != '*'))
+ && (prev1 != '*' || prev2 != '*')) {
return FAIL;
+ }
prev2 = prev1;
prev1 = c1;
+
+ i += MB_PTR2LEN(s1 + i);
+ j += MB_PTR2LEN(s2 + j);
}
return TRUE;
}
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 8b9a49dfc0..e0e5f19911 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1775,19 +1775,20 @@ bool same_directory(char_u *f1, char_u *f2)
*/
int pathcmp(const char *p, const char *q, int maxlen)
{
- int i;
+ int i, j;
int c1, c2;
const char *s = NULL;
- for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i)) {
+ for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);) {
c1 = PTR2CHAR((char_u *)p + i);
- c2 = PTR2CHAR((char_u *)q + i);
+ c2 = PTR2CHAR((char_u *)q + j);
/* End of "p": check if "q" also ends or just has a slash. */
if (c1 == NUL) {
if (c2 == NUL) /* full match */
return 0;
s = q;
+ i = j;
break;
}
@@ -1811,9 +1812,13 @@ int pathcmp(const char *p, const char *q, int maxlen)
return p_fic ? vim_toupper(c1) - vim_toupper(c2)
: c1 - c2; /* no match */
}
+
+ i += MB_PTR2LEN((char_u *)p + i);
+ j += MB_PTR2LEN((char_u *)q + j);
}
- if (s == NULL) /* "i" ran into "maxlen" */
+ if (s == NULL) { // "i" or "j" ran into "maxlen"
return 0;
+ }
c1 = PTR2CHAR((char_u *)s + i);
c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i));
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 487f3fc27b..0c36996854 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -453,7 +453,7 @@ static int included_patches[] = {
// 838,
// 837 NA
836,
- // 835,
+ 835,
834,
// 833,
// 832,