msxml3: Return stream reference from get_output() if stream is set.
This commit is contained in:
parent
729afb18fe
commit
6ab3f1ae99
|
@ -755,6 +755,8 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest)
|
|||
|
||||
TRACE("(%p)->(%p)\n", This, dest);
|
||||
|
||||
if (!dest) return E_POINTER;
|
||||
|
||||
if (!This->dest)
|
||||
{
|
||||
HRESULT hr = flush_output_buffer(This);
|
||||
|
@ -766,10 +768,13 @@ static HRESULT WINAPI mxwriter_get_output(IMXWriter *iface, VARIANT *dest)
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
FIXME("not implemented when stream is set up\n");
|
||||
|
||||
return E_NOTIMPL;
|
||||
/* we only support IStream output so far */
|
||||
V_VT(dest) = VT_UNKNOWN;
|
||||
V_UNKNOWN(dest) = (IUnknown*)This->dest;
|
||||
IStream_AddRef(This->dest);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI mxwriter_put_encoding(IMXWriter *iface, BSTR encoding)
|
||||
|
|
|
@ -2821,6 +2821,7 @@ static void test_mxwriter_flush(void)
|
|||
VARIANT dest;
|
||||
HRESULT hr;
|
||||
char *buff;
|
||||
LONG ref;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IMXWriter, (void**)&writer);
|
||||
|
@ -2930,6 +2931,18 @@ static void test_mxwriter_flush(void)
|
|||
todo_wine
|
||||
ok(pos2.QuadPart != 0, "unexpected stream beginning\n");
|
||||
|
||||
hr = IMXWriter_get_output(writer, NULL);
|
||||
EXPECT_HR(hr, E_POINTER);
|
||||
|
||||
ref = get_refcount(stream);
|
||||
V_VT(&dest) = VT_EMPTY;
|
||||
hr = IMXWriter_get_output(writer, &dest);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
ok(V_VT(&dest) == VT_UNKNOWN, "got vt type %d\n", V_VT(&dest));
|
||||
ok(V_UNKNOWN(&dest) == (IUnknown*)stream, "got pointer %p\n", V_UNKNOWN(&dest));
|
||||
ok(ref+1 == get_refcount(stream), "expected increased refcount\n");
|
||||
VariantClear(&dest);
|
||||
|
||||
hr = ISAXContentHandler_endDocument(content);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
||||
|
|
Loading…
Reference in New Issue