Commit 7a223656 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msxml3: Improve bstr_from_xmlCharN implementation.

parent bf263947
......@@ -158,7 +158,6 @@ static int namespacePop(saxlocator *locator)
static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
{
DWORD dLen;
LPWSTR str;
BSTR bstr;
if (!buf)
......@@ -166,13 +165,11 @@ static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, NULL, 0);
if(len != -1) dLen++;
str = heap_alloc(dLen * sizeof (WCHAR));
if (!str)
bstr = SysAllocStringLen(NULL, dLen-1);
if (!bstr)
return NULL;
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, str, dLen);
if(len != -1) str[dLen-1] = '\0';
bstr = SysAllocString(str);
heap_free(str);
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, bstr, dLen);
if(len != -1) bstr[dLen-1] = '\0';
return bstr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment