mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.2036: the str2nr() tests fail
Problem: The str2nr() tests fail. Solution: Add missing part of patch.
This commit is contained in:
@@ -1773,6 +1773,7 @@ vim_isblankline(char_u *lbuf)
|
|||||||
* If "what" contains STR2NR_OCT recognize octal numbers
|
* If "what" contains STR2NR_OCT recognize octal numbers
|
||||||
* If "what" contains STR2NR_HEX recognize hex numbers
|
* If "what" contains STR2NR_HEX recognize hex numbers
|
||||||
* If "what" contains STR2NR_FORCE always assume bin/oct/hex.
|
* If "what" contains STR2NR_FORCE always assume bin/oct/hex.
|
||||||
|
* If "what" contains STR2NR_QUOTE ignore embedded single quotes
|
||||||
* If maxlen > 0, check at a maximum maxlen chars.
|
* If maxlen > 0, check at a maximum maxlen chars.
|
||||||
* If strict is TRUE, check the number strictly. return *len = 0 if fail.
|
* If strict is TRUE, check the number strictly. return *len = 0 if fail.
|
||||||
*/
|
*/
|
||||||
@@ -1841,7 +1842,8 @@ vim_str2nr(
|
|||||||
|
|
||||||
// Do the conversion manually to avoid sscanf() quirks.
|
// Do the conversion manually to avoid sscanf() quirks.
|
||||||
n = 1;
|
n = 1;
|
||||||
if (pre == 'B' || pre == 'b' || what == STR2NR_BIN + STR2NR_FORCE)
|
if (pre == 'B' || pre == 'b'
|
||||||
|
|| ((what & STR2NR_BIN) && (what & STR2NR_FORCE)))
|
||||||
{
|
{
|
||||||
/* bin */
|
/* bin */
|
||||||
if (pre != 0)
|
if (pre != 0)
|
||||||
@@ -1856,9 +1858,16 @@ vim_str2nr(
|
|||||||
++ptr;
|
++ptr;
|
||||||
if (n++ == maxlen)
|
if (n++ == maxlen)
|
||||||
break;
|
break;
|
||||||
|
if ((what & STR2NR_QUOTE) && *ptr == '\''
|
||||||
|
&& '0' <= ptr[1] && ptr[1] <= '1')
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
if (n++ == maxlen)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pre == '0' || what == STR2NR_OCT + STR2NR_FORCE)
|
}
|
||||||
|
else if (pre == '0' || ((what & STR2NR_OCT) && (what & STR2NR_FORCE)))
|
||||||
{
|
{
|
||||||
/* octal */
|
/* octal */
|
||||||
while ('0' <= *ptr && *ptr <= '7')
|
while ('0' <= *ptr && *ptr <= '7')
|
||||||
@@ -1871,9 +1880,16 @@ vim_str2nr(
|
|||||||
++ptr;
|
++ptr;
|
||||||
if (n++ == maxlen)
|
if (n++ == maxlen)
|
||||||
break;
|
break;
|
||||||
|
if ((what & STR2NR_QUOTE) && *ptr == '\''
|
||||||
|
&& '0' <= ptr[1] && ptr[1] <= '7')
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
if (n++ == maxlen)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pre != 0 || what == STR2NR_HEX + STR2NR_FORCE)
|
}
|
||||||
|
else if (pre != 0 || ((what & STR2NR_HEX) && (what & STR2NR_FORCE)))
|
||||||
{
|
{
|
||||||
/* hex */
|
/* hex */
|
||||||
if (pre != 0)
|
if (pre != 0)
|
||||||
@@ -1888,6 +1904,12 @@ vim_str2nr(
|
|||||||
++ptr;
|
++ptr;
|
||||||
if (n++ == maxlen)
|
if (n++ == maxlen)
|
||||||
break;
|
break;
|
||||||
|
if ((what & STR2NR_QUOTE) && *ptr == '\'' && vim_isxdigit(ptr[1]))
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
if (n++ == maxlen)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1906,8 +1928,15 @@ vim_str2nr(
|
|||||||
++ptr;
|
++ptr;
|
||||||
if (n++ == maxlen)
|
if (n++ == maxlen)
|
||||||
break;
|
break;
|
||||||
|
if ((what & STR2NR_QUOTE) && *ptr == '\'' && VIM_ISDIGIT(ptr[1]))
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
if (n++ == maxlen)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for an alpha-numeric character immediately following, that is
|
// Check for an alpha-numeric character immediately following, that is
|
||||||
// most likely a typo.
|
// most likely a typo.
|
||||||
if (strict && n - 1 != maxlen && ASCII_ISALNUM(*ptr))
|
if (strict && n - 1 != maxlen && ASCII_ISALNUM(*ptr))
|
||||||
|
@@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2036,
|
||||||
/**/
|
/**/
|
||||||
2035,
|
2035,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user