Unicode question

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Fri Dec 6 04:43:05 CST 2002


Hello,

In trying to get shell32 a little bit more Unicodified I came across this
function ParseFieldA which is taken from shellord.c. I'm quite unfamiliar
with Unicode so I still have to learn a lot.

I have finally found most of the string manipulation functions which work
for Unicode but when it comes down to simple character comparison I'm a
little bit in the dark here.

Some code snippets elsewhere in wine make me believe that for the english
charset WCHAR == char is actually mostly true. However I wonder if this
can be relied on in code. For instance the Unicode version of ParseField
would in that case look like this but I really want the opinion of someone
else on, if the code

if (*src++ == ',') nField--;

is actually working as expected on all systems independent of the actually
used charsets for the local languages.

And has anyone a good idea what the semi-stub would mean for this function?
Maybe that it should ignore commas in quoted strings?

/*************************************************************************
 * ParseFieldW			[internal]
 *
 * copies a field from a ',' delimited string
 *
 * first field is nField = 1
 */
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
{
	WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n", debugstr_w(src), nField, dst, len);

	if (!src || !src[0] || !dst || !len)
	  return 0;

	/* skip n fields delimited by ',' */
	while (nField > 1)
	{
	  if (*src == 0x0) return FALSE;
	  if (*src++ == ',') nField--;
	}

	/* copy part till the next ',' to dst */
	while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++);

	/* finalize the string */
	*dst = 0x0;

	return TRUE;
}

Rolf Kalbermatter
 




More information about the wine-devel mailing list