widl: Use is_string_type for detecting strings in write_typeformatstring_var to make it consistent with write_remoting_arg.

Fix the is_string_type function used for detecting strings by only 
examining aliases instead of both aliases and pointers. This is due to 
the requirement that pointers to strings be handled as pointers and so 
not detected as strings.
This commit is contained in:
Rob Shearman 2008-03-27 14:02:58 +00:00 committed by Alexandre Julliard
parent 4e665b1e21
commit 8a0cb2b5c5
3 changed files with 16 additions and 2 deletions

View file

@ -66,6 +66,19 @@ int is_ptrchain_attr(const var_t *var, enum attr_type t)
}
}
int is_aliaschain_attr(const type_t *type, enum attr_type attr)
{
const type_t *t = type;
for (;;)
{
if (is_attr(t->attrs, attr))
return 1;
else if (t->kind == TKIND_ALIAS)
t = t->orig;
else return 0;
}
}
int is_attr(const attr_list_t *list, enum attr_type t)
{
const attr_t *attr;

View file

@ -24,6 +24,7 @@
#include "widltypes.h"
extern int is_ptrchain_attr(const var_t *var, enum attr_type t);
extern int is_aliaschain_attr(const type_t *var, enum attr_type t);
extern int is_attr(const attr_list_t *list, enum attr_type t);
extern void *get_attrp(const attr_list_t *list, enum attr_type t);
extern unsigned long get_attrv(const attr_list_t *list, enum attr_type t);
@ -78,7 +79,7 @@ static inline int last_array(const type_t *type)
static inline int is_string_type(const attr_list_t *attrs, const type_t *type)
{
return ((is_attr(attrs, ATTR_STRING) || is_attr(type->attrs, ATTR_STRING))
return ((is_attr(attrs, ATTR_STRING) || is_aliaschain_attr(type, ATTR_STRING))
&& (last_ptr(type) || last_array(type)));
}

View file

@ -2181,7 +2181,7 @@ static size_t write_typeformatstring_var(FILE *file, int indent, const func_t *f
return type->typestring_offset;
}
if ((last_ptr(type) || last_array(type)) && is_ptrchain_attr(var, ATTR_STRING))
if (is_string_type(var->attrs, type))
return write_string_tfs(file, var->attrs, type, var->name, typeformat_offset, TRUE);
if (is_array(type))