diff src/charset.c @ 23533:ee43d943c3bb v8.2.2309

patch 8.2.2309: 0o777 not recognized as octal Commit: https://github.com/vim/vim/commit/c37b655443e0a11a77a9f0707e3259ab4b8b3dda Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 7 19:36:30 2021 +0100 patch 8.2.2309: 0o777 not recognized as octal Problem: 0o777 not recognized as octal. Solution: Use vim_isodigit(). (Ken Takata, closes https://github.com/vim/vim/issues/7633, closes https://github.com/vim/vim/issues/7631)
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Jan 2021 19:45:04 +0100
parents c4bce986c31a
children 44be09b25619
line wrap: on
line diff
--- 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;