[PATCH] Corrected IXMLDOMComment appendData with a broken xmlTextConcat function

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sat Apr 19 09:09:58 CDT 2008


---
 dlls/msxml3/comment.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index c4d37f2..3d988d2 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 didnt 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;
-- 
1.5.4.1


--------------090009090801020909020409--




More information about the wine-patches mailing list