xmllite/writer: Fix IID argument handling in CreateXmlWriter().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d1e14576bb
commit
707ab559e5
|
@ -237,6 +237,7 @@ static void test_writer_create(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IXmlWriter *writer;
|
IXmlWriter *writer;
|
||||||
LONG_PTR value;
|
LONG_PTR value;
|
||||||
|
IUnknown *unk;
|
||||||
|
|
||||||
/* crashes native */
|
/* crashes native */
|
||||||
if (0)
|
if (0)
|
||||||
|
@ -245,6 +246,17 @@ static void test_writer_create(void)
|
||||||
CreateXmlWriter(NULL, (void**)&writer, NULL);
|
CreateXmlWriter(NULL, (void**)&writer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = CreateXmlWriter(&IID_IStream, (void **)&unk, NULL);
|
||||||
|
ok(hr == E_NOINTERFACE, "got %08x\n", hr);
|
||||||
|
|
||||||
|
hr = CreateXmlWriter(&IID_IUnknown, (void **)&unk, NULL);
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
hr = IUnknown_QueryInterface(unk, &IID_IXmlWriter, (void **)&writer);
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
ok(unk == (IUnknown *)writer, "unexpected interface pointer\n");
|
||||||
|
IUnknown_Release(unk);
|
||||||
|
IXmlWriter_Release(writer);
|
||||||
|
|
||||||
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
|
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
|
||||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
|
||||||
|
|
|
@ -458,11 +458,17 @@ static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, v
|
||||||
|
|
||||||
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
if (IsEqualGUID(riid, &IID_IXmlWriter) ||
|
||||||
IsEqualGUID(riid, &IID_IXmlWriter))
|
IsEqualGUID(riid, &IID_IUnknown))
|
||||||
{
|
{
|
||||||
*ppvObject = iface;
|
*ppvObject = iface;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FIXME("interface %s is not supported\n", debugstr_guid(riid));
|
||||||
|
*ppvObject = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
IXmlWriter_AddRef(iface);
|
IXmlWriter_AddRef(iface);
|
||||||
|
|
||||||
|
@ -1393,15 +1399,10 @@ static const struct IUnknownVtbl xmlwriteroutputvtbl =
|
||||||
HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
|
HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
|
||||||
{
|
{
|
||||||
xmlwriter *writer;
|
xmlwriter *writer;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
|
TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
|
||||||
|
|
||||||
if (!IsEqualGUID(riid, &IID_IXmlWriter))
|
|
||||||
{
|
|
||||||
ERR("Unexpected IID requested -> (%s)\n", wine_dbgstr_guid(riid));
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imalloc)
|
if (imalloc)
|
||||||
writer = IMalloc_Alloc(imalloc, sizeof(*writer));
|
writer = IMalloc_Alloc(imalloc, sizeof(*writer));
|
||||||
else
|
else
|
||||||
|
@ -1423,11 +1424,12 @@ HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
|
||||||
writer->starttagopen = FALSE;
|
writer->starttagopen = FALSE;
|
||||||
list_init(&writer->elements);
|
list_init(&writer->elements);
|
||||||
|
|
||||||
*obj = &writer->IXmlWriter_iface;
|
hr = IXmlWriter_QueryInterface(&writer->IXmlWriter_iface, riid, obj);
|
||||||
|
IXmlWriter_Release(&writer->IXmlWriter_iface);
|
||||||
|
|
||||||
TRACE("returning iface %p\n", *obj);
|
TRACE("returning iface %p, hr %#x\n", *obj, hr);
|
||||||
|
|
||||||
return S_OK;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding,
|
static HRESULT create_writer_output(IUnknown *stream, IMalloc *imalloc, xml_encoding encoding,
|
||||||
|
|
Loading…
Reference in New Issue