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

Alexandre Julliard julliard at winehq.org
Wed Sep 19 16:28:12 CDT 2018


Module: wine
Branch: master
Commit: f7c9d08dc753d3b8c8e02d22ca23677a6e79123e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f7c9d08dc753d3b8c8e02d22ca23677a6e79123e

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Sep 19 14:19:29 2018 +0300

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

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/opcservices/tests/opcservices.c | 15 ++++++++++++---
 dlls/opcservices/uri.c               | 16 +++++++++++++++-
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c
index 17b7609..a062176 100644
--- a/dlls/opcservices/tests/opcservices.c
+++ b/dlls/opcservices/tests/opcservices.c
@@ -521,7 +521,7 @@ static void test_rel_part_uri(void)
             IOpcPartUri *rel_uri2;
             IOpcUri *source_uri2;
             IUnknown *unk = NULL;
-            BOOL ret = FALSE;
+            BOOL ret;
             BSTR str;
 
             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);
             ok(SUCCEEDED(hr), "Failed to get source uri, hr %#x.\n", hr);
             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);
-        todo_wine {
             ok(SUCCEEDED(hr), "IsEqual failed, hr %#x.\n", hr);
             ok(ret, "Expected equal uris.\n");
-        }
+
             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);
             if (unk)
diff --git a/dlls/opcservices/uri.c b/dlls/opcservices/uri.c
index ddb2c05..fa5ddbc 100644
--- a/dlls/opcservices/uri.c
+++ b/dlls/opcservices/uri.c
@@ -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);
 
-    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)




More information about the wine-cvs mailing list