This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygwin_conv_path() documentation RFE
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 18 Dec 2009 11:10:32 +0100
- Subject: Re: cygwin_conv_path() documentation RFE
- References: <4B2AE912.7090003@etr-usa.com>
- Reply-to: cygwin at cygwin dot com
On Dec 17 19:29, Warren Young wrote:
> On this page
>
> http://cygwin.com/1.7/cygwin-api/func-cygwin-conv-path.html
>
> the size parameter should say whether it's measured in bytes or
> characters.
>
> For instance, if I pass CCP_POSIX_TO_WIN_W for the first parameter
> and a pure ASCII file name for the 'from' parameter, it's obvious
> the 'to' buffer needs to be at least 2x the size of 'from'. The
> question the docs don't answer is whether I should pass >=
> 2*(strlen(from)+1) for size or >= strlen(from)+1?
I really thought that would be clear from the description of what
happens if size is 0:
"If size is 0, cygwin_conv_path just returns the required buffer size
in bytes."
and the subsequent example code which uses the size returned by
cygwin_conv_path in a call to malloc and then, unchanged in the next
cygwin_conv_path call. I suggest to implement it as in the example.
Otherwise you will potentially need a buffer of 64K to return the
path in it. Alternatively just use the cygwin_create_path function
which will malloc the buffer for you.
I'll change the description so that the value of "size" should be clear
from the beginning.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple