Commit 23547c0f authored by Mikhail Maroukhine's avatar Mikhail Maroukhine Committed by Alexandre Julliard

winedump: Fix compiler warnings with flag -Wcast-qual.

parent ca1b35aa
...@@ -242,34 +242,33 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) ...@@ -242,34 +242,33 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
static const char *get_type (parsed_symbol *sym, const char *proto, int arg) static const char *get_type (parsed_symbol *sym, const char *proto, int arg)
{ {
int is_const, is_volatile, is_struct, is_signed, is_unsigned, ptrs = 0; int is_const, is_volatile, is_struct, is_signed, is_unsigned, ptrs = 0;
const char *iter, *type_str, *base_type, *catch_unsigned; const char *iter, *base_type, *catch_unsigned, *proto_str;
char dest_type, *type_str_tmp; char dest_type, *type_str;
assert (sym && sym->symbol); assert (sym && sym->symbol);
assert (proto && *proto); assert (proto && *proto);
assert (arg < 0 || (unsigned)arg == sym->argc); assert (arg < 0 || (unsigned)arg == sym->argc);
type_str = proto;
proto = str_match (proto, "const", &is_const); proto_str = str_match (proto, "const", &is_const);
proto = str_match (proto, "volatile", &is_volatile); proto_str = str_match (proto_str, "volatile", &is_volatile);
proto = str_match (proto, "struct", &is_struct); proto_str = str_match (proto_str, "struct", &is_struct);
if (!is_struct) if (!is_struct)
proto = str_match (proto, "union", &is_struct); proto_str = str_match (proto_str, "union", &is_struct);
catch_unsigned = proto; catch_unsigned = proto_str;
proto = str_match (proto, "unsigned", &is_unsigned); proto_str = str_match (proto_str, "unsigned", &is_unsigned);
proto = str_match (proto, "signed", &is_signed); proto_str = str_match (proto_str, "signed", &is_signed);
/* Can have 'unsigned const' or 'const unsigned' etc */ /* Can have 'unsigned const' or 'const unsigned' etc */
if (!is_const) if (!is_const)
proto = str_match (proto, "const", &is_const); proto_str = str_match (proto_str, "const", &is_const);
if (!is_volatile) if (!is_volatile)
proto = str_match (proto, "volatile", &is_volatile); proto_str = str_match (proto_str, "volatile", &is_volatile);
base_type = proto; base_type = proto_str;
iter = str_find_set (proto, " ,*)"); iter = str_find_set (proto_str, " ,*)");
if (!iter) if (!iter)
return NULL; return NULL;
...@@ -279,7 +278,7 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg) ...@@ -279,7 +278,7 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg)
if (strncmp (base_type, "int", 3) && strncmp (base_type, "long", 4) && if (strncmp (base_type, "int", 3) && strncmp (base_type, "long", 4) &&
strncmp (base_type, "short", 5) && strncmp (base_type, "char", 4)) strncmp (base_type, "short", 5) && strncmp (base_type, "char", 4))
{ {
iter = proto; iter = proto_str;
base_type = catch_unsigned; base_type = catch_unsigned;
} else } else
catch_unsigned = NULL; catch_unsigned = NULL;
...@@ -288,22 +287,22 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg) ...@@ -288,22 +287,22 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg)
catch_unsigned = NULL; catch_unsigned = NULL;
/* FIXME: skip const/volatile here too */ /* FIXME: skip const/volatile here too */
for (proto = iter; *proto; proto++) for (proto_str = iter; *proto_str; proto_str++)
if (*proto == '*') if (*proto_str == '*')
ptrs++; ptrs++;
else if (*proto != ' ') else if (*proto_str != ' ')
break; break;
if (!*proto) if (!*proto_str)
return NULL; return NULL;
type_str = type_str_tmp = str_substring (type_str, proto); type_str = str_substring (proto, proto_str);
if (iter == base_type || catch_unsigned) if (iter == base_type || catch_unsigned)
{ {
/* 'unsigned' with no type */ /* 'unsigned' with no type */
char *tmp = str_create (2, type_str, " int"); char *tmp = str_create (2, type_str, " int");
free (type_str_tmp); free (type_str);
type_str = type_str_tmp = tmp; type_str = tmp;
} }
symbol_clean_string (type_str); symbol_clean_string (type_str);
...@@ -319,23 +318,23 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg) ...@@ -319,23 +318,23 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg)
sym->arg_type [arg] = dest_type; sym->arg_type [arg] = dest_type;
sym->arg_flag [arg] = is_const ? CT_CONST : is_volatile ? CT_VOLATILE : 0; sym->arg_flag [arg] = is_const ? CT_CONST : is_volatile ? CT_VOLATILE : 0;
if (*proto == ',' || *proto == ')') if (*proto_str == ',' || *proto_str == ')')
sym->arg_name [arg] = str_create_num (1, arg, "arg"); sym->arg_name [arg] = str_create_num (1, arg, "arg");
else else
{ {
iter = str_find_set (proto, " ,)"); iter = str_find_set (proto_str, " ,)");
if (!iter) if (!iter)
{ {
free (type_str_tmp); free (type_str);
return NULL; return NULL;
} }
sym->arg_name [arg] = str_substring (proto, iter); sym->arg_name [arg] = str_substring (proto_str, iter);
proto = iter; proto_str = iter;
} }
sym->arg_text [arg] = (char*)type_str; sym->arg_text [arg] = (char*)type_str;
} }
return proto; return proto_str;
} }
......
...@@ -287,10 +287,9 @@ int symbol_get_type (const char *string) ...@@ -287,10 +287,9 @@ int symbol_get_type (const char *string)
* *
* Make a type string more Wine-friendly. Logically const :-) * Make a type string more Wine-friendly. Logically const :-)
*/ */
void symbol_clean_string (const char *string) void symbol_clean_string (char *str)
{ {
const char * const *tab = swap_after; const char * const *tab = swap_after;
char *str = (char *)string;
#define SWAP(i, p, x, y) do { i = p; while ((i = str_replace (i, x, y))); } while(0) #define SWAP(i, p, x, y) do { i = p; while ((i = str_replace (i, x, y))); } while(0)
......
...@@ -176,7 +176,7 @@ const char *symbol_get_call_convention(const parsed_symbol *sym); ...@@ -176,7 +176,7 @@ const char *symbol_get_call_convention(const parsed_symbol *sym);
const char *symbol_get_spec_type (const parsed_symbol *sym, size_t arg); const char *symbol_get_spec_type (const parsed_symbol *sym, size_t arg);
void symbol_clean_string (const char *string); void symbol_clean_string (char *string);
int symbol_get_type (const char *string); int symbol_get_type (const char *string);
......
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