Dmitry Timoshkov : widl: Avoid warnings when being added dispatch guids already present in a typelib.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 2 09:47:15 CST 2015


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Sat Oct 31 14:31:32 2015 +0800

widl: Avoid warnings when being added dispatch guids already present in a typelib.

Silence warnings about adding a duplicate uuid when generating
stdole2.tlb.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 98081f2..daa0366 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;
 }
 




More information about the wine-cvs mailing list