On 3/21/2014 11:09, Dmitry Timoshkov wrote:
This allows to differentiate strings and write appropriate rpc type (FC_C_C[W]STRING instead of FC_[W]CHAR).
This version of the patch limits write_array_tfs() to pass attributes to write_pointer_description() only for strings and avoids unwanted changes to other pointer types.
tools/widl/typegen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 37d18f5..889d8c5 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2728,7 +2728,7 @@ static int write_varying_array_pointer_descriptions( return pointer_count; }
-static void write_pointer_description(FILE *file, type_t *type, +static void write_pointer_description(FILE *file, const attr_list_t *attrs, type_t *type, unsigned int *typestring_offset) { unsigned int offset_in_buffer; @@ -2757,7 +2757,7 @@ static void write_pointer_description(FILE *file, type_t *type, if (is_conformant_array(type) && (type_array_is_decl_as_ptr(type) || !current_structure)) write_conformant_array_pointer_descriptions(
file, NULL, type, 0, typestring_offset);
file, attrs, type, 0, typestring_offset); else if (type_get_type(type) == TYPE_STRUCT && get_struct_fc(type) == RPC_FC_CPSTRUCT) {
@@ -2962,7 +2962,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2;
write_pointer_description(file, type, typestring_offset);
write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, type, typestring_offset);
I think it'd be cleaner to let write_pointer_description() handle that, as now you pass all needed info in anyway.