[ros-dev] [ros-diffs] [ekohl] 47071: [NEWINFLIB] - Change Unicode string functions from wcs* to str*W because glibc (Linux build) provides the wcs* functions but they use a wchar_t size of 32 bits instead of the required 16 bits. - Add a str*W to wcs* wrapper (infrosrtl.c) in order to use the wcs* function for the WIN32 build. - Add required str*W functions to the host library. ATTENTION: This might break the build bot although it has been tested on Windows and Linux!!!

Colin Finck mail at colinfinck.de
Sat May 1 13:02:26 CEST 2010


ekohl at svn.reactos.org wrote:
>  PWSTR utf16_wcschr(PWSTR str, WCHAR c)
> +{
> +    SIZE_T i;
> +
> +    for(i = 0; str[i] && str[i] != c; i++);
> +
> +    if(str[i])
> +        return &str[i];
> +    else
> +        return NULL;
> +}
> +
> +PWSTR strchrW(PWSTR str, WCHAR c)

Why do you duplicate the same code for these wide-char string functions
here, just under a different name?
The utf16_* family of functions in this file was particularly designed to
address the issue of different wchar_t lengths on different hosts. It's
meant to be used together with the include/host/wcsfuncs.h header.

If you need an example, cmlib is one library using these functions (see
e.g. "cmlib.h" for the proper header inclusion, "cminit.c" for a use, etc.)

Best regards,

Colin



More information about the Ros-dev mailing list