This is the mail archive of the cygwin-developers 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: New API call for path conversion


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.



Corinna



-- VH

Attachment: signature.asc
Description: OpenPGP digital signature


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