msxml3: Implement setting attributes properties with IMXAttributes.

This commit is contained in:
Nikolay Sivov 2013-07-30 15:08:03 +04:00 committed by Alexandre Julliard
parent 11736f36c9
commit ccf04d644b
1 changed files with 49 additions and 14 deletions

View File

@ -1888,14 +1888,20 @@ static HRESULT WINAPI MXAttributes_clear(IMXAttributes *iface)
return S_OK;
}
static mxattribute *get_attribute_byindex(mxattributes *attrs, int index)
{
if (index < 0 || index >= attrs->length) return NULL;
return &attrs->attr[index];
}
static HRESULT WINAPI MXAttributes_removeAttribute(IMXAttributes *iface, int index)
{
mxattributes *This = impl_from_IMXAttributes( iface );
mxattribute *src, *dst;
mxattribute *dst;
TRACE("(%p)->(%d)\n", This, index);
if (index < 0 || index >= This->length) return E_INVALIDARG;
if (!(dst = get_attribute_byindex(This, index))) return E_INVALIDARG;
/* no need to remove last attribute, just make it inaccessible */
if (index + 1 == This->length)
@ -1904,10 +1910,7 @@ static HRESULT WINAPI MXAttributes_removeAttribute(IMXAttributes *iface, int ind
return S_OK;
}
dst = &This->attr[index];
src = &This->attr[index+1];
memmove(dst, src, (This->length-index-1)*sizeof(*dst));
memmove(dst, dst + 1, (This->length-index-1)*sizeof(*dst));
This->length--;
return S_OK;
@ -1933,29 +1936,61 @@ static HRESULT WINAPI MXAttributes_setLocalName(IMXAttributes *iface, int index,
BSTR localName)
{
mxattributes *This = impl_from_IMXAttributes( iface );
FIXME("(%p)->(%d %s): stub\n", This, index, debugstr_w(localName));
return E_NOTIMPL;
mxattribute *attr;
TRACE("(%p)->(%d %s)\n", This, index, debugstr_w(localName));
if (!(attr = get_attribute_byindex(This, index))) return E_INVALIDARG;
SysFreeString(attr->local);
attr->local = SysAllocString(localName);
return S_OK;
}
static HRESULT WINAPI MXAttributes_setQName(IMXAttributes *iface, int index, BSTR QName)
{
mxattributes *This = impl_from_IMXAttributes( iface );
FIXME("(%p)->(%d %s): stub\n", This, index, debugstr_w(QName));
return E_NOTIMPL;
mxattribute *attr;
TRACE("(%p)->(%d %s)\n", This, index, debugstr_w(QName));
if (!(attr = get_attribute_byindex(This, index))) return E_INVALIDARG;
SysFreeString(attr->qname);
attr->qname = SysAllocString(QName);
return S_OK;
}
static HRESULT WINAPI MXAttributes_setURI(IMXAttributes *iface, int index, BSTR uri)
{
mxattributes *This = impl_from_IMXAttributes( iface );
FIXME("(%p)->(%d %s): stub\n", This, index, debugstr_w(uri));
return E_NOTIMPL;
mxattribute *attr;
TRACE("(%p)->(%d %s)\n", This, index, debugstr_w(uri));
if (!(attr = get_attribute_byindex(This, index))) return E_INVALIDARG;
SysFreeString(attr->uri);
attr->uri = SysAllocString(uri);
return S_OK;
}
static HRESULT WINAPI MXAttributes_setValue(IMXAttributes *iface, int index, BSTR value)
{
mxattributes *This = impl_from_IMXAttributes( iface );
FIXME("(%p)->(%d %s): stub\n", This, index, debugstr_w(value));
return E_NOTIMPL;
mxattribute *attr;
TRACE("(%p)->(%d %s)\n", This, index, debugstr_w(value));
if (!(attr = get_attribute_byindex(This, index))) return E_INVALIDARG;
SysFreeString(attr->value);
attr->value = SysAllocString(value);
return S_OK;
}
static const IMXAttributesVtbl MXAttributesVtbl = {