GCC4 warnings on gnome-build

Enver ALTIN <[email protected]>
Newsgroups gmane.comp.gnome.devtools
Organization Parkyeri
Message-ID <[email protected]>
Hi,

Debian/unstable has gcc4 as the default compiler for the last couple of
days, so I just tried to rebuild Anjuta with it, and it required a
recent gnome-build and I rebuilt that too.

Rebuilding gnome-build was a bit problematic because of -Wall I guess,
so I had to add some typecasting here and there to get it compiled.

I know it's ugly, and possibly there's a de-jure way of doing this. At
least I got it to work.

Thanks,
-- 
.O.
..O   Enver ALTIN                   |   http://skyblue.gen.tr/
OOO   Software developer @ Parkyeri | http://www.parkyeri.com/

_______________________________________________
gnome-devtools mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-devtools
gbf-gcc4-ugly.patch (text/x-patch, 13.6 KB)
Index: src/backends/libgbf_am/gbf-am-project.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/backends/libgbf_am/gbf-am-project.c,v
retrieving revision 1.53
diff -u -p -d -r1.53 gbf-am-project.c
--- src/backends/libgbf_am/gbf-am-project.c	14 Jul 2005 12:36:09 -0000	1.53
+++ src/backends/libgbf_am/gbf-am-project.c	15 Jul 2005 13:06:00 -0000
@@ -545,9 +545,9 @@ xml_new_source_node (GbfAmProject *proje
 	xmlNodePtr source;
 	gchar *filename;
 	
-	source = xmlNewDocNode (doc, NULL, "source", NULL);
+	source = xmlNewDocNode (doc, NULL, (xmlChar *) "source", NULL);
 	filename = uri_get_chrooted_path (project->project_root_uri, uri);
-	xmlSetProp (source, "uri", filename);
+	xmlSetProp (source, (xmlChar *) "uri", (xmlChar *) filename);
 	g_free (filename);
 	
 	return source;
@@ -569,17 +569,17 @@ xml_write_location_recursive (GbfAmProje
 		GbfAmNode *node = GBF_AM_NODE (g_node);
 		switch (node->type) {
 			case GBF_AM_NODE_GROUP:
-				xml_node = xmlNewDocNode (doc, NULL, "group", NULL);
-				xmlSetProp (xml_node, "id", node->id);
+				xml_node = xmlNewDocNode (doc, NULL, (xmlChar *) "group", NULL);
+				xmlSetProp (xml_node, (xmlChar *) "id", (xmlChar *) node->id);
 				finished = TRUE;
 				break;
 			case GBF_AM_NODE_TARGET:
-				xml_node = xmlNewDocNode (doc, NULL, "target", NULL);
+				xml_node = xmlNewDocNode (doc, NULL, (xmlChar *) "target", NULL);
 				/* strip the group id from the target
 				   id, since the script identifies
 				   targets only within the group */
-				xmlSetProp (xml_node, "id",
-					    node->id +
+				xmlSetProp (xml_node, (xmlChar *) "id",
+					    (xmlChar *) node->id +
 					    strlen (GBF_AM_NODE (g_node->parent)->id));
 				break;
 			case GBF_AM_NODE_SOURCE:
@@ -615,8 +615,8 @@ xml_write_add_source (GbfAmProject *proj
 {
 	xmlNodePtr cur, source;
 	
-	cur = xmlNewDocNode (doc, NULL, "add", NULL);
-	xmlSetProp (cur, "type", "source");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "add", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "source");
 	xmlAddChild (doc->children, cur);
 
 	cur = xml_write_location_recursive (project, doc, cur, g_node);
@@ -633,8 +633,8 @@ xml_write_remove_source (GbfAmProject *p
 {
 	xmlNodePtr cur;
 
-	cur = xmlNewDocNode (doc, NULL, "remove", NULL);
-	xmlSetProp (cur, "type", "source");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "remove", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "source");
 	xmlAddChild (doc->children, cur);
 	
 	cur = xml_write_location_recursive (project, doc, cur, g_node);
@@ -653,15 +653,15 @@ xml_write_add_target (GbfAmProject *proj
 	
 	g_assert (GBF_AM_NODE (g_node)->type == GBF_AM_NODE_GROUP);
 
-	cur = xmlNewDocNode (doc, NULL, "add", NULL);
-	xmlSetProp (cur, "type", "target");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "add", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "target");
 	xmlAddChild (doc->children, cur);
 
 	cur = xml_write_location_recursive (project, doc, cur, g_node);
 	
-	target = xmlNewDocNode (doc, NULL, "target", NULL);
-	xmlSetProp (target, "id", name);
-	xmlSetProp (target, "type", type);
+	target = xmlNewDocNode (doc, NULL, (xmlChar *) "target", NULL);
+	xmlSetProp (target, (xmlChar *) "id", (xmlChar *) name);
+	xmlSetProp (target, (xmlChar *) "type", (xmlChar *) type);
 	xmlAddChild (cur, target);
 
 	return TRUE;
@@ -697,9 +697,9 @@ xml_write_set_item_config_cb (const gcha
 		if (strcmp (new_str, old_str) != 0)
 		{
 			param_node = xmlNewDocNode (data->doc, NULL,
-						    "item", NULL);
-			xmlSetProp (param_node, "name", param);
-			xmlSetProp (param_node, "value", new_str);
+						    (xmlChar *) "item", NULL);
+			xmlSetProp (param_node, (xmlChar *) "name", (xmlChar *) param);
+			xmlSetProp (param_node, (xmlChar *) "value", (xmlChar *) new_str);
 			xmlAddChild (data->curr_xml_node, param_node);
 		}
 	}
@@ -729,15 +729,15 @@ xml_write_set_param_config_cb (const gch
 		if (strcmp (new_str, old_str) != 0)
 		{
 			param_node = xmlNewDocNode (data->doc, NULL,
-						    "param", NULL);
-			xmlSetProp (param_node, "name", param);
-			xmlSetProp (param_node, "value", new_str);
+						    (xmlChar *) "param", NULL);
+			xmlSetProp (param_node, (xmlChar *) "name", (xmlChar *) param);
+			xmlSetProp (param_node, (xmlChar *) "value", (xmlChar *) new_str);
 			xmlAddChild (data->curr_xml_node, param_node);
 		}
 	} else if (value->type == GBF_AM_TYPE_LIST) {
 		param_node = xmlNewDocNode (data->doc, NULL,
-					    "param", NULL);
-		xmlSetProp (param_node, "name", param);
+					    (xmlChar *) "param", NULL);
+		xmlSetProp (param_node, (xmlChar *) "name", (xmlChar *) param);
 		/* FIXME */
 	} else if (value->type == GBF_AM_TYPE_MAPPING) {
 		
@@ -749,9 +749,9 @@ xml_write_set_param_config_cb (const gch
 		old_value = gbf_am_config_mapping_lookup (data->old_config, param);
 		old_mapping = gbf_am_config_value_get_mapping (old_value);
 		
-		param_node = xmlNewDocNode (data->doc, NULL, "param", NULL);
+		param_node = xmlNewDocNode (data->doc, NULL, (xmlChar *) "param", NULL);
 		
-		xmlSetProp (param_node, "name", param);
+		xmlSetProp (param_node, (xmlChar *) "name", (xmlChar *) param);
 		
 		write_data.doc = data->doc;
 		write_data.curr_xml_node = param_node;
@@ -778,14 +778,14 @@ xml_write_set_config (GbfAmProject      
 	xmlNodePtr cur, config;
 	GbfXmlWriteData user_data;
 	
-	cur = xmlNewDocNode (doc, NULL, "set", NULL);
-	xmlSetProp (cur, "type", "config");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "set", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "config");
 	xmlAddChild (doc->children, cur);
 
 	if (g_node)
 		cur = xml_write_location_recursive (project, doc, cur, g_node);
 	
-	config = xmlNewDocNode (doc, NULL, "config", NULL);
+	config = xmlNewDocNode (doc, NULL, (xmlChar *) "config", NULL);
 	xmlAddChild (cur, config);
 	
 	user_data.doc = doc;
@@ -808,8 +808,8 @@ xml_write_remove_target (GbfAmProject *p
 {
 	xmlNodePtr cur;
 
-	cur = xmlNewDocNode (doc, NULL, "remove", NULL);
-	xmlSetProp (cur, "type", "target");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "remove", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "target");
 	xmlAddChild (doc->children, cur);
 	
 	cur = xml_write_location_recursive (project, doc, cur, g_node);
@@ -828,15 +828,15 @@ xml_write_add_group (GbfAmProject *proje
 	
 	g_assert (GBF_AM_NODE (g_node)->type == GBF_AM_NODE_GROUP);
 
-	cur = xmlNewDocNode (doc, NULL, "add", NULL);
-	xmlSetProp (cur, "type", "group");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "add", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "group");
 	xmlAddChild (doc->children, cur);
 
 	/* calculate new id needed by the script */
 	new_id = g_strdup_printf ("%s%s/", GBF_AM_NODE (g_node)->id, new_group);
 	
-	group = xmlNewDocNode (doc, NULL, "group", NULL);
-	xmlSetProp (group, "id", new_id);
+	group = xmlNewDocNode (doc, NULL, (xmlChar *) "group", NULL);
+	xmlSetProp (group, (xmlChar *) "id", (xmlChar *) new_id);
 	xmlAddChild (cur, group);
 	g_free (new_id);
 	
@@ -850,8 +850,8 @@ xml_write_remove_group (GbfAmProject *pr
 {
 	xmlNodePtr cur;
 
-	cur = xmlNewDocNode (doc, NULL, "remove", NULL);
-	xmlSetProp (cur, "type", "group");
+	cur = xmlNewDocNode (doc, NULL, (xmlChar *) "remove", NULL);
+	xmlSetProp (cur, (xmlChar *) "type", (xmlChar *) "group");
 	xmlAddChild (doc->children, cur);
 	
 	cur = xml_write_location_recursive (project, doc, cur, g_node);
@@ -864,12 +864,12 @@ xml_new_change_doc (GbfAmProject *projec
 {
 	xmlDocPtr doc;
 	
-	doc = xmlNewDoc ("1.0");
+	doc = xmlNewDoc ((xmlChar *) "1.0");
 	if (doc != NULL) {
 		gchar *root_path;
 		root_path = uri_to_path (project->project_root_uri);
-		doc->children = xmlNewDocNode (doc, NULL, "project", NULL);
-		xmlSetProp (doc->children, "root", root_path);
+		doc->children = xmlNewDocNode (doc, NULL, (xmlChar *) "project", NULL);
+		xmlSetProp (doc->children, (xmlChar *) "root", (xmlChar *) root_path);
 		g_free (root_path);
 	}
 
@@ -1132,7 +1132,7 @@ sax_start_element (void *ctxt, const xml
 		/* assign here, since we destroy the data in project_data_init() */
 		if (project_file) {
 			g_free (project->project_file);
-			project->project_file = g_strdup (project_file);
+			project->project_file = g_strdup ((char *) project_file);
 		}
 		
 	} else if (xmlStrEqual (name, BAD_CAST "group")) {
@@ -1168,7 +1168,7 @@ sax_start_element (void *ctxt, const xml
 			g_node = project_node_new (GBF_AM_NODE_GROUP);
 			node = GBF_AM_NODE (g_node);
 			
-			node->id = g_strdup (group_id);
+			node->id = g_strdup ((char *) group_id);
 			
 			/* set parent group */
 			if (data->current_node != NULL) {
@@ -1216,8 +1216,8 @@ sax_start_element (void *ctxt, const xml
 				child = g_node_next_sibling (child);
 			}
 		}
-		node->name = g_strdup (group_name);
-		node->uri = g_strdup (group_source);
+		node->name = g_strdup ((char *) group_name);
+		node->uri = g_strdup ((char *) group_source);
 		node->config = gbf_am_config_mapping_new ();
 		
 		/* set working node */
@@ -1297,8 +1297,8 @@ sax_start_element (void *ctxt, const xml
 				child = g_node_next_sibling (child);
 			}
 		}
-		node->name = g_strdup (target_name);
-		node->detail = g_strdup (target_type);
+		node->name = g_strdup ((char *) target_name);
+		node->detail = g_strdup ((char *) target_type);
 		node->config = gbf_am_config_mapping_new ();
 
 		/* set working node */
@@ -1423,7 +1423,7 @@ sax_start_element (void *ctxt, const xml
 			g_free (node->detail);
 		}
 		node->uri = source_uri;
-		node->detail = g_strdup (target_dep);
+		node->detail = g_strdup ((char *) target_dep);
 
 		/* set working node */
 		data->current_node = g_node;
@@ -1477,11 +1477,11 @@ sax_start_element (void *ctxt, const xml
 
 			/* save scalar string parameter */
 			param = gbf_am_config_value_new (GBF_AM_TYPE_STRING);
-			gbf_am_config_value_set_string (param, param_value);
+			gbf_am_config_value_set_string (param, (char *) param_value);
 
 			/* try to save the parameter in the config mapping */
 			if (!gbf_am_config_mapping_insert (data->config,
-							   param_name, param)) {
+							   (char *) param_name, param)) {
 				gbf_am_config_value_free (param);
 			}
 
@@ -1490,7 +1490,7 @@ sax_start_element (void *ctxt, const xml
 
 		} else {
 			/* we expect a list or a hash of values */
-			data->param_key = g_strdup (param_name);
+			data->param_key = g_strdup ((char *) param_name);
 			data->state = PARSE_PARAM;
 		}
 		
@@ -1520,7 +1520,7 @@ sax_start_element (void *ctxt, const xml
 		
 		/* create item value */
 		item = gbf_am_config_value_new (GBF_AM_TYPE_STRING);
-		gbf_am_config_value_set_string (item, item_value);
+		gbf_am_config_value_set_string (item, (char *) item_value);
 		
 		/* get current configuration parameter */
 		param = gbf_am_config_mapping_lookup (data->config, data->param_key);
@@ -1548,7 +1548,7 @@ sax_start_element (void *ctxt, const xml
 		    case GBF_AM_TYPE_MAPPING:
 			    if (item_name == NULL ||
 				!gbf_am_config_mapping_insert (param->mapping,
-							       item_name,
+							       (char *) item_name,
 							       item)) {
 				    gbf_am_config_value_free (item);
 			    }
@@ -2270,7 +2270,7 @@ project_update (GbfAmProject *project,
 	gboolean retval;
 	gint i;
 	xmlChar *xml_doc;
-	int xml_size;
+	gint xml_size;
 	
 	/* remove file monitors */
 	monitors_remove (project);
@@ -2289,7 +2289,7 @@ project_update (GbfAmProject *project,
 
 	/* execute the script */
 	data = spawn_script (argv, SCRIPT_TIMEOUT,
-			     xml_doc, xml_size,  /* input buffer */
+			     (char *) xml_doc, xml_size,  /* input buffer */
 			     NULL, NULL, NULL);  /* i/o callbacks */
 	xmlFree (xml_doc);
 
Index: src/gbf/gbf-backend.c
===================================================================
RCS file: /cvs/gnome/gnome-build/src/gbf/gbf-backend.c,v
retrieving revision 1.4
diff -u -p -d -r1.4 gbf-backend.c
--- src/gbf/gbf-backend.c	9 Apr 2003 04:56:49 -0000	1.4
+++ src/gbf/gbf-backend.c	15 Jul 2005 13:06:01 -0000
@@ -105,18 +105,18 @@ read_backend_attributes (xmlNodePtr back
 	attributes = g_hash_table_new_full (g_str_hash, g_str_equal, xmlFree, xmlFree);
 
 	for (attr = backend->children; attr != NULL; attr = attr->next) {
-		char *type = xmlGetProp (attr, "type");
+		xmlChar *type = xmlGetProp (attr, (xmlChar *) "type");
 
 		if (type) {
-			char *name;
-			char *value;
-			if (strcmp (type, "string")) {
+			xmlChar *name;
+			xmlChar *value;
+			if (strcmp ((const char *) type, "string")) {
 				g_warning ("gnome-build only supports string-type oaf attributes");
 				return NULL;
 			}
 
-			name = xmlGetProp (attr, "name");
-			value = xmlGetProp (attr, "value");
+			name = xmlGetProp (attr, (xmlChar *) "name");
+			value = xmlGetProp (attr, (xmlChar *) "value");
 
 			if (name && value) {
 				g_hash_table_insert (attributes, name, value);
@@ -144,7 +144,7 @@ backend_from_attributes (xmlNodePtr  plu
 		langs = anjuta_get_lang_list ();
 #endif
 
-	str = xmlGetProp (plugin, "location");
+	str = (char *) xmlGetProp (plugin, (xmlChar *) "location");
 	if (str) {
 		backend->id = g_strdup (str);
 		xmlFree (str);
@@ -212,7 +212,7 @@ load_backend_file (const char *path)
 		g_warning ("%s is not a valid backend description file", path);
 	} else {
 		for (backend = root->children; backend != NULL; backend = backend->next) {
-			xmlChar *location = xmlGetProp (backend, "location");
+			xmlChar *location = xmlGetProp (backend, (xmlChar *) "location");
 			if (location) {
 				load_backend (backend);
 				xmlFree (location);
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBC17W7ZCB2FZvqK0sRAubkAJ9aeBbvMa4iY7+w/U/+DsE+yartpACfUnl9
OOYiTxzeM44ocB/48fnlQ3c=
=VN6/
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.