Nikolay Sivov : opcservices: Implement IOpcPart::GetRelationshipSet().

Alexandre Julliard julliard at winehq.org
Tue Sep 4 14:04:15 CDT 2018


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Sep  4 08:04:56 2018 +0300

opcservices: Implement IOpcPart::GetRelationshipSet().

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

---

 dlls/opcservices/package.c           | 18 ++++++++++++++++--
 dlls/opcservices/tests/opcservices.c |  9 +++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/dlls/opcservices/package.c b/dlls/opcservices/package.c
index a9b4d14..cd4741d 100644
--- a/dlls/opcservices/package.c
+++ b/dlls/opcservices/package.c
@@ -46,6 +46,7 @@ struct opc_part
     IOpcPartUri *name;
     WCHAR *content_type;
     DWORD compression_options;
+    IOpcRelationshipSet *relationship_set;
 };
 
 struct opc_part_set
@@ -91,6 +92,8 @@ static inline struct opc_relationship *impl_from_IOpcRelationship(IOpcRelationsh
     return CONTAINING_RECORD(iface, struct opc_relationship, IOpcRelationship_iface);
 }
 
+static HRESULT opc_relationship_set_create(IOpcRelationshipSet **relationship_set);
+
 static WCHAR *opc_strdupW(const WCHAR *str)
 {
     WCHAR *ret = NULL;
@@ -143,6 +146,8 @@ static ULONG WINAPI opc_part_Release(IOpcPart *iface)
 
     if (!refcount)
     {
+        if (part->relationship_set)
+            IOpcRelationshipSet_Release(part->relationship_set);
         IOpcPartUri_Release(part->name);
         CoTaskMemFree(part->content_type);
         heap_free(part);
@@ -153,9 +158,18 @@ static ULONG WINAPI opc_part_Release(IOpcPart *iface)
 
 static HRESULT WINAPI opc_part_GetRelationshipSet(IOpcPart *iface, IOpcRelationshipSet **relationship_set)
 {
-    FIXME("iface %p, relationship_set %p stub!\n", iface, relationship_set);
+    struct opc_part *part = impl_from_IOpcPart(iface);
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("iface %p, relationship_set %p.\n", iface, relationship_set);
+
+    if (!part->relationship_set && FAILED(hr = opc_relationship_set_create(&part->relationship_set)))
+        return hr;
+
+    *relationship_set = part->relationship_set;
+    IOpcRelationshipSet_AddRef(*relationship_set);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI opc_part_GetContentStream(IOpcPart *iface, IStream **stream)
diff --git a/dlls/opcservices/tests/opcservices.c b/dlls/opcservices/tests/opcservices.c
index 118ef8f..8ab7f39 100644
--- a/dlls/opcservices/tests/opcservices.c
+++ b/dlls/opcservices/tests/opcservices.c
@@ -74,6 +74,15 @@ static void test_package(void)
     hr = IOpcPartSet_CreatePart(partset, part_uri, typeW, OPC_COMPRESSION_NONE, &part);
     ok(SUCCEEDED(hr), "Failed to create a part, hr %#x.\n", hr);
 
+    hr = IOpcPart_GetRelationshipSet(part, &relset);
+    ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#x.\n", hr);
+
+    hr = IOpcPart_GetRelationshipSet(part, &relset2);
+    ok(SUCCEEDED(hr), "Failed to get relationship set, hr %#x.\n", hr);
+    ok(relset == relset2, "Expected same part set instance.\n");
+    IOpcRelationshipSet_Release(relset);
+    IOpcRelationshipSet_Release(relset2);
+
     ret = FALSE;
     hr = IOpcPartSet_PartExists(partset, part_uri, &ret);
 todo_wine {




More information about the wine-cvs mailing list