Also fix uninitialized value in this field for TKIND_DISPATCH.
Signed-off-by: Kevin Puetz PuetzKevinA@JohnDeere.com --- TKIND_UNION previously wrote var_datawidth like TKIND_STRUCT does. But a union's datawidth is the max of the fields, not the sum-so-far, so this described each field as starting just past the end of the union,
TKIND_DISPATCH was just writing the 0x55555555 from xmalloc The field seems to be unused for VAR_DISPATCH, but was 0 in other (non-widl) typelib files I checked, which seems like a reasonable "reserved" value. --- tools/widl/write_msft.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index 7cfe9e146c..23d1dd8652 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -1746,11 +1746,12 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var) typeinfo->datawidth += var_datawidth; break; case TKIND_UNION: - typedata[4] = typeinfo->datawidth; + typedata[4] = 0; typeinfo->datawidth = max(typeinfo->datawidth, var_datawidth); break; case TKIND_DISPATCH: var_kind = 3; /* VAR_DISPATCH */ + typedata[4] = 0; typeinfo->datawidth = pointer_size; break; default: