Zebediah Figura : widl: Generate correct alignment for encapsulated union tags.
Alexandre Julliard
julliard at winehq.org
Thu Apr 12 15:28:13 CDT 2018
Module: wine
Branch: master
Commit: 6c942496a9f4388f28591d8e583de30d0389dbba
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6c942496a9f4388f28591d8e583de30d0389dbba
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Tue Apr 10 20:30:26 2018 -0500
widl: Generate correct alignment for encapsulated union tags.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/widl/typegen.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index e63600c..27855cc 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -3276,6 +3276,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
{
const var_t *sv = type_union_get_switch_value(type);
const type_t *st = sv->type;
+ unsigned int align = 0;
unsigned char fc;
if (type_get_type(st) == TYPE_BASIC)
@@ -3303,9 +3304,16 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
else
error("union switch type must be an integer, char, or enum\n");
+ type_memsize_and_alignment(st, &align);
+ if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry)
+ {
+ if (f->type)
+ type_memsize_and_alignment(f->type, &align);
+ }
+
print_file(file, 2, "0x%x,\t/* FC_ENCAPSULATED_UNION */\n", RPC_FC_ENCAPSULATED_UNION);
print_file(file, 2, "0x%x,\t/* Switch type= %s */\n",
- 0x40 | fc, string_of_type(fc));
+ (align << 4) | fc, string_of_type(fc));
*tfsoff += 2;
}
else if (is_attr(type->attrs, ATTR_SWITCHTYPE))
More information about the wine-cvs
mailing list