msxml3: Improve QName_from_xmlChar implementation.
This commit is contained in:
parent
3bf94bed3f
commit
bf263947e7
|
@ -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)
|
static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
|
||||||
{
|
{
|
||||||
DWORD dLen, dLast;
|
DWORD dLen, dLast;
|
||||||
LPWSTR str;
|
|
||||||
BSTR bstr;
|
BSTR bstr;
|
||||||
|
|
||||||
if(!name) return NULL;
|
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)
|
dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, NULL, 0)
|
||||||
+ MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, NULL, 0);
|
+ MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, NULL, 0);
|
||||||
str = heap_alloc(dLen * sizeof(WCHAR));
|
bstr = SysAllocStringLen(NULL, dLen-1);
|
||||||
if(!str)
|
if(!bstr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dLast = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, str, dLen);
|
dLast = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, bstr, dLen);
|
||||||
str[dLast-1] = ':';
|
bstr[dLast-1] = ':';
|
||||||
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, &str[dLast], dLen-dLast);
|
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, &bstr[dLast], dLen-dLast);
|
||||||
bstr = SysAllocString(str);
|
|
||||||
|
|
||||||
heap_free(str);
|
|
||||||
|
|
||||||
return bstr;
|
return bstr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue