[janitor] tools -Wwrite-strings cleanup

Daniel Marmier d.marmier at bluewin.ch
Fri Oct 8 14:03:40 CDT 2004


Fixed warning with gcc option "-Wwrite-strings".


Index: tools/widl/parser.y
===================================================================
RCS file: /home/wine/wine/tools/widl/parser.y,v
retrieving revision 1.23
diff -u -u -r1.23 parser.y
--- tools/widl/parser.y	6 Oct 2004 18:54:20 -0000	1.23
+++ tools/widl/parser.y	8 Oct 2004 17:29:19 -0000
@@ -85,7 +85,7 @@
 
 static type_t *reg_type(type_t *type, char *name, int t);
 static type_t *reg_types(type_t *type, var_t *names, int t);
-static type_t *find_type(char *name, int t);
+static type_t *find_type(const char *name, int t);
 static type_t *find_type2(char *name, int t);
 static type_t *get_type(unsigned char type, char *name, int t);
 static type_t *get_typev(unsigned char type, var_t *name, int t);
@@ -98,10 +98,17 @@
 #define tsSTRUCT 2
 #define tsUNION  3
 
-static type_t std_bool = { "boolean" };
-static type_t std_int = { "int" };
-static type_t std_int64 = { "__int64" };
-static type_t std_uhyper = { "MIDL_uhyper" };
+static char name_bool[] = "boolean";
+static char name_int[] = "int";
+static char name_int64[] = "__int64";
+static char name_uhyper[] = "MIDL_uhyper";
+
+static type_t std_bool = { name_bool };
+static type_t std_int = { name_int };
+static type_t std_int64 = { name_int64 };
+static type_t std_uhyper = { name_uhyper };
+
+static char name_tagged_union[] = "tagged_union";
 
 %}
 %union {
@@ -737,7 +744,7 @@
 	  tSWITCH '(' s_field ')'
 	  m_ident '{' cases '}'			{ var_t *u = $7;
 						  $$ = get_typev(RPC_FC_ENCAPSULATED_UNION, $2, tsUNION);
-						  if (!u) u = make_var("tagged_union");
+						  if (!u) u = make_var(name_tagged_union);
 						  u->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL);
 						  u->type->fields = $9;
 						  u->type->defined = TRUE;
@@ -1141,7 +1148,7 @@
   return type;
 }
 
-static type_t *find_type(char *name, int t)
+static type_t *find_type(const char *name, int t)
 {
   struct rtype *cur = type_hash[hash_ident(name)];
   while (cur && (cur->t != t || strcmp(cur->name, name)))
Index: tools/widl/proxy.c
===================================================================
RCS file: /home/wine/wine/tools/widl/proxy.c,v
retrieving revision 1.17
diff -u -u -r1.17 proxy.c
--- tools/widl/proxy.c	21 Sep 2004 20:04:47 -0000	1.17
+++ tools/widl/proxy.c	8 Oct 2004 17:29:19 -0000
@@ -49,7 +49,7 @@
 
 /* FIXME: support generation of stubless proxies */
 
-int print_proxy( char *format, ... )
+int print_proxy( const char *format, ... )
 {
   va_list va;
   int i, r;
@@ -89,7 +89,7 @@
   print_proxy( "\n");
 }
 
-static void write_formatdesc( char *str )
+static void write_formatdesc( const char *str )
 {
   print_proxy( "typedef struct _MIDL_%s_FORMAT_STRING\n", str );
   indent++;
Index: tools/winebuild/import.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/import.c,v
retrieving revision 1.68
diff -u -u -r1.68 import.c
--- tools/winebuild/import.c	29 Jul 2004 02:34:15 -0000	1.68
+++ tools/winebuild/import.c	8 Oct 2004 17:29:20 -0000
@@ -512,7 +512,8 @@
 static const char *ldcombine_files( char **argv )
 {
     int i, len = 0;
-    char *cmd, *ldcmd;
+    char *cmd;
+    const char *ldcmd;
     int fd, err;
 
     if (output_file_name && output_file_name[0])
Index: tools/winedump/msmangle.c
===================================================================
RCS file: /home/wine/wine/tools/winedump/msmangle.c,v
retrieving revision 1.11
diff -u -u -r1.11 msmangle.c
--- tools/winedump/msmangle.c	22 Jul 2003 00:56:31 -0000	1.11
+++ tools/winedump/msmangle.c	8 Oct 2004 17:29:20 -0000
@@ -69,7 +69,8 @@
   int is_static = 0, is_const = 0;
   char *function_name = NULL;
   char *class_name = NULL;
-  char *name, *const_status;
+  char *name;
+  const char *const_status;
   static unsigned int hash = 0; /* In case of overloaded functions */
   unsigned int data_flags = 0;
 
@@ -673,7 +674,7 @@
  */
 static char *get_type_string (const char c, const int constraints)
 {
-  char *type_string;
+  const char *type_string;
 
   if (constraints & CT_EXTENDED)
   {
Index: tools/winedump/pe.c
===================================================================
RCS file: /home/wine/wine/tools/winedump/pe.c,v
retrieving revision 1.31
diff -u -u -r1.31 pe.c
--- tools/winedump/pe.c	15 Jan 2004 01:47:46 -0000	1.31
+++ tools/winedump/pe.c	8 Oct 2004 17:29:21 -0000
@@ -155,7 +155,7 @@
 
 static	void	dump_pe_header(void)
 {
-    char			*str;
+    const char			*str;
     IMAGE_FILE_HEADER		*fileHeader;
     IMAGE_OPTIONAL_HEADER	*optionalHeader;
     unsigned			i;
@@ -1160,7 +1160,7 @@
     DWORD*			pName;
     DWORD*			pFunc;
     WORD*			pOrdl;
-    char*			ptr;
+    const char*			ptr;
     DWORD*			map;
 
     if (!exportDir) return;
Index: tools/winedump/winedump.h
===================================================================
RCS file: /home/wine/wine/tools/winedump/winedump.h,v
retrieving revision 1.9
diff -u -u -r1.9 winedump.h
--- tools/winedump/winedump.h	15 Jan 2004 01:47:46 -0000	1.9
+++ tools/winedump/winedump.h	8 Oct 2004 17:29:21 -0000
@@ -129,7 +129,7 @@
   const char *directory;   /* -I */
   const char *forward_dll; /* -f */
   const char *dll_name;    /* -o */
-  char *uc_dll_name;       /* -o */
+  const char *uc_dll_name; /* -o */
 
   /* Option arguments: dump mode */
   const char *dumpsect;    /* -j */
Index: tools/wmc/lang.h
===================================================================
RCS file: /home/wine/wine/tools/wmc/lang.h,v
retrieving revision 1.2
diff -u -u -r1.2 lang.h
--- tools/wmc/lang.h	10 Mar 2002 00:24:24 -0000	1.2
+++ tools/wmc/lang.h	8 Oct 2004 17:29:21 -0000
@@ -27,8 +27,8 @@
 	unsigned	id;
 	unsigned	doscp;
 	unsigned	wincp;
-	char		*name;
-	char		*country;
+	const char	*name;
+	const char	*country;
 } language_t;
 
 void show_languages(void);
Index: tools/wmc/write.c
===================================================================
RCS file: /home/wine/wine/tools/wmc/write.c,v
retrieving revision 1.9
diff -u -u -r1.9 write.c
--- tools/wmc/write.c	20 Jul 2004 01:21:57 -0000	1.9
+++ tools/wmc/write.c	8 Oct 2004 17:29:22 -0000
@@ -470,7 +470,7 @@
 			{
 				char *cptr;
 				int l = blk->msgs[j]->len;
-				char *comma = j == blk->nmsg-1  && i == lbp->nblk-1 ? "" : ",";
+				const char *comma = j == blk->nmsg-1  && i == lbp->nblk-1 ? "" : ",";
 				cptr = make_string(blk->msgs[j]->msg, l, unicodeout ? 0 : blk->msgs[j]->cp);
 				fprintf(fp, "\n /* Msg 0x%08x */ 0x%04x, 0x000%c,\n",
 					blk->idlo + j,



More information about the wine-patches mailing list