To: vim_dev@googlegroups.com Subject: Patch 8.1.2036 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2036 (after 8.1.2035) Problem: The str2nr() tests fail. Solution: Add missing part of patch. Files: src/charset.c *** ../vim-8.1.2035/src/charset.c 2019-08-21 14:36:29.383376114 +0200 --- src/charset.c 2019-09-15 14:25:33.242229716 +0200 *************** *** 1773,1778 **** --- 1773,1779 ---- * If "what" contains STR2NR_OCT recognize octal numbers * If "what" contains STR2NR_HEX recognize hex numbers * 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 strict is TRUE, check the number strictly. return *len = 0 if fail. */ *************** *** 1841,1847 **** // Do the conversion manually to avoid sscanf() quirks. n = 1; ! if (pre == 'B' || pre == 'b' || what == STR2NR_BIN + STR2NR_FORCE) { /* bin */ if (pre != 0) --- 1842,1849 ---- // Do the conversion manually to avoid sscanf() quirks. n = 1; ! if (pre == 'B' || pre == 'b' ! || ((what & STR2NR_BIN) && (what & STR2NR_FORCE))) { /* bin */ if (pre != 0) *************** *** 1856,1864 **** ++ptr; if (n++ == maxlen) break; } } ! else if (pre == '0' || what == STR2NR_OCT + STR2NR_FORCE) { /* octal */ while ('0' <= *ptr && *ptr <= '7') --- 1858,1873 ---- ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' + && '0' <= ptr[1] && ptr[1] <= '1') + { + ++ptr; + if (n++ == maxlen) + break; + } } } ! else if (pre == '0' || ((what & STR2NR_OCT) && (what & STR2NR_FORCE))) { /* octal */ while ('0' <= *ptr && *ptr <= '7') *************** *** 1871,1879 **** ++ptr; if (n++ == maxlen) break; } } ! else if (pre != 0 || what == STR2NR_HEX + STR2NR_FORCE) { /* hex */ if (pre != 0) --- 1880,1895 ---- ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' + && '0' <= ptr[1] && ptr[1] <= '7') + { + ++ptr; + if (n++ == maxlen) + break; + } } } ! else if (pre != 0 || ((what & STR2NR_HEX) && (what & STR2NR_FORCE))) { /* hex */ if (pre != 0) *************** *** 1888,1893 **** --- 1904,1915 ---- ++ptr; if (n++ == maxlen) break; + if ((what & STR2NR_QUOTE) && *ptr == '\'' && vim_isxdigit(ptr[1])) + { + ++ptr; + if (n++ == maxlen) + break; + } } } else *************** *** 1906,1913 **** --- 1928,1942 ---- ++ptr; if (n++ == maxlen) 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 // most likely a typo. if (strict && n - 1 != maxlen && ASCII_ISALNUM(*ptr)) *** ../vim-8.1.2035/src/version.c 2019-09-15 14:32:49.556731456 +0200 --- src/version.c 2019-09-15 14:49:18.849389000 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2036, /**/ -- hundred-and-one symptoms of being an internet addict: 265. Your reason for not staying in touch with family is that they do not have e-mail addresses. /// 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 ///