From c3e9780d223786acf838f2824b19104b4bd707cc Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sun, 20 Apr 2008 00:09:58 +1000 Subject: [PATCH] msxml3: Corrected IXMLDOMComment appendData with a broken xmlTextConcat function. --- dlls/msxml3/comment.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c index c4d37f2ddcb..eb273b4b40f 100644 --- a/dlls/msxml3/comment.c +++ b/dlls/msxml3/comment.c @@ -597,10 +597,32 @@ static HRESULT WINAPI domcomment_appendData( pContent = xmlChar_from_wchar( (WCHAR*)p ); if(pContent) { + /* Older versions of libxml < 2.6.27 didn't correctly support + xmlTextConcat on Comment nodes. Fallback to setting the + contents directly if xmlTextConcat fails. + + NOTE: if xmlTextConcat fails, pContent is destroyed. + */ if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0) hr = S_OK; else - hr = E_FAIL; + { + xmlChar *pNew; + pContent = xmlChar_from_wchar( (WCHAR*)p ); + if(pContent) + { + pNew = xmlStrcat(xmlNodeGetContent(pDOMNode->node), pContent); + if(pNew) + { + xmlNodeSetContent(pDOMNode->node, pNew); + hr = S_OK; + } + else + hr = E_FAIL; + } + else + hr = E_FAIL; + } } else hr = E_FAIL; -- 2.11.4.GIT