Karsten Hopp 907317
To: vim-dev@vim.org
Karsten Hopp 907317
Subject: Patch 7.2.278
Karsten Hopp 907317
Fcc: outbox
Karsten Hopp 907317
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 907317
Mime-Version: 1.0
Karsten Hopp 907317
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 907317
Content-Transfer-Encoding: 8bit
Karsten Hopp 907317
------------
Karsten Hopp 907317
Karsten Hopp 907317
Patch 7.2.278
Karsten Hopp 907317
Problem:    Using magic number in the folding code.
Karsten Hopp 907317
Solution:   Use the defined MAX_LEVEL.
Karsten Hopp 907317
Files:	    src/fold.c
Karsten Hopp 907317
Karsten Hopp 907317
Karsten Hopp 907317
*** ../vim-7.2.277/src/fold.c	2009-11-03 14:46:35.000000000 +0100
Karsten Hopp 907317
--- src/fold.c	2009-11-03 12:36:37.000000000 +0100
Karsten Hopp 907317
***************
Karsten Hopp 907317
*** 1932,1938 ****
Karsten Hopp 907317
  #ifdef FEAT_EVAL
Karsten Hopp 907317
      if (*wp->w_p_fdt != NUL)
Karsten Hopp 907317
      {
Karsten Hopp 907317
! 	char_u	dashes[51];
Karsten Hopp 907317
  	win_T	*save_curwin;
Karsten Hopp 907317
  	int	level;
Karsten Hopp 907317
  	char_u	*p;
Karsten Hopp 907317
--- 1932,1938 ----
Karsten Hopp 907317
  #ifdef FEAT_EVAL
Karsten Hopp 907317
      if (*wp->w_p_fdt != NUL)
Karsten Hopp 907317
      {
Karsten Hopp 907317
! 	char_u	dashes[MAX_LEVEL + 2];
Karsten Hopp 907317
  	win_T	*save_curwin;
Karsten Hopp 907317
  	int	level;
Karsten Hopp 907317
  	char_u	*p;
Karsten Hopp 907317
***************
Karsten Hopp 907317
*** 1944,1951 ****
Karsten Hopp 907317
  	/* Set "v:folddashes" to a string of "level" dashes. */
Karsten Hopp 907317
  	/* Set "v:foldlevel" to "level". */
Karsten Hopp 907317
  	level = foldinfo->fi_level;
Karsten Hopp 907317
! 	if (level > 50)
Karsten Hopp 907317
! 	    level = 50;
Karsten Hopp 907317
  	vim_memset(dashes, '-', (size_t)level);
Karsten Hopp 907317
  	dashes[level] = NUL;
Karsten Hopp 907317
  	set_vim_var_string(VV_FOLDDASHES, dashes, -1);
Karsten Hopp 907317
--- 1944,1951 ----
Karsten Hopp 907317
  	/* Set "v:folddashes" to a string of "level" dashes. */
Karsten Hopp 907317
  	/* Set "v:foldlevel" to "level". */
Karsten Hopp 907317
  	level = foldinfo->fi_level;
Karsten Hopp 907317
! 	if (level > (int)sizeof(dashes) - 1)
Karsten Hopp 907317
! 	    level = (int)sizeof(dashes) - 1;
Karsten Hopp 907317
  	vim_memset(dashes, '-', (size_t)level);
Karsten Hopp 907317
  	dashes[level] = NUL;
Karsten Hopp 907317
  	set_vim_var_string(VV_FOLDDASHES, dashes, -1);
Karsten Hopp 907317
*** ../vim-7.2.277/src/version.c	2009-11-03 16:22:59.000000000 +0100
Karsten Hopp 907317
--- src/version.c	2009-11-03 16:29:08.000000000 +0100
Karsten Hopp 907317
***************
Karsten Hopp 907317
*** 678,679 ****
Karsten Hopp 907317
--- 678,681 ----
Karsten Hopp 907317
  {   /* Add new patch number below this line */
Karsten Hopp 907317
+ /**/
Karsten Hopp 907317
+     278,
Karsten Hopp 907317
  /**/
Karsten Hopp 907317
Karsten Hopp 907317
-- 
Karsten Hopp 907317
BRIDGEKEEPER: What is the air-speed velocity of an unladen swallow?
Karsten Hopp 907317
ARTHUR:       What do you mean?  An African or European swallow?
Karsten Hopp 907317
BRIDGEKEEPER: Er ...  I don't know that ... Aaaaarrrrrrggghhh!
Karsten Hopp 907317
   BRIDGEKEEPER is cast into the gorge.
Karsten Hopp 907317
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 907317
Karsten Hopp 907317
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 907317
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 907317
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 907317
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///