Commit bb47bab7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Store output stream for processor.

parent 392934af
...@@ -51,6 +51,7 @@ typedef struct _xslprocessor ...@@ -51,6 +51,7 @@ typedef struct _xslprocessor
LONG ref; LONG ref;
IXMLDOMNode *input; IXMLDOMNode *input;
IStream *output;
} xslprocessor; } xslprocessor;
static HRESULT XSLProcessor_create(IXSLProcessor**); static HRESULT XSLProcessor_create(IXSLProcessor**);
...@@ -306,6 +307,7 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface ) ...@@ -306,6 +307,7 @@ static ULONG WINAPI xslprocessor_Release( IXSLProcessor *iface )
if ( ref == 0 ) if ( ref == 0 )
{ {
if (This->input) IXMLDOMNode_Release(This->input); if (This->input) IXMLDOMNode_Release(This->input);
if (This->output) IStream_Release(This->output);
heap_free( This ); heap_free( This );
} }
...@@ -475,9 +477,31 @@ static HRESULT WINAPI xslprocessor_put_output( ...@@ -475,9 +477,31 @@ static HRESULT WINAPI xslprocessor_put_output(
VARIANT output) VARIANT output)
{ {
xslprocessor *This = impl_from_IXSLProcessor( iface ); xslprocessor *This = impl_from_IXSLProcessor( iface );
IStream *stream;
HRESULT hr;
FIXME("(%p): stub\n", This); FIXME("(%p)->(%s): semi-stub\n", This, debugstr_variant(&output));
return E_NOTIMPL;
switch (V_VT(&output))
{
case VT_EMPTY:
stream = NULL;
hr = S_OK;
break;
case VT_UNKNOWN:
hr = IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IStream, (void**)&stream);
break;
default:
hr = E_FAIL;
}
if (hr == S_OK)
{
if (This->output) IStream_Release(This->output);
This->output = stream;
}
return hr;
} }
static HRESULT WINAPI xslprocessor_get_output( static HRESULT WINAPI xslprocessor_get_output(
...@@ -590,6 +614,7 @@ HRESULT XSLProcessor_create(IXSLProcessor **ppObj) ...@@ -590,6 +614,7 @@ HRESULT XSLProcessor_create(IXSLProcessor **ppObj)
This->IXSLProcessor_iface.lpVtbl = &xslprocessor_vtbl; This->IXSLProcessor_iface.lpVtbl = &xslprocessor_vtbl;
This->ref = 1; This->ref = 1;
This->input = NULL; This->input = NULL;
This->output = NULL;
*ppObj = &This->IXSLProcessor_iface; *ppObj = &This->IXSLProcessor_iface;
......
...@@ -7663,9 +7663,10 @@ static void test_xsltemplate(void) ...@@ -7663,9 +7663,10 @@ static void test_xsltemplate(void)
IXSLTemplate *template; IXSLTemplate *template;
IXSLProcessor *processor; IXSLProcessor *processor;
IXMLDOMDocument *doc; IXMLDOMDocument *doc;
IStream *stream;
VARIANT_BOOL b; VARIANT_BOOL b;
HRESULT hr; HRESULT hr;
ULONG ref1, ref2; ULONG ref1, ref2, ref;
VARIANT v; VARIANT v;
template = create_xsltemplate(&IID_IXSLTemplate); template = create_xsltemplate(&IID_IXSLTemplate);
...@@ -7734,6 +7735,37 @@ todo_wine { ...@@ -7734,6 +7735,37 @@ todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(V_VT(&v) == VT_EMPTY, "got %d\n", V_VT(&v)); ok(V_VT(&v) == VT_EMPTY, "got %d\n", V_VT(&v));
} }
/* reset before it was set */
V_VT(&v) = VT_EMPTY;
hr = IXSLProcessor_put_output(processor, v);
ok(hr == S_OK, "got 0x%08x\n", hr);
CreateStreamOnHGlobal(NULL, TRUE, &stream);
ref = IStream_AddRef(stream);
IStream_Release(stream);
ok(ref == 2, "got %d\n", ref);
V_VT(&v) = VT_UNKNOWN;
V_UNKNOWN(&v) = (IUnknown*)stream;
hr = IXSLProcessor_put_output(processor, v);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* it seems processor grabs 2 references */
ref = IStream_AddRef(stream);
IStream_Release(stream);
todo_wine ok(ref == 4, "got %d\n", ref);
/* reset and check stream refcount */
V_VT(&v) = VT_EMPTY;
hr = IXSLProcessor_put_output(processor, v);
ok(hr == S_OK, "got 0x%08x\n", hr);
ref = IStream_AddRef(stream);
IStream_Release(stream);
ok(ref == 2, "got %d\n", ref);
IStream_Release(stream);
IXSLProcessor_Release(processor); IXSLProcessor_Release(processor);
/* drop reference */ /* drop reference */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment