073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.602
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.602
073263
Problem:    ":set" does not accept hex numbers as documented.
073263
Solution:   Use vim_str2nr(). (ZyX)
073263
Files:	    src/option.c, runtime/doc/options.txt
073263
073263
073263
*** ../vim-7.4.601/src/option.c	2014-11-30 13:34:16.885626772 +0100
073263
--- src/option.c	2015-01-27 15:51:01.455344467 +0100
073263
***************
073263
*** 4540,4560 ****
073263
  				goto skip;
073263
  			    }
073263
  			}
073263
- 				/* allow negative numbers (for 'undolevels') */
073263
  			else if (*arg == '-' || VIM_ISDIGIT(*arg))
073263
  			{
073263
! 			    i = 0;
073263
! 			    if (*arg == '-')
073263
! 				i = 1;
073263
! #ifdef HAVE_STRTOL
073263
! 			    value = strtol((char *)arg, NULL, 0);
073263
! 			    if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
073263
! 				i += 2;
073263
! #else
073263
! 			    value = atol((char *)arg);
073263
! #endif
073263
! 			    while (VIM_ISDIGIT(arg[i]))
073263
! 				++i;
073263
  			    if (arg[i] != NUL && !vim_iswhite(arg[i]))
073263
  			    {
073263
  				errmsg = e_invarg;
073263
--- 4540,4550 ----
073263
  				goto skip;
073263
  			    }
073263
  			}
073263
  			else if (*arg == '-' || VIM_ISDIGIT(*arg))
073263
  			{
073263
! 			    /* Allow negative (for 'undolevels'), octal and
073263
! 			     * hex numbers. */
073263
! 			    vim_str2nr(arg, NULL, &i, TRUE, TRUE, &value, NULL);
073263
  			    if (arg[i] != NUL && !vim_iswhite(arg[i]))
073263
  			    {
073263
  				errmsg = e_invarg;
073263
*** ../vim-7.4.601/runtime/doc/options.txt	2014-11-05 17:44:47.676471691 +0100
073263
--- runtime/doc/options.txt	2015-01-27 15:47:53.873380762 +0100
073263
***************
073263
*** 59,67 ****
073263
  :se[t] {option}:{value}
073263
  			Set string or number option to {value}.
073263
  			For numeric options the value can be given in decimal,
073263
! 			hex (preceded with 0x) or octal (preceded with '0')
073263
! 			(hex and octal are only available for machines which
073263
! 			have the strtol() function).
073263
  			The old value can be inserted by typing 'wildchar' (by
073263
  			default this is a <Tab> or CTRL-E if 'compatible' is
073263
  			set).  See |cmdline-completion|.
073263
--- 59,65 ----
073263
  :se[t] {option}:{value}
073263
  			Set string or number option to {value}.
073263
  			For numeric options the value can be given in decimal,
073263
!  			hex (preceded with 0x) or octal (preceded with '0').
073263
  			The old value can be inserted by typing 'wildchar' (by
073263
  			default this is a <Tab> or CTRL-E if 'compatible' is
073263
  			set).  See |cmdline-completion|.
073263
*** ../vim-7.4.601/src/version.c	2015-01-27 15:18:55.156333265 +0100
073263
--- src/version.c	2015-01-27 15:49:28.840349899 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     602,
073263
  /**/
073263
073263
-- 
073263
hundred-and-one symptoms of being an internet addict:
073263
128. You can access the Net -- via your portable and cellular phone.
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///