From 11736f36c9d498949c724ad525707d0b530bcd33 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 30 Jul 2013 15:03:22 +0400 Subject: [PATCH] msxml3: Implement IMXAttributes_removeAttribute(). --- dlls/msxml3/mxwriter.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c index 3196374ad05..03c1b67240a 100644 --- a/dlls/msxml3/mxwriter.c +++ b/dlls/msxml3/mxwriter.c @@ -1891,8 +1891,26 @@ static HRESULT WINAPI MXAttributes_clear(IMXAttributes *iface) static HRESULT WINAPI MXAttributes_removeAttribute(IMXAttributes *iface, int index) { mxattributes *This = impl_from_IMXAttributes( iface ); - FIXME("(%p)->(%d): stub\n", This, index); - return E_NOTIMPL; + mxattribute *src, *dst; + + TRACE("(%p)->(%d)\n", This, index); + + if (index < 0 || index >= This->length) return E_INVALIDARG; + + /* no need to remove last attribute, just make it inaccessible */ + if (index + 1 == This->length) + { + This->length--; + return S_OK; + } + + dst = &This->attr[index]; + src = &This->attr[index+1]; + + memmove(dst, src, (This->length-index-1)*sizeof(*dst)); + This->length--; + + return S_OK; } static HRESULT WINAPI MXAttributes_setAttribute(IMXAttributes *iface, int index,