Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/oleaut32/tests/typelib.c | 66 ++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 17 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index f4ad8f9..e4fe91e 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -3964,6 +3964,38 @@ static char *print_size(BSTR name, TYPEATTR *attr) return buf; }
+static char *print_align(BSTR name, TYPEATTR *attr) +{ + static char buf[256]; + + switch (attr->typekind) + { + case TKIND_DISPATCH: + case TKIND_INTERFACE: + sprintf(buf, "TYPE_ALIGNMENT(%s*)", dump_string(name)); + break; + + case TKIND_RECORD: + sprintf(buf, "TYPE_ALIGNMENT(struct %s)", dump_string(name)); + break; + + case TKIND_UNION: + sprintf(buf, "TYPE_ALIGNMENT(union %s)", dump_string(name)); + break; + + case TKIND_ENUM: + case TKIND_ALIAS: + sprintf(buf, "4"); + break; + + default: + assert(0); + return NULL; + } + + return buf; +} + static const char *dump_param_flags(DWORD flags) { static char buf[256]; @@ -4072,10 +4104,10 @@ static void test_dump_typelib(const char *name)
printf(" "%s",\n", wine_dbgstr_guid(&attr->guid));
- printf(" /*kind*/ %s, /*flags*/ %s, /*align*/ %d, /*size*/ %s,\n" + printf(" /*kind*/ %s, /*flags*/ %s, /*align*/ %s, /*size*/ %s,\n" " /*helpctx*/ 0x%04x, /*version*/ 0x%08x, /*#vtbl*/ %d, /*#func*/ %d", map_value(attr->typekind, tkind_map), dump_type_flags(attr->wTypeFlags), - attr->cbAlignment, print_size(name, attr), + print_align(name, attr), print_size(name, attr), help_ctx, MAKELONG(attr->wMinorVerNum, attr->wMajorVerNum), attr->cbSizeVft/sizeof(void*), attr->cFuncs);
@@ -4175,13 +4207,13 @@ static const type_info info[] = { { "g", "{b14b6bb5-904e-4ff9-b247-bd361f7a0001}", - /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct g), + /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct g), /*size*/ sizeof(struct g), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { "test_iface", "{b14b6bb5-904e-4ff9-b247-bd361f7a0002}", - /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(test_iface*), + /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(test_iface*), /*size*/ sizeof(test_iface*), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1, { { @@ -4203,7 +4235,7 @@ static const type_info info[] = { { "parent_iface", "{b14b6bb5-904e-4ff9-b247-bd361f7aa001}", - /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(parent_iface*), + /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(parent_iface*), /*size*/ sizeof(parent_iface*), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1, { { @@ -4225,7 +4257,7 @@ static const type_info info[] = { { "child_iface", "{b14b6bb5-904e-4ff9-b247-bd361f7aa002}", - /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(child_iface*), + /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(child_iface*), /*size*/ sizeof(child_iface*), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 5, /*#func*/ 1, { { @@ -4245,7 +4277,7 @@ static const type_info info[] = { { "_n", "{016fe2ec-b2c8-45f8-b23b-39e53a753903}", - /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct _n), + /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct _n), /*size*/ sizeof(struct _n), /*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0 }, { @@ -4263,7 +4295,7 @@ static const type_info info[] = { { "_m", "{016fe2ec-b2c8-45f8-b23b-39e53a753906}", - /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct _m), + /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct _m), /*size*/ sizeof(struct _m), /*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { @@ -4281,7 +4313,7 @@ static const type_info info[] = { { "IDualIface", "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}", - /*kind*/ TKIND_DISPATCH, /*flags*/ TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL, /*align*/ 4, /*size*/ sizeof(IDualIface*), + /*kind*/ TKIND_DISPATCH, /*flags*/ TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL, /*align*/ TYPE_ALIGNMENT(IDualIface*), /*size*/ sizeof(IDualIface*), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 8, { { @@ -4423,7 +4455,7 @@ static const type_info info[] = { { "ISimpleIface", "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}", - /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ 4, /*size*/ sizeof(ISimpleIface*), + /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ TYPE_ALIGNMENT(ISimpleIface*), /*size*/ sizeof(ISimpleIface*), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, { { @@ -4443,13 +4475,13 @@ static const type_info info[] = { { "test_struct", "{4029f190-ca4a-4611-aeb9-673983cb96dd}", - /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct), + /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct test_struct), /*size*/ sizeof(struct test_struct), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { "test_struct2", "{4029f190-ca4a-4611-aeb9-673983cb96de}", - /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct2), + /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct test_struct2), /*size*/ sizeof(struct test_struct2), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { @@ -4533,13 +4565,13 @@ static const type_info info[] = { { "_e", "{00000000-0000-0000-0000-000000000000}", - /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(struct _e), + /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(struct _e), /*size*/ sizeof(struct _e), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { "ee", "{016fe2ec-b2c8-45f8-b23b-39e53a753971}", - /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(struct ee), + /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(struct ee), /*size*/ sizeof(struct ee), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { @@ -4551,19 +4583,19 @@ static const type_info info[] = { { "_f", "{00000000-0000-0000-0000-000000000000}", - /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(union _f), + /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(union _f), /*size*/ sizeof(union _f), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { "ff", "{016fe2ec-b2c8-45f8-b23b-39e53a753973}", - /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(union ff), + /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(union ff), /*size*/ sizeof(union ff), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0 }, { "ITestIface", "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac00a}", - /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ 4, /*size*/ sizeof(ITestIface*), + /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ TYPE_ALIGNMENT(ITestIface*), /*size*/ sizeof(ITestIface*), /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 13, /*#func*/ 6, { {