To: vim_dev@googlegroups.com Subject: Patch 8.2.2309 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2309 Problem: 0o777 not recognized as octal. Solution: Use vim_isodigit(). (Ken Takata, closes #7633, closes #7631) Files: src/charset.c, src/testdir/test_eval_stuff.vim *** ../vim-8.2.2308/src/charset.c 2020-06-10 14:16:30.098988403 +0200 --- src/charset.c 2021-01-07 19:35:06.364923862 +0100 *************** *** 1594,1599 **** --- 1594,1605 ---- 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,1837 **** // binary ptr += 2; else if ((what & STR2NR_OOCT) ! && (pre == 'O' || pre == 'o') && vim_isbdigit(ptr[2]) && (maxlen == 0 || maxlen > 2)) // octal with prefix "0o" ptr += 2; --- 1837,1843 ---- // binary ptr += 2; else if ((what & STR2NR_OOCT) ! && (pre == 'O' || pre == 'o') && vim_isodigit(ptr[2]) && (maxlen == 0 || maxlen > 2)) // octal with prefix "0o" ptr += 2; *** ../vim-8.2.2308/src/testdir/test_eval_stuff.vim 2020-09-04 21:18:40.480161935 +0200 --- src/testdir/test_eval_stuff.vim 2021-01-07 19:32:14.605319230 +0100 *************** *** 218,223 **** --- 218,224 ---- call assert_equal(15, 0o17) call assert_equal(15, 0O17) call assert_equal(18, 018) + call assert_equal(511, 0o777) call assert_equal(64, 0b1'00'00'00) call assert_equal(1048576, 0x10'00'00) call assert_equal(32768, 0o10'00'00) *************** *** 233,238 **** --- 234,240 ---- call assert_equal(15, 0o17) call assert_equal(15, 0O17) call assert_equal(18, 018) + call assert_equal(511, 0o777) endfunc func Test_scriptversion_fail() *** ../vim-8.2.2308/src/version.c 2021-01-07 19:23:04.970566910 +0100 --- src/version.c 2021-01-07 19:36:16.508761971 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2309, /**/ -- To be rich is not the end, but only a change of worries. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///