[1/6] widl: Avoid warnings when being added dispatch guids already present in a typelib.

Dmitry Timoshkov dmitry at baikal.ru
Mon Oct 26 23:40:43 CDT 2015


This patch silences warnings about adding a duplicate uuid when generating
stdol2.tlb.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 tools/widl/write_msft.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index fc0eae7..4957a26 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -1978,7 +1978,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
 
 static void add_dispatch(msft_typelib_t *typelib)
 {
-    int guid_offset, impfile_offset;
+    int guid_offset, impfile_offset, hash_key;
     MSFT_GuidEntry guidentry;
     MSFT_ImpInfo impinfo;
     GUID stdole =        {0x00020430,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
@@ -1989,7 +1989,10 @@ static void add_dispatch(msft_typelib_t *typelib)
     guidentry.guid = stdole;
     guidentry.hreftype = 2;
     guidentry.next_hash = -1;
-    guid_offset = ctl2_alloc_guid(typelib, &guidentry);
+    hash_key = ctl2_hash_guid(&guidentry.guid);
+    guid_offset = ctl2_find_guid(typelib, hash_key, &guidentry.guid);
+    if (guid_offset == -1)
+        guid_offset = ctl2_alloc_guid(typelib, &guidentry);
     impfile_offset = alloc_importfile(typelib, guid_offset, 2, 0, "stdole2.tlb");
 
     guidentry.guid = iid_idispatch;
@@ -1997,7 +2000,11 @@ static void add_dispatch(msft_typelib_t *typelib)
     guidentry.next_hash = -1;
     impinfo.flags = TKIND_INTERFACE << 24 | MSFT_IMPINFO_OFFSET_IS_GUID;
     impinfo.oImpFile = impfile_offset;
-    impinfo.oGuid = ctl2_alloc_guid(typelib, &guidentry);
+    hash_key = ctl2_hash_guid(&guidentry.guid);
+    guid_offset = ctl2_find_guid(typelib, hash_key, &guidentry.guid);
+    if (guid_offset == -1)
+        guid_offset = ctl2_alloc_guid(typelib, &guidentry);
+    impinfo.oGuid = guid_offset;
     typelib->typelib_header.dispatchpos = alloc_msft_importinfo(typelib, &impinfo) | 0x01;
 }
 
-- 
2.6.2




More information about the wine-patches mailing list