Dmitry Timoshkov : widl: Do not create duplicate type info entries when tag and typedef names are the same.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 6 09:43:58 CDT 2015


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Mon Oct  5 20:36:02 2015 +0800

widl: Do not create duplicate type info entries when tag and typedef names are the same.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>

---

 dlls/winhttp/tests/winhttp.c |  1 -
 tools/widl/write_msft.c      | 33 ++++++++++++++++++++++-----------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index e221809..bd6b47f 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -3780,7 +3780,6 @@ todo_wine
     VariantInit(&ret);
     hr = IWinHttpRequest_Invoke(request, DISPID_HTTPREQUEST_SETAUTOLOGONPOLICY, &IID_NULL, 0,
                                 DISPATCH_METHOD, &params, &ret, NULL, NULL);
-todo_wine
     ok(hr == S_OK, "error %#x\n", hr);
 
     IWinHttpRequest_Release(request);
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 26600e4..a39e986 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -1836,7 +1836,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
     MSFT_TypeInfoBase *typeinfo;
     MSFT_GuidEntry guidentry;
 
-    chat("create_msft_typeinfo: name %s kind %d\n", name, kind);
+    chat("create_msft_typeinfo: name %s kind %d index %d\n", name, kind, typelib->typelib_header.nrtypeinfos);
 
     msft_typeinfo = xmalloc(sizeof(*msft_typeinfo));
     memset( msft_typeinfo, 0, sizeof(*msft_typeinfo) );
@@ -2143,20 +2143,31 @@ static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
 
 static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
 {
-    msft_typeinfo_t *msft_typeinfo;
-    int alignment;
+    msft_typeinfo_t *msft_typeinfo = NULL;
+    int alignment, datatype1, datatype2, size;
+    type_t *type;
 
     if (-1 < tdef->typelib_idx)
         return;
 
-    tdef->typelib_idx = typelib->typelib_header.nrtypeinfos;
-    msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs);
-    encode_type(typelib, get_type_vt(type_alias_get_aliasee(tdef)),
-                type_alias_get_aliasee(tdef),
-                &msft_typeinfo->typeinfo->datatype1,
-                &msft_typeinfo->typeinfo->size,
-                &alignment, &msft_typeinfo->typeinfo->datatype2);
-    msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
+    type = type_alias_get_aliasee(tdef);
+
+    if (!type->name || strcmp(tdef->name, type->name) != 0)
+    {
+        tdef->typelib_idx = typelib->typelib_header.nrtypeinfos;
+        msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs);
+    }
+
+    encode_type(typelib, get_type_vt(type), type,
+                &datatype1, &size, &alignment, &datatype2);
+
+    if (msft_typeinfo)
+    {
+        msft_typeinfo->typeinfo->datatype1 = datatype1;
+        msft_typeinfo->typeinfo->size = size;
+        msft_typeinfo->typeinfo->datatype2 = datatype2;
+        msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6);
+    }
 }
 
 static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)




More information about the wine-cvs mailing list