ZyX wrote: > do_set from option.c contains the following code > (http://code.google.com/p/vim/source/browse/src/option.c?r=575e8caa46a23a700ef41276995a348bd502d3c2#4543) > > value = strtol((char *)arg, NULL, 0); > if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x') > i += 2; > > . As you see here it looks like 0x-prefixed hexadecimal numbers are allowed. > But below there is > > while (VIM_ISDIGIT(arg[i])) > ++i; > if (arg[i] != NUL && !vim_iswhite(arg[i])) > { > errmsg = e_invarg; > goto skip; > } > > which obviously means that hexadecimal numbers are allowed only as > long as they contain only decimal digits. Also when there is no > strtol() atol() is used which does not allow them, and also does not > treat 0-prefixed numbers as octal. Thus the question: what’s the point > in this code? I think it should be fixed in one of the following > fashions: > > 1. strtol() should have 10 as its third argument and the next `if` > should be removed (or it may actually be better to simply use > `getdigits` or `atol()` with that cycle (basically what getdigits > does)). > 2. atol() should be replaced with `vim_str2nr` (and I think that so > should be `strtol()` and VIM_ISDIGIT cycle because vim_str2nr can > return number length). > > In the first case help should be fixed. If not fixing help there is > obvious bug: help says that if strtol is available then numbers may be > hexadecimal, but they may not be something like 0xFF.
Thanks. Obviously this is old code. Using vim_str2nr() is much simpler. -- There can't be a crisis today, my schedule is already full. /// Bram Moolenaar -- b...@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 /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.