This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA/libiberty] Darwin has case-insensitive filesystems


On Jun 15 20:27, Eli Zaretskii wrote:
> > Date: Wed, 15 Jun 2011 10:22:36 +0200
> > From: Corinna Vinschen <...>
> > Talking about case-insensitive comparison, the filename_cmp and
> > filename_ncmp functions don't work for multibyte codesets, only for
> > singlebyte codesets.  Given that UTF-8 is standard nowadays, shouldn't
> > these functions be replaced with multibyte-aware versions?
> 
> I agree, but if we go that way, shouldn't we support UTF-16, which is
> used by the native Windows APIs?  Windows does not use UTF-8 for file
> names.

I don't think so.  UTF-16 is Windows' wchar_t (or WCHAR) codeset, but
the applications calling the libiberty functions are using the char
datatype with single- or multibyte codesets.

If the filename_cmp function converts the multibyte input strings
to wchar_t and compares the wide char strings case insensitive(*),
they would use UTF-16 under the hood on Windows anyway.  

(*) As proposed in
    http://sourceware.org/ml/gdb-patches/2011-06/msg00210.html,
    basically like this:

    #ifdef _WIN32
    #define wcscasecmp _wcsicmp
    #endif
    mbstowcs (wide_a, a);
    mbstowcs (wide_b, b);
    return wcscasecmp (wide_a, wide_b);


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


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