Nikolay Sivov : msxml3: Added IMXAttributes::clear().

Alexandre Julliard julliard at winehq.org
Tue Apr 17 13:31:48 CDT 2012


Module: wine
Branch: master
Commit: 6f95c6990af0e009ad43d2cb06e4c3e0629190c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6f95c6990af0e009ad43d2cb06e4c3e0629190c1

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Apr 16 09:32:03 2012 +0400

msxml3: Added IMXAttributes::clear().

---

 dlls/msxml3/mxwriter.c        |   19 +++++++++++++++++--
 dlls/msxml3/tests/saxreader.c |    8 ++++----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c
index 41979e6..a5b9684 100644
--- a/dlls/msxml3/mxwriter.c
+++ b/dlls/msxml3/mxwriter.c
@@ -1665,8 +1665,23 @@ static HRESULT WINAPI MXAttributes_addAttributeFromIndex(IMXAttributes *iface,
 static HRESULT WINAPI MXAttributes_clear(IMXAttributes *iface)
 {
     mxattributes *This = impl_from_IMXAttributes( iface );
-    FIXME("(%p): stub\n", This);
-    return E_NOTIMPL;
+    int i;
+
+    TRACE("(%p)\n", This);
+
+    for (i = 0; i < This->length; i++)
+    {
+        SysFreeString(This->attr[i].qname);
+        SysFreeString(This->attr[i].local);
+        SysFreeString(This->attr[i].uri);
+        SysFreeString(This->attr[i].type);
+        SysFreeString(This->attr[i].value);
+        memset(&This->attr[i], 0, sizeof(mxattribute));
+    }
+
+    This->length = 0;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI MXAttributes_removeAttribute(IMXAttributes *iface, int index)
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 4e2bd11..afe887c 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -4068,6 +4068,9 @@ static void test_mxattr_clear(void)
     hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
     EXPECT_HR(hr, E_INVALIDARG);
 
+    hr = IMXAttributes_clear(mxattr);
+    EXPECT_HR(hr, S_OK);
+
     hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("local"),
         _bstr_("qname"), _bstr_("type"), _bstr_("value"));
     EXPECT_HR(hr, S_OK);
@@ -4094,23 +4097,20 @@ static void test_mxattr_clear(void)
     ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr));
 
     hr = IMXAttributes_clear(mxattr);
-todo_wine
     EXPECT_HR(hr, S_OK);
 
     len = -1;
     hr = ISAXAttributes_getLength(saxattr, &len);
     EXPECT_HR(hr, S_OK);
-todo_wine
     ok(len == 0, "got %d\n", len);
 
     len = -1;
     ptr = (void*)0xdeadbeef;
     hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
-todo_wine {
     EXPECT_HR(hr, E_INVALIDARG);
     ok(len == -1, "got %d\n", len);
     ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr);
-}
+
     IMXAttributes_Release(mxattr);
     ISAXAttributes_Release(saxattr);
     free_bstrs();




More information about the wine-cvs mailing list