diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-07 19:36:30 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-07 19:36:30 +0100 |
commit | c37b655443e0a11a77a9f0707e3259ab4b8b3dda (patch) | |
tree | f7f0903661e3b4ea4f4b21edbeddd2f22ee44e30 /src/charset.c | |
parent | 328eac2b5d1569c57e1130ecb9f7cca733b84d78 (diff) | |
download | vim-git-c37b655443e0a11a77a9f0707e3259ab4b8b3dda.tar.gz |
patch 8.2.2309: 0o777 not recognized as octalv8.2.2309
Problem: 0o777 not recognized as octal.
Solution: Use vim_isodigit(). (Ken Takata, closes #7633, closes #7631)
Diffstat (limited to 'src/charset.c')
-rw-r--r-- | src/charset.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c index bf5af3720..4289360e4 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1594,6 +1594,12 @@ vim_isbdigit(int c) return (c == '0' || c == '1'); } + static int +vim_isodigit(int c) +{ + return (c >= '0' && c <= '7'); +} + /* * Vim's own character class functions. These exist because many library * islower()/toupper() etc. do not work properly: they crash when used with @@ -1831,7 +1837,7 @@ vim_str2nr( // binary ptr += 2; else if ((what & STR2NR_OOCT) - && (pre == 'O' || pre == 'o') && vim_isbdigit(ptr[2]) + && (pre == 'O' || pre == 'o') && vim_isodigit(ptr[2]) && (maxlen == 0 || maxlen > 2)) // octal with prefix "0o" ptr += 2; |