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] |
On Feb 23 18:51, V?clav Haisman wrote:Well, personally I am not opposed to longer function names. But if you want shorter cygwin_conv_XXX where XXX is one of p2a, p2w, a2p, w2p. That would be just generic conversion routines. If you want to keep all the variants that are at the top of sys/cygwin.h then you will end up either with longer names (though still shorter than they are now) or with cryptic names, if you would abbreviate words "full" or "list" into "f" and "l" suffixes. One could even use OOish scheme like cygwin_subject_action_modifiers: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
cygwin_pid_w2p cygwin_pathl_{w2p,p2w} cygwin_pathl_{w2p,p2w}_size cygwin_path_{p2a,p2w,a2p,w2p} cygwin_path_{p2a,p2w,a2p,w2p}_full cygwin_path_p_list_p cygwin_path_split
-- 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] |