Commit 2a55b8d8 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msxml: Fix implementation of ISAXContentHandler_characters.

parent c7fc9265
...@@ -197,6 +197,23 @@ static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name) ...@@ -197,6 +197,23 @@ static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
return bstr; return bstr;
} }
BSTR bstr_from_xmlChar_wn(const xmlChar *buf, int len)
{
DWORD size;
LPWSTR str;
BSTR bstr;
if(!buf) return NULL;
size = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, NULL, 0);
str = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR));
if(!str) return NULL;
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, str, size);
bstr = SysAllocStringLen(str, size);
HeapFree(GetProcessHeap(), 0, str);
return bstr;
}
static void format_error_message_from_id(saxlocator *This, HRESULT hr) static void format_error_message_from_id(saxlocator *This, HRESULT hr)
{ {
xmlStopParser(This->pParserCtxt); xmlStopParser(This->pParserCtxt);
...@@ -1176,8 +1193,6 @@ static void libxmlCharacters( ...@@ -1176,8 +1193,6 @@ static void libxmlCharacters(
chEnd = This->lastCur+len; chEnd = This->lastCur+len;
while(*chEnd != '<') chEnd++; while(*chEnd != '<') chEnd++;
Chars = bstr_from_xmlChar(ch);
lastCurCopy = This->lastCur; lastCurCopy = This->lastCur;
columnCopy = This->column; columnCopy = This->column;
lineCopy = This->line; lineCopy = This->line;
...@@ -1195,7 +1210,7 @@ static void libxmlCharacters( ...@@ -1195,7 +1210,7 @@ static void libxmlCharacters(
end++; end++;
} }
Chars = bstr_from_xmlChar(This->lastCur); Chars = bstr_from_xmlChar_wn(This->lastCur, end-This->lastCur+2);
if(*end == '\r' && *(end+1) == '\n') if(*end == '\r' && *(end+1) == '\n')
{ {
......
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