msxml3: Improve QName_from_xmlChar implementation.

This commit is contained in:
Piotr Caban 2010-07-17 14:06:27 +02:00 committed by Alexandre Julliard
parent 3bf94bed3f
commit bf263947e7
1 changed files with 5 additions and 9 deletions

View File

@ -180,7 +180,6 @@ static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
{
DWORD dLen, dLast;
LPWSTR str;
BSTR bstr;
if(!name) return NULL;
@ -190,16 +189,13 @@ static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, NULL, 0)
+ MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, NULL, 0);
str = heap_alloc(dLen * sizeof(WCHAR));
if(!str)
bstr = SysAllocStringLen(NULL, dLen-1);
if(!bstr)
return NULL;
dLast = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, str, dLen);
str[dLast-1] = ':';
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, &str[dLast], dLen-dLast);
bstr = SysAllocString(str);
heap_free(str);
dLast = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, bstr, dLen);
bstr[dLast-1] = ':';
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, &bstr[dLast], dLen-dLast);
return bstr;
}