ekohl@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
ekohl@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.)
Hello Colin,
this is just an intermediate step. In one of my next patches I will remove /lib/host entirely because /lib/unicode supercedes it and is already used by tools like widl and wrc. Why shouldn't cmlib, newinflib and mkhive use it too?
The only changes to the source code are conversions from wcs* to str*W and from isw* to is*W. So for the host builds we will only use the *W functions if we are dealing with Unicode strings. The Win32 builds can map the *W funtions to the wcs* or isw* functions using the include/host/wcsfuncs.h header file.
Can you agree with this change?
Regards, Eric
Eric Kohl eric.kohl@t-online.de wrote:
The only changes to the source code are conversions from wcs* to str*W and from isw* to is*W. So for the host builds we will only use the *W functions if we are dealing with Unicode strings. The Win32 builds can map the *W funtions to the wcs* or isw* functions using the include/host/wcsfuncs.h header file.
Can you agree with this change?
Sure, that's certainly the better way to do it, considering that we already have Wine's "unicode" library for years.
Now you might as well get rid of the /include/host/wcsfuncs.h file entirely and just use /include/reactos/wine/unicode.h. If I'm not mistaken, this is the counterpart to /tools/unicode/wine/unicode.h, which maps all functions defined there to the Win32 ones.
As most host libraries already have an #ifdef HOST...#else...#endif block, we should be able to switch between both include files easily and don't need the USE_HOST_WCSFUNCS define anymore.
Best regards,
Colin