mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2309: 0o777 not recognized as octal
Problem: 0o777 not recognized as octal.
Solution: Use vim_isodigit(). (Ken Takata, closes vim/vim#7633, closes vim/vim#7631)
c37b655443
:scriptversion is N/A.
This commit is contained in:
parent
90a4cf92d2
commit
26733dd488
@ -169,6 +169,14 @@ static inline bool ascii_isbdigit(int c)
|
|||||||
return (c == '0' || c == '1');
|
return (c == '0' || c == '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks if `c` is an octal digit, that is, 0-7.
|
||||||
|
///
|
||||||
|
/// @see {ascii_isdigit}
|
||||||
|
static inline bool ascii_isodigit(int c)
|
||||||
|
{
|
||||||
|
return (c >= '0' && c <= '7');
|
||||||
|
}
|
||||||
|
|
||||||
/// Checks if `c` is a white-space character, that is,
|
/// Checks if `c` is a white-space character, that is,
|
||||||
/// one of \f, \n, \r, \t, \v.
|
/// one of \f, \n, \r, \t, \v.
|
||||||
///
|
///
|
||||||
|
@ -1463,7 +1463,7 @@ void vim_str2nr(const char_u *const start, int *const prep, int *const len,
|
|||||||
if (!STRING_ENDED(ptr + 2)
|
if (!STRING_ENDED(ptr + 2)
|
||||||
&& ptr[0] == '0'
|
&& ptr[0] == '0'
|
||||||
&& (ptr[1] == 'o' || ptr[1] == 'O')
|
&& (ptr[1] == 'o' || ptr[1] == 'O')
|
||||||
&& ascii_isbdigit(ptr[2])) {
|
&& ascii_isodigit(ptr[2])) {
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
}
|
}
|
||||||
goto vim_str2nr_oct;
|
goto vim_str2nr_oct;
|
||||||
@ -1499,14 +1499,14 @@ void vim_str2nr(const char_u *const start, int *const prep, int *const len,
|
|||||||
if ((what & STR2NR_OOCT)
|
if ((what & STR2NR_OOCT)
|
||||||
&& !STRING_ENDED(ptr + 2)
|
&& !STRING_ENDED(ptr + 2)
|
||||||
&& (pre == 'O' || pre == 'o')
|
&& (pre == 'O' || pre == 'o')
|
||||||
&& ascii_isbdigit(ptr[2])) {
|
&& ascii_isodigit(ptr[2])) {
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
goto vim_str2nr_oct;
|
goto vim_str2nr_oct;
|
||||||
}
|
}
|
||||||
// Detect old octal format: 0 followed by octal digits.
|
// Detect old octal format: 0 followed by octal digits.
|
||||||
pre = 0;
|
pre = 0;
|
||||||
if (!(what & STR2NR_OCT)
|
if (!(what & STR2NR_OCT)
|
||||||
|| !('0' <= ptr[1] && ptr[1] <= '7')) {
|
|| !ascii_isodigit(ptr[1])) {
|
||||||
goto vim_str2nr_dec;
|
goto vim_str2nr_dec;
|
||||||
}
|
}
|
||||||
for (int i = 2; !STRING_ENDED(ptr + i) && ascii_isdigit(ptr[i]); i++) {
|
for (int i = 2; !STRING_ENDED(ptr + i) && ascii_isdigit(ptr[i]); i++) {
|
||||||
@ -1552,7 +1552,7 @@ vim_str2nr_bin:
|
|||||||
PARSE_NUMBER(2, (*ptr == '0' || *ptr == '1'), (*ptr - '0'));
|
PARSE_NUMBER(2, (*ptr == '0' || *ptr == '1'), (*ptr - '0'));
|
||||||
goto vim_str2nr_proceed;
|
goto vim_str2nr_proceed;
|
||||||
vim_str2nr_oct:
|
vim_str2nr_oct:
|
||||||
PARSE_NUMBER(8, ('0' <= *ptr && *ptr <= '7'), (*ptr - '0'));
|
PARSE_NUMBER(8, (ascii_isodigit(*ptr)), (*ptr - '0'));
|
||||||
goto vim_str2nr_proceed;
|
goto vim_str2nr_proceed;
|
||||||
vim_str2nr_dec:
|
vim_str2nr_dec:
|
||||||
PARSE_NUMBER(10, (ascii_isdigit(*ptr)), (*ptr - '0'));
|
PARSE_NUMBER(10, (ascii_isdigit(*ptr)), (*ptr - '0'));
|
||||||
|
Loading…
Reference in New Issue
Block a user