winedump: Cast-qual warnings fix (2 of 2)

Andrew Talbot Andrew.Talbot at talbotville.com
Fri Oct 13 10:59:43 CDT 2006


To my logic, the formal argument of symbol_clean_string() should be non-const:
this function threatens to alter the string it's given, pure and simple.

-- Andy.
---
Changelog:
    winedump: Cast-qual warnings fix (2 of 2).

diff -urN a/tools/winedump/symbol.c b/tools/winedump/symbol.c
--- a/tools/winedump/symbol.c	2006-10-10 13:15:32.000000000 +0100
+++ b/tools/winedump/symbol.c	2006-10-13 16:42:04.000000000 +0100
@@ -285,24 +285,23 @@
 /*******************************************************************
  *         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 **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)
 
   while (tab [0])
   {
     char *p;
-    SWAP (p, str, tab [0], tab [1]);
+    SWAP (p, string, tab [0], tab [1]);
     tab += 2;
   }
-  if (str [strlen (str) - 1] == ' ')
-    str [strlen (str) - 1] = '\0'; /* no trailing space */
+  if (string [strlen (string) - 1] == ' ')
+    string [strlen (string) - 1] = '\0'; /* no trailing space */
 
-  if (*str == ' ')
-    memmove (str, str + 1, strlen (str)); /* No leading spaces */
+  if (*string == ' ')
+    memmove (string, string + 1, strlen (string)); /* No leading spaces */
 }
diff -urN a/tools/winedump/winedump.h b/tools/winedump/winedump.h
--- a/tools/winedump/winedump.h	2006-09-12 23:59:45.000000000 +0100
+++ b/tools/winedump/winedump.h	2006-10-13 16:44:40.000000000 +0100
@@ -185,7 +185,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