>From ff48a5a9b73a8412749d533c5776194fd3dfd9d2 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Tue, 13 Mar 2012 11:05:45 +0300
Subject: [PATCH 3/4] Implement ISAXAttributes::getLength() for MXAttributes

---
 dlls/msxml3/mxwriter.c        |   10 ++++++++--
 dlls/msxml3/tests/saxreader.c |   13 +++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c
index d0ce946..6217d45 100644
--- a/dlls/msxml3/mxwriter.c
+++ b/dlls/msxml3/mxwriter.c
@@ -1727,8 +1727,14 @@ static ULONG WINAPI SAXAttributes_Release(ISAXAttributes *iface)
 static HRESULT WINAPI SAXAttributes_getLength(ISAXAttributes *iface, int *length)
 {
     mxattributes *This = impl_from_ISAXAttributes( iface );
-    FIXME("(%p)->(%p): stub\n", This, length);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%p)\n", This, length);
+
+    if (!length && (This->class_version == MSXML_DEFAULT || This->class_version == MSXML3))
+       return E_POINTER;
+
+    *length = This->length;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI SAXAttributes_getURI(ISAXAttributes *iface, int nIndex, const WCHAR **pUrl,
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 4aca3af..27200cb 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -3315,34 +3315,30 @@ static void test_mxattr_addAttribute(void)
         hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr);
         EXPECT_HR(hr, S_OK);
 
-        /* SAXAttributes30 and SAXAttributes60 both crash on this test */
+        /* SAXAttributes40 and SAXAttributes60 both crash on this test */
         if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
             IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
         {
             hr = ISAXAttributes_getLength(saxattr, NULL);
-        todo_wine
             EXPECT_HR(hr, E_POINTER);
         }
 
         len = -1;
         hr = ISAXAttributes_getLength(saxattr, &len);
-todo_wine {
         EXPECT_HR(hr, S_OK);
         ok(len == 0, "got %d\n", len);
-}
+
         hr = IMXAttributes_addAttribute(mxattr, _bstr_(table->uri), _bstr_(table->local),
             _bstr_(table->qname), _bstr_(table->type), _bstr_(table->value));
         ok(hr == table->hr, "%d: got 0x%08x, expected 0x%08x\n", i, hr, table->hr);
 
         len = -1;
         hr = ISAXAttributes_getLength(saxattr, &len);
-todo_wine {
         EXPECT_HR(hr, S_OK);
         if (table->hr == S_OK)
             ok(len == 1, "%d: got %d length, expected 0\n", i, len);
         else
             ok(len == 0, "%d: got %d length, expected 1\n", i, len);
-}
 
         ISAXAttributes_Release(saxattr);
         IMXAttributes_Release(mxattr);
@@ -3383,10 +3379,8 @@ todo_wine
 
     len = -1;
     hr = ISAXAttributes_getLength(saxattr, &len);
-todo_wine {
     EXPECT_HR(hr, S_OK);
     ok(len == 1, "got %d\n", len);
-}
 
     len = -1;
     hr = ISAXAttributes_getQName(saxattr, 0, NULL, &len);
@@ -3415,10 +3409,9 @@ todo_wine
 
     len = -1;
     hr = ISAXAttributes_getLength(saxattr, &len);
-todo_wine {
     EXPECT_HR(hr, S_OK);
+todo_wine
     ok(len == 0, "got %d\n", len);
-}
 
     len = -1;
     ptr = (void*)0xdeadbeef;
-- 
1.5.6.5


