xmllite/reader: Fix IID argument handling in CreateXmlReader().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d5d863597d
commit
d1e14576bb
|
@ -3603,16 +3603,11 @@ static const struct IUnknownVtbl xmlreaderinputvtbl =
|
|||
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
|
||||
{
|
||||
xmlreader *reader;
|
||||
HRESULT hr;
|
||||
int i;
|
||||
|
||||
TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc);
|
||||
|
||||
if (!IsEqualGUID(riid, &IID_IXmlReader))
|
||||
{
|
||||
ERR("Unexpected IID requested -> (%s)\n", wine_dbgstr_guid(riid));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (imalloc)
|
||||
reader = IMalloc_Alloc(imalloc, sizeof(*reader));
|
||||
else
|
||||
|
@ -3640,11 +3635,12 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
|
|||
for (i = 0; i < StringValue_Last; i++)
|
||||
reader->strvalues[i] = strval_empty;
|
||||
|
||||
*obj = &reader->IXmlReader_iface;
|
||||
hr = IXmlReader_QueryInterface(&reader->IXmlReader_iface, riid, obj);
|
||||
IXmlReader_Release(&reader->IXmlReader_iface);
|
||||
|
||||
TRACE("returning iface %p\n", *obj);
|
||||
TRACE("returning iface %p, hr %#x\n", *obj, hr);
|
||||
|
||||
return S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream,
|
||||
|
|
|
@ -536,11 +536,11 @@ static IXmlResolver testresolver = { &resolvervtbl };
|
|||
static void test_reader_create(void)
|
||||
{
|
||||
IXmlResolver *resolver;
|
||||
HRESULT hr;
|
||||
IUnknown *input, *unk;
|
||||
IXmlReader *reader;
|
||||
IUnknown *input;
|
||||
DtdProcessing dtd;
|
||||
XmlNodeType nodetype;
|
||||
HRESULT hr;
|
||||
|
||||
/* crashes native */
|
||||
if (0)
|
||||
|
@ -549,6 +549,21 @@ static void test_reader_create(void)
|
|||
CreateXmlReader(NULL, (void**)&reader, NULL);
|
||||
}
|
||||
|
||||
hr = CreateXmlReader(&IID_IStream, (void **)&unk, NULL);
|
||||
ok(hr == E_NOINTERFACE, "got %08x\n", hr);
|
||||
|
||||
hr = CreateXmlReader(&IID_IUnknown, (void **)&unk, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
hr = IUnknown_QueryInterface(unk, &IID_IXmlReader, (void **)&reader);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(unk == (IUnknown *)reader, "unexpected interface\n");
|
||||
IXmlReader_Release(reader);
|
||||
IUnknown_Release(unk);
|
||||
|
||||
hr = CreateXmlReader(&IID_IUnknown, (void **)&reader, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
IXmlReader_Release(reader);
|
||||
|
||||
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue