diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index c35020c90ad..60668ddc36a 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -202,6 +202,30 @@ static unsigned char get_enum_fc(const type_t *type) return RPC_FC_ENUM16; } +static type_t *get_user_type(const type_t *t, const char **pname) +{ + for (;;) + { + type_t *ut = get_attrp(t->attrs, ATTR_WIREMARSHAL); + if (ut) + { + if (pname) + *pname = t->name; + return ut; + } + + if (type_is_alias(t)) + t = type_alias_get_aliasee(t); + else + return NULL; + } +} + +static int is_user_type(const type_t *t) +{ + return get_user_type(t, NULL) != NULL; +} + enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags) { if (is_user_type(type)) @@ -252,6 +276,29 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att return TGT_INVALID; } +static int get_padding(const var_list_t *fields) +{ + unsigned short offset = 0; + unsigned int salign = 1; + const var_t *f; + + if (!fields) + return 0; + + LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry) + { + type_t *ft = f->type; + unsigned int align = 0; + unsigned int size = type_memsize(ft, &align); + align = clamp_align(align); + if (align > salign) salign = align; + offset = ROUND_SIZE(offset, align); + offset += size; + } + + return ROUNDING(offset, salign); +} + unsigned char get_struct_fc(const type_t *type) { int has_pointer = 0; @@ -472,22 +519,6 @@ static unsigned char get_array_fc(const type_t *type) return fc; } -int is_struct(unsigned char type) -{ - switch (type) - { - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: - return 1; - default: - return 0; - } -} - static int is_non_complex_struct(const type_t *type) { return (type_get_type(type) == TYPE_STRUCT && @@ -626,30 +657,6 @@ static void guard_rec(type_t *type) type->typestring_offset = 1; } -static type_t *get_user_type(const type_t *t, const char **pname) -{ - for (;;) - { - type_t *ut = get_attrp(t->attrs, ATTR_WIREMARSHAL); - if (ut) - { - if (pname) - *pname = t->name; - return ut; - } - - if (type_is_alias(t)) - t = type_alias_get_aliasee(t); - else - return NULL; - } -} - -int is_user_type(const type_t *t) -{ - return get_user_type(t, NULL) != NULL; -} - static int is_embedded_complex(const type_t *type) { switch (typegen_detect_type(type, NULL, TDT_ALL_TYPES)) @@ -1177,29 +1184,6 @@ static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa) return maxs; } -int get_padding(const var_list_t *fields) -{ - unsigned short offset = 0; - unsigned int salign = 1; - const var_t *f; - - if (!fields) - return 0; - - LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry) - { - type_t *ft = f->type; - unsigned int align = 0; - unsigned int size = type_memsize(ft, &align); - align = clamp_align(align); - if (align > salign) salign = align; - offset = ROUND_SIZE(offset, align); - offset += size; - } - - return ROUNDING(offset, salign); -} - unsigned int type_memsize(const type_t *t, unsigned int *align) { unsigned int size = 0; diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h index 2b2e65dacfc..242b40d4e43 100644 --- a/tools/widl/typegen.h +++ b/tools/widl/typegen.h @@ -84,8 +84,6 @@ unsigned int type_memsize(const type_t *t, unsigned int *align); int decl_indirect(const type_t *t); void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix); void print(FILE *file, int indent, const char *format, va_list ap); -int get_padding(const var_list_t *fields); -int is_user_type(const type_t *t); expr_t *get_size_is_expr(const type_t *t, const char *name); int is_full_pointer_function(const var_t *func); void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index a44e02aab7f..18f601c2e2c 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -35,15 +35,10 @@ typedef GUID UUID; #define TRUE 1 #define FALSE 0 -#define RPC_FC_MODULE 0xfc -#define RPC_FC_COCLASS 0xfd -#define RPC_FC_FUNCTION 0xfe - typedef struct _loc_info_t loc_info_t; typedef struct _attr_t attr_t; typedef struct _expr_t expr_t; typedef struct _type_t type_t; -typedef struct _typeref_t typeref_t; typedef struct _var_t var_t; typedef struct _declarator_t declarator_t; typedef struct _func_t func_t; @@ -520,8 +515,6 @@ int is_ptr(const type_t *t); int is_array(const type_t *t); int is_var_ptr(const var_t *v); int cant_be_null(const var_t *v); -int is_struct(unsigned char tc); -int is_union(unsigned char tc); #define tsENUM 1 #define tsSTRUCT 2