This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin_conv_path() documentation RFE

On Dec 17 19:29, Warren Young wrote:
> On this page
> 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 Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]