Write-strings warning fix
Dmitry Timoshkov
dmitry at codeweavers.com
Thu Aug 24 23:56:29 CDT 2006
"Andrew Talbot" <Andrew.Talbot at talbotville.com> wrote:
> I am ignorant of yacc and was unable to constify successfully. So this is
> my best shot at this one.
Here is a more intrusive, but IMO a more correct fix.
- free(name);
+ free((void *)name);
change is questionable, but unavoidable.
diff -up cvs/hq/wine/tools/widl/parser.y wine/tools/widl/parser.y
--- cvs/hq/wine/tools/widl/parser.y 2006-08-22 14:33:04.000000000 +0900
+++ wine/tools/widl/parser.y 2006-08-25 13:20:55.000000000 +0900
@@ -80,7 +80,7 @@ static typeref_t *uniq_tref(typeref_t *r
static type_t *type_ref(typeref_t *ref);
static void set_type(var_t *v, typeref_t *ref, expr_t *arr);
static ifref_t *make_ifref(type_t *iface);
-static var_t *make_var(char *name);
+static var_t *make_var(const char *name);
static func_t *make_func(var_t *def, var_t *args);
static type_t *make_class(char *name);
static type_t *make_safearray(void);
@@ -89,7 +89,7 @@ static type_t *reg_type(type_t *type, co
static type_t *reg_types(type_t *type, var_t *names, 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_type(unsigned char type, const char *name, int t);
static type_t *get_typev(unsigned char type, var_t *name, int t);
static int get_struct_type(var_t *fields);
@@ -1152,7 +1152,7 @@ static ifref_t *make_ifref(type_t *iface
return l;
}
-static var_t *make_var(char *name)
+static var_t *make_var(const char *name)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
@@ -1311,7 +1311,7 @@ int is_type(const char *name)
return FALSE;
}
-static type_t *get_type(unsigned char type, char *name, int t)
+static type_t *get_type(unsigned char type, const char *name, int t)
{
struct rtype *cur = NULL;
type_t *tp;
@@ -1321,7 +1321,7 @@ static type_t *get_type(unsigned char ty
cur = cur->next;
}
if (cur) {
- free(name);
+ free((void *)name);
return cur->type;
}
tp = make_type(type, NULL);
@@ -1332,7 +1332,7 @@ static type_t *get_type(unsigned char ty
static type_t *get_typev(unsigned char type, var_t *name, int t)
{
- char *sname = NULL;
+ const char *sname = NULL;
if (name) {
sname = name->name;
free(name);
@@ -1485,7 +1485,7 @@ static int get_struct_type(var_t *field)
/***** constant repository *****/
struct rconst {
- char *name;
+ const char *name;
var_t *var;
struct rconst *next;
};
diff -up cvs/hq/wine/tools/widl/widltypes.h wine/tools/widl/widltypes.h
--- cvs/hq/wine/tools/widl/widltypes.h 2006-08-15 14:51:56.000000000 +0900
+++ wine/tools/widl/widltypes.h 2006-08-25 13:13:33.000000000 +0900
@@ -221,7 +221,7 @@ struct _typeref_t {
};
struct _var_t {
- char *name;
+ const char *name;
int ptr_level;
expr_t *array;
type_t *type;
More information about the wine-patches
mailing list