From c2d792475b448b5cd51c1f806dddd4b297a28e93 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 9 Mar 2012 11:55:03 +0300 Subject: [PATCH] msxml3: Add stub ISAXAttributes for MXAttributes implementation. --- dlls/msxml3/mxwriter.c | 154 ++++++++++++++++++++++++++++++++++++++++++ dlls/msxml3/tests/saxreader.c | 37 +++++----- 2 files changed, 175 insertions(+), 16 deletions(-) diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c index dabd3d66161..2188557a2d6 100644 --- a/dlls/msxml3/mxwriter.c +++ b/dlls/msxml3/mxwriter.c @@ -122,6 +122,7 @@ typedef struct { DispatchEx dispex; IMXAttributes IMXAttributes_iface; + ISAXAttributes ISAXAttributes_iface; LONG ref; } mxattributes; @@ -130,6 +131,11 @@ static inline mxattributes *impl_from_IMXAttributes( IMXAttributes *iface ) return CONTAINING_RECORD(iface, mxattributes, IMXAttributes_iface); } +static inline mxattributes *impl_from_ISAXAttributes( ISAXAttributes *iface ) +{ + return CONTAINING_RECORD(iface, mxattributes, ISAXAttributes_iface); +} + static xml_encoding parse_encoding_name(const WCHAR *encoding) { static const WCHAR utf8W[] = {'U','T','F','-','8',0}; @@ -1463,6 +1469,10 @@ static HRESULT WINAPI MXAttributes_QueryInterface(IMXAttributes *iface, REFIID r { *ppObj = iface; } + else if ( IsEqualGUID( riid, &IID_ISAXAttributes )) + { + *ppObj = &This->ISAXAttributes_iface; + } else if (dispex_query_interface(&This->dispex, riid, ppObj)) { return *ppObj ? S_OK : E_NOINTERFACE; @@ -1639,6 +1649,149 @@ static const IMXAttributesVtbl MXAttributesVtbl = { MXAttributes_setValue }; +static HRESULT WINAPI SAXAttributes_QueryInterface(ISAXAttributes *iface, REFIID riid, void **ppObj) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + return IMXAttributes_QueryInterface(&This->IMXAttributes_iface, riid, ppObj); +} + +static ULONG WINAPI SAXAttributes_AddRef(ISAXAttributes *iface) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + return IMXAttributes_AddRef(&This->IMXAttributes_iface); +} + +static ULONG WINAPI SAXAttributes_Release(ISAXAttributes *iface) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + return IMXAttributes_Release(&This->IMXAttributes_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; +} + +static HRESULT WINAPI SAXAttributes_getURI(ISAXAttributes *iface, int nIndex, const WCHAR **pUrl, + int *pUriSize) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%d %p %p): stub\n", This, nIndex, pUrl, pUriSize); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getLocalName(ISAXAttributes *iface, int nIndex, const WCHAR **localName, + int *length) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%d %p %p): stub\n", This, nIndex, localName, length); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getQName(ISAXAttributes *iface, int index, const WCHAR **qname, int *length) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%d %p %p): stub\n", This, index, qname, length); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getName(ISAXAttributes *iface, int nIndex, const WCHAR **pUri, int *pUriLength, + const WCHAR ** pLocalName, int * pLocalNameSize, const WCHAR ** pQName, int * pQNameLength) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%d %p %p %p %p %p %p): stub\n", This, nIndex, pUri, pUriLength, pLocalName, pLocalNameSize, + pQName, pQNameLength); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getIndexFromName(ISAXAttributes *iface, const WCHAR * pUri, int cUriLength, + const WCHAR * pLocalName, int cocalNameLength, int * index) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%s:%d %s:%d %p): stub\n", This, debugstr_wn(pUri, cUriLength), cUriLength, + debugstr_wn(pLocalName, cocalNameLength), cocalNameLength, index); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getIndexFromQName(ISAXAttributes *iface, const WCHAR * pQName, + int nQNameLength, int * index) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%s:%d %p): stub\n", This, debugstr_wn(pQName, nQNameLength), nQNameLength, index); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getType(ISAXAttributes *iface, int nIndex, const WCHAR ** pType, + int * pTypeLength) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%d %p %p): stub\n", This, nIndex, pType, pTypeLength); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getTypeFromName(ISAXAttributes *iface, const WCHAR * pUri, int nUri, + const WCHAR * pLocalName, int nLocalName, const WCHAR ** pType, int * nType) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%s:%d %s:%d %p %p): stub\n", This, debugstr_wn(pUri, nUri), nUri, + debugstr_wn(pLocalName, nLocalName), nLocalName, pType, nType); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getTypeFromQName(ISAXAttributes *iface, const WCHAR * pQName, + int nQName, const WCHAR ** pType, int * nType) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%s:%d %p %p): stub\n", This, debugstr_wn(pQName, nQName), nQName, pType, nType); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getValue(ISAXAttributes *iface, int nIndex, const WCHAR ** pValue, + int * nValue) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%d %p %p): stub\n", This, nIndex, pValue, nValue); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getValueFromName(ISAXAttributes *iface, const WCHAR * pUri, + int nUri, const WCHAR * pLocalName, int nLocalName, const WCHAR ** pValue, int * nValue) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%s:%d %s:%d %p %p): stub\n", This, debugstr_wn(pUri, nUri), nUri, + debugstr_wn(pLocalName, nLocalName), nLocalName, pValue, nValue); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXAttributes_getValueFromQName(ISAXAttributes *iface, const WCHAR * pQName, + int nQName, const WCHAR ** pValue, int * nValue) +{ + mxattributes *This = impl_from_ISAXAttributes( iface ); + FIXME("(%p)->(%s:%d %p %p): stub\n", This, debugstr_wn(pQName, nQName), nQName, pValue, nValue); + return E_NOTIMPL; +} + +static const ISAXAttributesVtbl SAXAttributesVtbl = { + SAXAttributes_QueryInterface, + SAXAttributes_AddRef, + SAXAttributes_Release, + SAXAttributes_getLength, + SAXAttributes_getURI, + SAXAttributes_getLocalName, + SAXAttributes_getQName, + SAXAttributes_getName, + SAXAttributes_getIndexFromName, + SAXAttributes_getIndexFromQName, + SAXAttributes_getType, + SAXAttributes_getTypeFromName, + SAXAttributes_getTypeFromQName, + SAXAttributes_getValue, + SAXAttributes_getValueFromName, + SAXAttributes_getValueFromQName +}; + static const tid_t mxattrs_iface_tids[] = { IMXAttributes_tid, 0 @@ -1662,6 +1815,7 @@ HRESULT SAXAttributes_create(MSXML_VERSION version, IUnknown *outer, void **ppOb return E_OUTOFMEMORY; This->IMXAttributes_iface.lpVtbl = &MXAttributesVtbl; + This->ISAXAttributes_iface.lpVtbl = &SAXAttributesVtbl; This->ref = 1; *ppObj = &This->IMXAttributes_iface; diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 28522d81828..505acafefbf 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -3313,40 +3313,37 @@ static void test_mxattr_addAttribute(void) EXPECT_HR(hr, S_OK); hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr); -todo_wine EXPECT_HR(hr, S_OK); - if (hr != S_OK) - { - IMXAttributes_Release(mxattr); - table++; - i++; - continue; - } /* SAXAttributes30 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)); +todo_wine 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); @@ -3371,56 +3368,64 @@ static void test_mxattr_clear(void) EXPECT_HR(hr, S_OK); hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr); -todo_wine EXPECT_HR(hr, S_OK); - if (hr != S_OK) - { - IMXAttributes_Release(mxattr); - return; - } hr = ISAXAttributes_getQName(saxattr, 0, NULL, NULL); +todo_wine EXPECT_HR(hr, E_INVALIDARG); hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len); +todo_wine EXPECT_HR(hr, E_INVALIDARG); hr = IMXAttributes_addAttribute(mxattr, _bstr_("uri"), _bstr_("local"), _bstr_("qname"), _bstr_("type"), _bstr_("value")); +todo_wine EXPECT_HR(hr, S_OK); 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); +todo_wine EXPECT_HR(hr, E_POINTER); ok(len == -1, "got %d\n", len); ptr = (void*)0xdeadbeef; hr = ISAXAttributes_getQName(saxattr, 0, &ptr, NULL); +todo_wine EXPECT_HR(hr, E_POINTER); ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr); len = 0; hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len); +todo_wine { EXPECT_HR(hr, S_OK); ok(len == 5, "got %d\n", len); - ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr)); + if (hr == S_OK) + ok(!lstrcmpW(ptr, _bstr_("qname")), "got %s\n", wine_dbgstr_w(ptr)); +} hr = IMXAttributes_clear(mxattr); +todo_wine EXPECT_HR(hr, S_OK); len = -1; hr = ISAXAttributes_getLength(saxattr, &len); +todo_wine { EXPECT_HR(hr, S_OK); ok(len == 0, "got %d\n", len); +} len = -1; ptr = (void*)0xdeadbeef; hr = ISAXAttributes_getQName(saxattr, 0, &ptr, &len); +todo_wine EXPECT_HR(hr, E_INVALIDARG); ok(len == -1, "got %d\n", len); ok(ptr == (void*)0xdeadbeef, "got %p\n", ptr); -- 2.11.4.GIT