Commit 8a0cb2b5 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Use is_string_type for detecting strings in write_typeformatstring_var to…

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.
parent 4e665b1e
......@@ -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;
......
......@@ -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)));
}
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment