On 08/26/2018 07:27 PM, Daniel Lehman wrote:
static HRESULT WINAPI xmlnodemap_get_item( IXMLDOMNamedNodeMap *iface, LONG index, IXMLDOMNode** item) { + HRESULT hr; + xmlAttrPtr cur; + struct list *ptr; + nsattr_entry *nsattr; xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
TRACE("(%p)->(%d %p)\n", This, index, item);
- return This->funcs->get_item(This->node, index, item); + hr = This->funcs->get_item(This->node, index, item); + if (hr != S_FALSE) + return hr; + + ptr = list_head(&This->nsattrs); + if (!ptr) + { + if (!This->node->nsDef) + return S_FALSE; + + if (This->node->nsDef) + { + hr = copy_ns_as_attrs(This); + if (FAILED(hr)) + return hr; + } + + ptr = list_head(&This->nsattrs); + if (!ptr) + return FALSE; + } + + if (This->node->properties) + { + --index; + cur = This->node->properties; + while (cur->next) + { + --index; + cur = cur->next; + } + } + + if (index < 0) + return S_FALSE; + + while (index--) + ptr = list_next(ptr, ptr); + + nsattr = LIST_ENTRY(ptr, nsattr_entry, entry); + cur = nsattr->attr; + *item = create_node((xmlNodePtr) cur); + + return S_OK; } This only applies to elements, so such fixup should happen there, not in generic nodemap method.