New API call for path conversion

Corinna Vinschen
Mon Feb 25 11:30:00 GMT 2008

On Feb 23 18:51, V?clav Haisman wrote:
> Corinna Vinschen wrote, On 22.2.2008 13:19:
>> Hi,
> [...]
>> Therefore, as a first cut, I'd propose something along the lines of:
>>   typedef enum
>>     {
>>       CCP_WIN_A_TO_POSIX, /* from is char*, to is char*     */
>>       CCP_WIN_W_TO_POSIX, /* from is wchar_t*, to is char*  */
>>       CCP_POSIX_TO_WIN_A, /* from is char*, to is char*     */
>>       CCP_POSIX_TO_WIN_W  /* from is char*, to is wchar_t*  */
>>     } cygwin_conv_path_t;
>>   ssize_t cygwin_conv_path (cygwin_conv_path_t what, const void *from,
>>                             void *to, size_t size);
>> "size" is the size of the "to" buffer in bytes (not in characters).
>> If size is 0, cygwin_conv_path returns the required buffer size in
>> bytes.
>> Otherwise, it returns 0 on success, or -1 on error and errno is set to
>> one of the below values:
> [...]
>> Does that sound reasonable?
> I suggest that you use four different functions with different signatures 
> instead of one with void pointers to buffers. Using just one function like 
> that seems too error prone.

The idea was to have not too many new API calls.  One thing which bugged
me with the old API was the long function names which I never get right
the first time.  I always have to look the names up in sys/cygwin.h.  If
you create a lot of different functions you have this problem again.
OTOH, with my proposal you will have to look up the values for "what", I
guess...  How should the new functions be named?  Care to make a
proposal yourself?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list