Ken Takata wrote:

> Vim cannot open a file if the path is exactly 259 characters (MAX_PATH - 1)
> and 'enc' is set to utf-8 on Windows.
> Following patch fixes the problem:
> 
> --- a/src/os_mswin.c
> +++ b/src/os_mswin.c
> @@ -411,7 +411,7 @@ mch_FullName(
>            * - convert the result from UCS2 to 'encoding'.
>            */
>           wname = enc_to_utf16(fname, NULL);
> -         if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL)
> +         if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH) != NULL)
>           {
>               cname = utf16_to_enc((short_u *)wbuf, NULL);
>               if (cname != NULL)
> 
> 
> MAX_PATH is defined as 260 and it includes the last NUL.
> The third parameter of _wfullpath() is length of the buffer including NUL, so
> "- 1" is not needed.  (http://msdn.microsoft.com/en-us/library/506720ff.aspx)
> 
> Note: This problem is different from 
> https://groups.google.com/d/topic/vim_dev/N10OYqPMvy0/discussion .

Thanks.  Thus this patch can be included after the other MAX_PATH
related patch, right?

-- 
"Never be afraid to tell the world who you are."
                                        -- Anonymous

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui