diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 2ce138552fe..9bf348f27e1 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -713,7 +713,7 @@ static unsigned int write_procformatstring_type(FILE *file, int indent, print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n"); print_file(file, indent, "0x01,\n"); - print_file(file, indent, "NdrFcShort(0x%x),\n", type->typestring_offset); + print_file(file, indent, "NdrFcShort(0x%hx),\n", type->typestring_offset); size = 4; /* includes param type prefix */ } return size; @@ -826,7 +826,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, print_file(file, 2, "0x%x, /* Corr desc: constant, val = %ld */\n", RPC_FC_CONSTANT_CONFORMANCE, expr->cval); print_file(file, 2, "0x%lx,\n", expr->cval >> 16); - print_file(file, 2, "NdrFcShort(0x%lx),\n", expr->cval & USHRT_MAX); + print_file(file, 2, "NdrFcShort(0x%hx),\n", (unsigned short)expr->cval); return 4; } @@ -943,7 +943,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, print_file(file, 2, "0x%x, /* Corr desc: %s%s */\n", conftype | param_type, conftype_string, string_of_type(param_type)); print_file(file, 2, "0x%x, /* %s */\n", operator_type, operator_string); - print_file(file, 2, "NdrFcShort(0x%x), /* offset = %d */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* offset = %d */\n", offset, offset); } else @@ -977,7 +977,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, print_file(file, 2, "0x%x, /* Corr desc: %s */\n", conftype, conftype_string); print_file(file, 2, "0x%x, /* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK"); - print_file(file, 2, "NdrFcShort(0x%x), /* %u */\n", callback_offset, callback_offset); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", callback_offset, callback_offset); } return 4; } @@ -1264,8 +1264,8 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) print_file(file, 2, "0x%x,\t/* Alignment= %d, Flags= %02x */\n", flags | (align - 1), align - 1, flags); print_file(file, 2, "NdrFcShort(0x%hx),\t/* Function offset= %hu */\n", funoff, funoff); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", size, size); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", usize, usize); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", size, size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", usize, usize); *tfsoff += 8; reloff = absoff - *tfsoff; print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff); @@ -1382,8 +1382,8 @@ static int write_no_repeat_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD); /* pointer instance */ - print_file(file, 2, "NdrFcShort(0x%x), /* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); *typestring_offset += 6; if (is_ptr(type)) @@ -1463,8 +1463,8 @@ static int write_pointer_description_offsets( /* pointer instance */ /* FIXME: sometimes from end of structure, sometimes from beginning */ - print_file(file, 2, "NdrFcShort(0x%x), /* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); align = 0; memsize = type_memsize(type, &align); @@ -1558,10 +1558,10 @@ static int write_fixed_array_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_FIXED_REPEAT */\n", RPC_FC_FIXED_REPEAT); print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD); - print_file(file, 2, "NdrFcShort(0x%x), /* Iterations = %d */\n", type_array_get_dim(type), type_array_get_dim(type)); - print_file(file, 2, "NdrFcShort(0x%x), /* Increment = %d */\n", increment_size, increment_size); - print_file(file, 2, "NdrFcShort(0x%x), /* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Number of pointers = %d */\n", pointer_count, pointer_count); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Iterations = %d */\n", type_array_get_dim(type), type_array_get_dim(type)); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count); *typestring_offset += 10; pointer_count = write_pointer_description_offsets( @@ -1635,9 +1635,9 @@ static int write_conformant_array_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT); print_file(file, 2, "0x%02x, /* FC_FIXED_OFFSET */\n", RPC_FC_FIXED_OFFSET); - print_file(file, 2, "NdrFcShort(0x%x), /* Increment = %d */\n", increment_size, increment_size); - print_file(file, 2, "NdrFcShort(0x%x), /* Offset to array = %d */\n", offset_in_memory, offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Number of pointers = %d */\n", pointer_count, pointer_count); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", offset_in_memory, offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count); *typestring_offset += 8; pointer_count = write_pointer_description_offsets( @@ -1679,9 +1679,9 @@ static int write_varying_array_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT); print_file(file, 2, "0x%02x, /* FC_VARIABLE_OFFSET */\n", RPC_FC_VARIABLE_OFFSET); - print_file(file, 2, "NdrFcShort(0x%x), /* Increment = %d */\n", increment_size, increment_size); - print_file(file, 2, "NdrFcShort(0x%x), /* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Number of pointers = %d */\n", pointer_count, pointer_count); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count); *typestring_offset += 8; pointer_count = write_pointer_description_offsets( @@ -1840,7 +1840,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", dim, dim); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", dim, dim); *typestring_offset += 2; return start_offset; @@ -1923,7 +1923,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t } else { - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", size, size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", size, size); *typestring_offset += 2; } @@ -1945,11 +1945,11 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t } else { - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", dim, dim); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", dim, dim); *typestring_offset += 2; } - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", elsize, elsize); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", elsize, elsize); *typestring_offset += 2; } @@ -1974,7 +1974,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t else { unsigned int dim = size_is ? 0 : type_array_get_dim(type); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", dim, dim); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", dim, dim); *typestring_offset += 2; *typestring_offset += write_conf_or_var_desc(file, current_structure, baseoff, @@ -2109,7 +2109,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, print_start_tfs_comment(file, type, start_offset); print_file(file, 2, "0x%x,\t/* %s */\n", real_type, string_of_type(real_type)); print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", total_size, total_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", total_size, total_size); *tfsoff += 4; if (array) @@ -2134,7 +2134,7 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type, unsigned int absoff = type->ptrdesc ? type->ptrdesc : *tfsoff; int reloff = absoff - *tfsoff; assert( reloff >= 0 ); - print_file(file, 2, "NdrFcShort(0x%x),\t/* Offset= %d (%u) */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %d (%u) */\n", reloff, reloff, absoff); *tfsoff += 2; } @@ -2219,7 +2219,7 @@ static unsigned int write_pointer_only_tfs(FILE *file, const attr_list_t *attrs, fprintf(file, " */\n"); } - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", reloff, offset); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", reloff, offset); *typeformat_offset += 4; return start_offset; @@ -2239,7 +2239,7 @@ static void write_branch_type(FILE *file, const type_t *t, unsigned int *tfsoff) else if (t->typestring_offset) { short reloff = t->typestring_offset - *tfsoff; - print_file(file, 2, "NdrFcShort(0x%x),\t/* Offset= %d (%d) */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %d (%d) */\n", reloff, reloff, t->typestring_offset); } else @@ -2330,8 +2330,8 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso *tfsoff += 2; } - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", size, size); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", nbranch, nbranch); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", size, size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", nbranch, nbranch); *tfsoff += 4; if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) @@ -2370,7 +2370,7 @@ static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfso } else { - print_file(file, 2, "NdrFcShort(0x%x),\n", nodeftype); + print_file(file, 2, "NdrFcShort(0x%hx),\n", nodeftype); *tfsoff += 2; }