Noel Henson wrote:

> It seems that there may be a hard-coded, integer setting in an instance 
> where MAX_LEVEL should be used.
> 
> In fold.c, line 1946
> 
>       level = foldinfo->fi_level;
>       if (level > 50)
>           level = 50;
> 
> Shouldn't this read:
> 
>       level = foldinfo->fi_level;
>       if (level > MAX_LEVEL)
>           level = MAX_LEVEL;

The 50 comes from the size of dashes[].  It's a bit too much, but
can't cause problems.  This would be cleaner though:

*** ../vim-7.2.267/src/fold.c   2009-09-18 15:16:37.000000000 +0200
--- src/fold.c  2009-10-11 13:24:44.000000000 +0200
***************
*** 1932,1938 ****
  #ifdef FEAT_EVAL
      if (*wp->w_p_fdt != NUL)
      {
!       char_u  dashes[51];
        win_T   *save_curwin;
        int     level;
        char_u  *p;
--- 1932,1938 ----
  #ifdef FEAT_EVAL
      if (*wp->w_p_fdt != NUL)
      {
!       char_u  dashes[MAX_LEVEL + 2];
        win_T   *save_curwin;
        int     level;
        char_u  *p;
***************
*** 1944,1951 ****
        /* Set "v:folddashes" to a string of "level" dashes. */
        /* Set "v:foldlevel" to "level". */
        level = foldinfo->fi_level;
!       if (level > 50)
!           level = 50;
        vim_memset(dashes, '-', (size_t)level);
        dashes[level] = NUL;
        set_vim_var_string(VV_FOLDDASHES, dashes, -1);
--- 1944,1951 ----
        /* Set "v:folddashes" to a string of "level" dashes. */
        /* Set "v:foldlevel" to "level". */
        level = foldinfo->fi_level;
!       if (level > (int)sizeof(dashes) - 1)
!           level = (int)sizeof(dashes) - 1;
        vim_memset(dashes, '-', (size_t)level);
        dashes[level] = NUL;
        set_vim_var_string(VV_FOLDDASHES, dashes, -1);


-- 
        **  Hello and Welcome to the Psychiatric Hotline **
If you are obsessive-compulsive, please press 1 repeatedly.
If you are co-dependent, please ask someone to press 2.
If you have multiple personalities, please press 3, 4, 5 and 6.
If you are paranoid-delusional, we know who you are and what you want
       - just stay on the line so we can trace the call.
If you are schizophrenic, listen carefully and a little voice will
       tell you which number to press next.
If you are manic-depressive, it doesn't matter which number you press
       - no one will answer.
If you suffer from panic attacks, push every button you can find.
If you are sane, please hold on - we have the rest of humanity on the
        other line and they desparately want to ask you a few questions.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui