mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 22:20:26 +00:00
msxml3: Improve bstr_from_xmlCharN implementation.
This commit is contained in:
parent
bf263947e7
commit
7a22365674
@ -158,7 +158,6 @@ static int namespacePop(saxlocator *locator)
|
|||||||
static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
|
static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
|
||||||
{
|
{
|
||||||
DWORD dLen;
|
DWORD dLen;
|
||||||
LPWSTR str;
|
|
||||||
BSTR bstr;
|
BSTR bstr;
|
||||||
|
|
||||||
if (!buf)
|
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);
|
dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, NULL, 0);
|
||||||
if(len != -1) dLen++;
|
if(len != -1) dLen++;
|
||||||
str = heap_alloc(dLen * sizeof (WCHAR));
|
bstr = SysAllocStringLen(NULL, dLen-1);
|
||||||
if (!str)
|
if (!bstr)
|
||||||
return NULL;
|
return NULL;
|
||||||
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, str, dLen);
|
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, bstr, dLen);
|
||||||
if(len != -1) str[dLen-1] = '\0';
|
if(len != -1) bstr[dLen-1] = '\0';
|
||||||
bstr = SysAllocString(str);
|
|
||||||
heap_free(str);
|
|
||||||
|
|
||||||
return bstr;
|
return bstr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user