|
Karsten Hopp |
234b35 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
234b35 |
Subject: Patch 7.4.835
|
|
Karsten Hopp |
234b35 |
Fcc: outbox
|
|
Karsten Hopp |
234b35 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
234b35 |
Mime-Version: 1.0
|
|
Karsten Hopp |
234b35 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
234b35 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
234b35 |
------------
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
Patch 7.4.835
|
|
Karsten Hopp |
234b35 |
Problem: Comparing utf-8 sequences does not handle different byte sizes
|
|
Karsten Hopp |
234b35 |
correctly.
|
|
Karsten Hopp |
234b35 |
Solution: Get the byte size of each character. (Dominique Pelle)
|
|
Karsten Hopp |
234b35 |
Files: src/misc2.c
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
*** ../vim-7.4.834/src/misc2.c 2015-07-17 13:22:43.153523709 +0200
|
|
Karsten Hopp |
234b35 |
--- src/misc2.c 2015-08-25 16:27:31.565982817 +0200
|
|
Karsten Hopp |
234b35 |
***************
|
|
Karsten Hopp |
234b35 |
*** 5058,5064 ****
|
|
Karsten Hopp |
234b35 |
char_u *s1;
|
|
Karsten Hopp |
234b35 |
char_u *s2;
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
! int i;
|
|
Karsten Hopp |
234b35 |
int prev1 = NUL;
|
|
Karsten Hopp |
234b35 |
int prev2 = NUL;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
--- 5058,5064 ----
|
|
Karsten Hopp |
234b35 |
char_u *s1;
|
|
Karsten Hopp |
234b35 |
char_u *s2;
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
! int i, j;
|
|
Karsten Hopp |
234b35 |
int prev1 = NUL;
|
|
Karsten Hopp |
234b35 |
int prev2 = NUL;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
***************
|
|
Karsten Hopp |
234b35 |
*** 5068,5086 ****
|
|
Karsten Hopp |
234b35 |
if (s1 == NULL || s2 == NULL)
|
|
Karsten Hopp |
234b35 |
return FALSE;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
! if (STRLEN(s1) != STRLEN(s2))
|
|
Karsten Hopp |
234b35 |
! return FAIL;
|
|
Karsten Hopp |
234b35 |
!
|
|
Karsten Hopp |
234b35 |
! for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i))
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
int c1 = PTR2CHAR(s1 + i);
|
|
Karsten Hopp |
234b35 |
! int c2 = PTR2CHAR(s2 + i);
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2)
|
|
Karsten Hopp |
234b35 |
&& (prev1 != '*' || prev2 != '*'))
|
|
Karsten Hopp |
234b35 |
return FAIL;
|
|
Karsten Hopp |
234b35 |
prev2 = prev1;
|
|
Karsten Hopp |
234b35 |
prev1 = c1;
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
return TRUE;
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
--- 5068,5086 ----
|
|
Karsten Hopp |
234b35 |
if (s1 == NULL || s2 == NULL)
|
|
Karsten Hopp |
234b35 |
return FALSE;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
! for (i = 0, j = 0; s1[i] != NUL;)
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
int c1 = PTR2CHAR(s1 + i);
|
|
Karsten Hopp |
234b35 |
! int c2 = PTR2CHAR(s2 + j);
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2)
|
|
Karsten Hopp |
234b35 |
&& (prev1 != '*' || prev2 != '*'))
|
|
Karsten Hopp |
234b35 |
return FAIL;
|
|
Karsten Hopp |
234b35 |
prev2 = prev1;
|
|
Karsten Hopp |
234b35 |
prev1 = c1;
|
|
Karsten Hopp |
234b35 |
+
|
|
Karsten Hopp |
234b35 |
+ i += MB_PTR2LEN(s1 + i);
|
|
Karsten Hopp |
234b35 |
+ j += MB_PTR2LEN(s2 + j);
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
return TRUE;
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
***************
|
|
Karsten Hopp |
234b35 |
*** 5814,5827 ****
|
|
Karsten Hopp |
234b35 |
const char *p, *q;
|
|
Karsten Hopp |
234b35 |
int maxlen;
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
! int i;
|
|
Karsten Hopp |
234b35 |
int c1, c2;
|
|
Karsten Hopp |
234b35 |
const char *s = NULL;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
! for (i = 0; maxlen < 0 || i < maxlen; i += MB_PTR2LEN((char_u *)p + i))
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
c1 = PTR2CHAR((char_u *)p + i);
|
|
Karsten Hopp |
234b35 |
! c2 = PTR2CHAR((char_u *)q + i);
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
/* End of "p": check if "q" also ends or just has a slash. */
|
|
Karsten Hopp |
234b35 |
if (c1 == NUL)
|
|
Karsten Hopp |
234b35 |
--- 5814,5827 ----
|
|
Karsten Hopp |
234b35 |
const char *p, *q;
|
|
Karsten Hopp |
234b35 |
int maxlen;
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
! int i, j;
|
|
Karsten Hopp |
234b35 |
int c1, c2;
|
|
Karsten Hopp |
234b35 |
const char *s = NULL;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
! for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);)
|
|
Karsten Hopp |
234b35 |
{
|
|
Karsten Hopp |
234b35 |
c1 = PTR2CHAR((char_u *)p + i);
|
|
Karsten Hopp |
234b35 |
! c2 = PTR2CHAR((char_u *)q + j);
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
/* End of "p": check if "q" also ends or just has a slash. */
|
|
Karsten Hopp |
234b35 |
if (c1 == NUL)
|
|
Karsten Hopp |
234b35 |
***************
|
|
Karsten Hopp |
234b35 |
*** 5829,5834 ****
|
|
Karsten Hopp |
234b35 |
--- 5829,5835 ----
|
|
Karsten Hopp |
234b35 |
if (c2 == NUL) /* full match */
|
|
Karsten Hopp |
234b35 |
return 0;
|
|
Karsten Hopp |
234b35 |
s = q;
|
|
Karsten Hopp |
234b35 |
+ i = j;
|
|
Karsten Hopp |
234b35 |
break;
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
***************
|
|
Karsten Hopp |
234b35 |
*** 5854,5861 ****
|
|
Karsten Hopp |
234b35 |
return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
|
|
Karsten Hopp |
234b35 |
: c1 - c2; /* no match */
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
! if (s == NULL) /* "i" ran into "maxlen" */
|
|
Karsten Hopp |
234b35 |
return 0;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
c1 = PTR2CHAR((char_u *)s + i);
|
|
Karsten Hopp |
234b35 |
--- 5855,5865 ----
|
|
Karsten Hopp |
234b35 |
return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
|
|
Karsten Hopp |
234b35 |
: c1 - c2; /* no match */
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
+
|
|
Karsten Hopp |
234b35 |
+ i += MB_PTR2LEN((char_u *)p + i);
|
|
Karsten Hopp |
234b35 |
+ j += MB_PTR2LEN((char_u *)q + j);
|
|
Karsten Hopp |
234b35 |
}
|
|
Karsten Hopp |
234b35 |
! if (s == NULL) /* "i" or "j" ran into "maxlen" */
|
|
Karsten Hopp |
234b35 |
return 0;
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
c1 = PTR2CHAR((char_u *)s + i);
|
|
Karsten Hopp |
234b35 |
*** ../vim-7.4.834/src/version.c 2015-08-25 16:19:01.587296525 +0200
|
|
Karsten Hopp |
234b35 |
--- src/version.c 2015-08-25 16:22:58.444828674 +0200
|
|
Karsten Hopp |
234b35 |
***************
|
|
Karsten Hopp |
234b35 |
*** 743,744 ****
|
|
Karsten Hopp |
234b35 |
--- 743,746 ----
|
|
Karsten Hopp |
234b35 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
234b35 |
+ /**/
|
|
Karsten Hopp |
234b35 |
+ 835,
|
|
Karsten Hopp |
234b35 |
/**/
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
--
|
|
Karsten Hopp |
234b35 |
If an elephant is left tied to a parking meter, the parking fee has to be paid
|
|
Karsten Hopp |
234b35 |
just as it would for a vehicle.
|
|
Karsten Hopp |
234b35 |
[real standing law in Florida, United States of America]
|
|
Karsten Hopp |
234b35 |
|
|
Karsten Hopp |
234b35 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
234b35 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
234b35 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
234b35 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|