winedump: Cast-qual warnings fix

Andrew Talbot Andrew.Talbot at talbotville.com
Thu Jul 12 16:04:35 CDT 2007


Please give feedback, if rejecting this patch.

Thanks,

-- Andy.
---
Changelog:
    winedump: Cast-qual warnings fix.

diff -urN a/tools/winedump/search.c b/tools/winedump/search.c
--- a/tools/winedump/search.c	2006-10-10 12:52:04.000000000 +0100
+++ b/tools/winedump/search.c	2007-07-12 21:27:27.000000000 +0100
@@ -242,14 +242,19 @@
 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;
-  const char *iter, *type_str, *base_type, *catch_unsigned;
+  const char *iter, *base_type, *catch_unsigned;
+  union
+  {
+      const char    *constant;
+      char          *nonconst;
+  } type_str;
   char dest_type;
 
   assert (sym && sym->symbol);
   assert (proto && *proto);
   assert (arg < 0 || (unsigned)arg == sym->argc);
 
-  type_str = proto;
+  type_str.constant = proto;
 
   proto = str_match (proto, "const", &is_const);
   proto = str_match (proto, "volatile", &is_volatile);
@@ -297,21 +302,21 @@
   if (!*proto)
     return NULL;
 
-  type_str = str_substring (type_str, proto);
+  type_str.constant = str_substring (type_str.constant, proto);
   if (iter == base_type || catch_unsigned)
   {
     /* 'unsigned' with no type */
-    char *tmp = str_create (2, type_str, " int");
-    free ((char*)type_str);
-    type_str = tmp;
+    char *tmp = str_create (2, type_str.constant, " int");
+    free (type_str.nonconst);
+    type_str.constant = tmp;
   }
-  symbol_clean_string (type_str);
+  symbol_clean_string (type_str.nonconst);
 
-  dest_type = symbol_get_type (type_str);
+  dest_type = symbol_get_type (type_str.constant);
 
   if (arg < 0)
   {
-    sym->return_text = (char*)type_str;
+    sym->return_text = type_str.nonconst;
     sym->return_type = dest_type;
   }
   else
@@ -326,13 +331,13 @@
       iter = str_find_set (proto, " ,)");
       if (!iter)
       {
-        free ((char*)type_str);
+        free (type_str.nonconst);
         return NULL;
       }
       sym->arg_name [arg] = str_substring (proto, iter);
       proto = iter;
     }
-    sym->arg_text [arg] = (char*)type_str;
+    sym->arg_text [arg] = type_str.nonconst;
 
   }
   return proto;
diff -urN a/tools/winedump/symbol.c b/tools/winedump/symbol.c
--- a/tools/winedump/symbol.c	2006-11-27 13:13:37.000000000 +0000
+++ b/tools/winedump/symbol.c	2007-07-12 21:25:33.000000000 +0100
@@ -285,12 +285,12 @@
 /*******************************************************************
  *         symbol_clean_string
  *
- * Make a type string more Wine-friendly. Logically const :-)
+ * Make a type string more Wine-friendly
  */
-void  symbol_clean_string (const char *string)
+void  symbol_clean_string (char *string)
 {
   const char * const *tab = swap_after;
-  char *str = (char *)string;
+  char *str = string;
 
 #define SWAP(i, p, x, y) do { i = p; while ((i = str_replace (i, x, y))); } while(0)
 
diff -urN a/tools/winedump/winedump.h b/tools/winedump/winedump.h
--- a/tools/winedump/winedump.h	2007-02-12 15:25:56.000000000 +0000
+++ b/tools/winedump/winedump.h	2007-07-12 21:27:07.000000000 +0100
@@ -183,7 +183,7 @@
 
 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);
 





More information about the wine-patches mailing list