msxml3: Added IMXAttributes::clear().

This commit is contained in:
Nikolay Sivov 2012-04-16 09:32:03 +04:00 committed by Alexandre Julliard
parent f9c3a51fd8
commit 6f95c6990a
2 changed files with 21 additions and 6 deletions

View File

@ -1665,8 +1665,23 @@ static HRESULT WINAPI MXAttributes_addAttributeFromIndex(IMXAttributes *iface,
static HRESULT WINAPI MXAttributes_clear(IMXAttributes *iface) static HRESULT WINAPI MXAttributes_clear(IMXAttributes *iface)
{ {
mxattributes *This = impl_from_IMXAttributes( iface ); mxattributes *This = impl_from_IMXAttributes( iface );
FIXME("(%p): stub\n", This); int i;
return E_NOTIMPL;
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) static HRESULT WINAPI MXAttributes_removeAttribute(IMXAttributes *iface, int index)

View File

@ -4068,6 +4068,9 @@ static void test_mxattr_clear(void)
hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len); hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
hr = IMXAttributes_clear(mxattr);
EXPECT_HR(hr, S_OK);
hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("local"), hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("local"),
_bstr_("qname"), _bstr_("type"), _bstr_("value")); _bstr_("qname"), _bstr_("type"), _bstr_("value"));
EXPECT_HR(hr, S_OK); 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)); ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr));
hr = IMXAttributes_clear(mxattr); hr = IMXAttributes_clear(mxattr);
todo_wine
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
len = -1; len = -1;
hr = ISAXAttributes_getLength(saxattr, &len); hr = ISAXAttributes_getLength(saxattr, &len);
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
todo_wine
ok(len == 0, "got %d\n", len); ok(len == 0, "got %d\n", len);
len = -1; len = -1;
ptr = (void*)0xdeadbeef; ptr = (void*)0xdeadbeef;
hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len); hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len);
todo_wine {
EXPECT_HR(hr, E_INVALIDARG); EXPECT_HR(hr, E_INVALIDARG);
ok(len == -1, "got %d\n", len); ok(len == -1, "got %d\n", len);
ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr); ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr);
}
IMXAttributes_Release(mxattr); IMXAttributes_Release(mxattr);
ISAXAttributes_Release(saxattr); ISAXAttributes_Release(saxattr);
free_bstrs(); free_bstrs();