Yegappan Lakshmanan wrote:

> On MS-Windows, Vim (7.1.267) hangs when executing the following command:
> 
>     :echo fnamemodify('c:\abc\abc', ':8')
> 
> Is anybody else able to reproduce this issue?
> 
> It looks like Vim is stuck in the shortpath_for_invalid_fname() function in 
> the
> eval.c file. The below patch seems to fix the problem.
> 
> -------------------------------------------------------------------------------------------------------
> *** vim7\src\eval.c
> --- eval.c
> *************** shortpath_for_invalid_fname(fname, bufp,
> *** 21140,21145 ****
> --- 21140,21149 ----
>           return -1;
>       }
>       *s = ch;    /* Preserve the string */
> +     if (plen == 0) {
> +         --s;
> +         ++slen;
> +     }
>       } while (plen == 0);
> 
>       if (plen > 0)
> -------------------------------------------------------------------------------------------------------

To me it looks like this whole loop is bogus.  If GetShortPathName() fails
the length is set to zero, and following calls will get a zero length.
Passing around "plen" doesn't make much sense then.

The comments for the functions are very unclear about what the arguments
are for.

Can someone volunteer to clean this code up?

-- 
>From "know your smileys":
 <|-) Chinese
 <|-( Chinese and doesn't like these kind of jokes

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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