opcservices/uri: Fix IsEqual() to work with OPC URI objects.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-09-19 14:19:29 +03:00 committed by Alexandre Julliard
parent 06fd9bb317
commit f7c9d08dc7
2 changed files with 27 additions and 4 deletions

View File

@ -521,7 +521,7 @@ static void test_rel_part_uri(void)
IOpcPartUri *rel_uri2; IOpcPartUri *rel_uri2;
IOpcUri *source_uri2; IOpcUri *source_uri2;
IUnknown *unk = NULL; IUnknown *unk = NULL;
BOOL ret = FALSE; BOOL ret;
BSTR str; BSTR str;
hr = IOpcPartUri_GetSourceUri(rel_uri, &source_uri); hr = IOpcPartUri_GetSourceUri(rel_uri, &source_uri);
@ -529,11 +529,20 @@ static void test_rel_part_uri(void)
hr = IOpcPartUri_GetSourceUri(rel_uri, &source_uri2); hr = IOpcPartUri_GetSourceUri(rel_uri, &source_uri2);
ok(SUCCEEDED(hr), "Failed to get source uri, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to get source uri, hr %#x.\n", hr);
ok(source_uri != source_uri2, "Unexpected instance.\n"); ok(source_uri != source_uri2, "Unexpected instance.\n");
hr = IOpcUri_IsEqual(source_uri, NULL, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
ret = 123;
hr = IOpcUri_IsEqual(source_uri, NULL, &ret);
ok(is_root ? hr == E_POINTER : hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(is_root ? ret == 123 : !ret, "Unexpected result.\n");
ret = FALSE;
hr = IOpcUri_IsEqual(source_uri, (IUri *)source_uri2, &ret); hr = IOpcUri_IsEqual(source_uri, (IUri *)source_uri2, &ret);
todo_wine {
ok(SUCCEEDED(hr), "IsEqual failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "IsEqual failed, hr %#x.\n", hr);
ok(ret, "Expected equal uris.\n"); ok(ret, "Expected equal uris.\n");
}
hr = IOpcUri_QueryInterface(source_uri, &IID_IOpcPartUri, (void **)&unk); hr = IOpcUri_QueryInterface(source_uri, &IID_IOpcPartUri, (void **)&unk);
ok(hr == (is_root ? E_NOINTERFACE : S_OK), "Unexpected hr %#x, %s.\n", hr, rel_part_uri_tests[i].uri); ok(hr == (is_root ? E_NOINTERFACE : S_OK), "Unexpected hr %#x, %s.\n", hr, rel_part_uri_tests[i].uri);
if (unk) if (unk)

View File

@ -312,7 +312,21 @@ static HRESULT WINAPI opc_uri_IsEqual(IOpcPartUri *iface, IUri *comparand, BOOL
TRACE("iface %p, comparand %p, is_equal %p.\n", iface, comparand, is_equal); TRACE("iface %p, comparand %p, is_equal %p.\n", iface, comparand, is_equal);
return IUri_IsEqual(uri->uri, comparand, is_equal); if (!is_equal)
return E_POINTER;
if (!comparand)
{
if (uri->is_part_uri)
{
*is_equal = FALSE;
return S_OK;
}
return E_POINTER;
}
return IUri_IsEqual(comparand, uri->uri, is_equal);
} }
static HRESULT WINAPI opc_uri_GetRelationshipsPartUri(IOpcPartUri *iface, IOpcPartUri **part_uri) static HRESULT WINAPI opc_uri_GetRelationshipsPartUri(IOpcPartUri *iface, IOpcPartUri **part_uri)