[PATCH 3/5] Basic put_input() method for IXSLProcessor
Nikolay Sivov
nsivov at codeweavers.com
Sun Feb 13 05:54:38 CST 2011
---
dlls/msxml3/stylesheet.c | 33 +++++++++++++++++++++++++++++++--
dlls/msxml3/tests/domdoc.c | 10 ++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/stylesheet.c b/dlls/msxml3/stylesheet.c
index 1add7db..5dae396 100644
--- a/dlls/msxml3/stylesheet.c
+++ b/dlls/msxml3/stylesheet.c
@@ -49,6 +49,8 @@ typedef struct _xslprocessor
{
IXSLProcessor IXSLProcessor_iface;
LONG ref;
+
+ IXMLDOMNode *input;
} xslprocessor;
static HRESULT XSLProcessor_create(IXSLProcessor**);
@@ -302,7 +304,10 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface )
ref = InterlockedDecrement( &This->ref );
if ( ref == 0 )
+ {
+ if (This->input) IXMLDOMNode_Release(This->input);
heap_free( This );
+ }
return ref;
}
@@ -381,9 +386,32 @@ static HRESULT WINAPI xslprocessor_Invoke(
static HRESULT WINAPI xslprocessor_put_input( IXSLProcessor *iface, VARIANT input )
{
xslprocessor *This = impl_from_IXSLProcessor( iface );
+ IXMLDOMNode *old_input = This->input;
+ HRESULT hr;
- FIXME("(%p): stub\n", This);
- return E_NOTIMPL;
+ TRACE("(%p)->(type=%d)\n", This, V_VT(&input));
+
+ /* try IXMLDOMNode directly first */
+ if (V_VT(&input) == VT_UNKNOWN)
+ hr = IUnknown_QueryInterface(V_UNKNOWN(&input), &IID_IXMLDOMNode, (void**)&This->input);
+ else if (V_VT(&input) == VT_DISPATCH)
+ hr = IDispatch_QueryInterface(V_DISPATCH(&input), &IID_IXMLDOMNode, (void**)&This->input);
+
+ if (hr != S_OK)
+ {
+ IXMLDOMDocument *doc;
+
+ hr = DOMDocument_create(&CLSID_DOMDocument, NULL, (void**)&doc);
+ if (hr == S_OK)
+ {
+ hr = IXMLDOMDocument_QueryInterface(doc, &IID_IXMLDOMNode, (void**)&This->input);
+ IXMLDOMDocument_Release(doc);
+ }
+ }
+
+ if (hr == S_OK && old_input) IXMLDOMNode_Release(old_input);
+
+ return hr;
}
static HRESULT WINAPI xslprocessor_get_input( IXSLProcessor *iface, VARIANT *input )
@@ -554,6 +582,7 @@ HRESULT XSLProcessor_create(IXSLProcessor **ppObj)
This->IXSLProcessor_iface.lpVtbl = &xslprocessor_vtbl;
This->ref = 1;
+ This->input = NULL;
*ppObj = &This->IXSLProcessor_iface;
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index b4dc2e1..0c8fff2 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -7666,6 +7666,7 @@ static void test_xsltemplate(void)
VARIANT_BOOL b;
HRESULT hr;
ULONG ref1, ref2;
+ VARIANT v;
template = create_xsltemplate(&IID_IXSLTemplate);
if (!template) return;
@@ -7724,6 +7725,15 @@ static void test_xsltemplate(void)
hr = IXSLTemplate_createProcessor(template, &processor);
ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ /* input no set yet */
+ V_VT(&v) = VT_BSTR;
+ V_BSTR(&v) = NULL;
+ hr = IXSLProcessor_get_input(processor, &v);
+todo_wine {
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(V_VT(&v) == VT_EMPTY, "got %d\n", V_VT(&v));
+}
IXSLProcessor_Release(processor);
/* drop reference */
--
1.5.6.5
--------------020306020107040104010507--
More information about the wine-patches
mailing list