Dmitry Timoshkov : widl: Avoid adding duplicate type definitions if tag and typedef names are the same.
Module: wine Branch: master Commit: f7581c763d5789a165527c12d1bc2bf1368c4f7b URL: http://source.winehq.org/git/wine.git/?a=commit;h=f7581c763d5789a165527c12d1... Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Nov 3 13:28:53 2015 +0800 widl: Avoid adding duplicate type definitions if tag and typedef names are the same. Fix handing of the following .idl snippet: typedef [uuid(b14b6bb5-904e-4ff9-b247-bd361f7a0001)] struct g { int g1; } g; [uuid(b14b6bb5-904e-4ff9-b247-bd361f7a0002)] interface test_iface : IUnknown { HRESULT test([in] g *ptr); } Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/write_msft.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index daa0366..3cbae92 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -2181,7 +2181,7 @@ static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion) static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef) { msft_typeinfo_t *msft_typeinfo = NULL; - int alignment, datatype1, datatype2, size; + int alignment, datatype1, datatype2, size, duplicate = 0; type_t *type; if (-1 < tdef->typelib_idx) @@ -2194,6 +2194,8 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef) tdef->typelib_idx = typelib->typelib_header.nrtypeinfos; msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ALIAS, tdef->name, tdef->attrs); } + else + duplicate = 1; encode_type(typelib, get_type_vt(type), type, &datatype1, &size, &alignment, &datatype2); @@ -2205,6 +2207,10 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef) msft_typeinfo->typeinfo->datatype2 = datatype2; msft_typeinfo->typeinfo->typekind |= (alignment << 11 | alignment << 6); } + + /* avoid adding duplicate type definitions */ + if (duplicate) + tdef->typelib_idx = type->typelib_idx; } static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
participants (1)
-
Alexandre Julliard