[PATCH] Implement IXMLDOMComment get_length

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Feb 26 03:21:11 CST 2008


---
 dlls/msxml3/comment.c      |   22 ++++++++++++++++++++--
 dlls/msxml3/tests/domdoc.c |    7 +++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index 3b09502..9e4b1a1 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -500,8 +500,26 @@ static HRESULT WINAPI domcomment_get_length(
     IXMLDOMComment *iface,
     long *len)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    domcomment *This = impl_from_IXMLDOMComment( iface );
+    xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
+    xmlChar *pContent;
+    long nLength = 0;
+
+    TRACE("%p\n", iface);
+
+    if(!len)
+        return E_INVALIDARG;
+
+    pContent = xmlNodeGetContent(pDOMNode->node);
+    if(pContent)
+    {
+        nLength = xmlStrlen(pContent);
+        xmlFree(pContent);
+    }
+
+    *len = nLength;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI domcomment_substringData(
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 16a7e77..056cb56 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -2,6 +2,7 @@
  * XML test
  *
  * Copyright 2005 Mike McCormack for CodeWeavers
+ * Coptwight 2007 Alistair Leslie-Hughes
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1949,6 +1950,7 @@ static void test_xmlTypes(void)
     BSTR str;
     IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1;   /* Used for testing Siblings */
     VARIANT v;
+    long len = 0;
 
     hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (LPVOID*)&doc );
     if( hr != S_OK )
@@ -2107,6 +2109,11 @@ static void test_xmlTypes(void)
                 ok(hr == S_OK, "ret %08x\n", hr );
                 ok( !lstrcmpW( str, _bstr_("This &is a ; test <>\\") ), "incorrect xml string\n");
                 SysFreeString(str);
+                
+                /* test length property */
+                hr = IXMLDOMComment_get_length(pComment, &len);
+                ok(hr == S_OK, "ret %08x\n", hr );
+                ok(len == 21, "expected 21 got %ld\n", len);
 
                 IXMLDOMComment_Release(pComment);
             }
-- 
1.5.4.1


--------------070100020105020400030405--




More information about the wine-patches mailing list