[gnumeric] Compilation: remove casts.



commit 8744ed2f814869b71a73b8658e5b7e89b611a75f
Author: Morten Welinder <terra gnome org>
Date:   Wed Nov 17 13:48:50 2010 -0500

    Compilation: remove casts.

 plugins/excel/ms-container.c   |    6 ++----
 plugins/excel/ms-excel-read.c  |    2 +-
 plugins/excel/ms-excel-write.c |    4 ++--
 src/commands.c                 |    2 +-
 src/dialogs/dialog-scenarios.c |    2 +-
 src/file-autoft.c              |    9 ++-------
 src/gnm-pane.c                 |    5 ++---
 src/graph.c                    |    4 ++--
 src/gui-clipboard.c            |    6 ++----
 src/sheet-object-graph.c       |    3 +--
 src/sheet-object-image.c       |    3 +--
 src/sheet-object.c             |    6 ++----
 src/tools/filter.c             |    4 ++--
 src/tools/simulation.c         |    8 ++++----
 14 files changed, 25 insertions(+), 39 deletions(-)
---
diff --git a/plugins/excel/ms-container.c b/plugins/excel/ms-container.c
index ed94e91..b688482 100644
--- a/plugins/excel/ms-container.c
+++ b/plugins/excel/ms-container.c
@@ -132,11 +132,10 @@ ms_container_add_obj (MSContainer *container, MSObj *obj)
 MSObj *
 ms_container_get_obj (MSContainer *c, int obj_id)
 {
-	MSObj *obj;
 	GSList *ptr;
 
 	for (ptr = c->obj_queue ; ptr != NULL ; ptr = ptr->next) {
-		obj = (MSObj *)ptr->data;
+		MSObj *obj = ptr->data;
 		if (obj != NULL && obj->id == obj_id)
 			return obj;
 	}
@@ -155,14 +154,13 @@ void
 ms_container_realize_objs (MSContainer *container)
 {
 	GSList *ptr;
-	MSObj *obj;
 
 	g_return_if_fail (container != NULL);
 	g_return_if_fail (container->vtbl != NULL);
 	g_return_if_fail (container->vtbl->realize_obj != NULL);
 
 	for (ptr = container->obj_queue; ptr != NULL; ptr = ptr->next) {
-		obj = (MSObj *)ptr->data;
+		MSObj *obj = ptr->data;
 		if (obj->gnum_obj != NULL)
 			(void) (*container->vtbl->realize_obj) (container, obj);
 	}
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 5c00af4..22065c4 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -4686,7 +4686,7 @@ excel_read_MERGECELLS (BiffQuery *q, ExcelReadSheet *esheet)
 		xls_read_range16 (&r, data);
 		overlap = gnm_sheet_merge_get_overlap (esheet->sheet, &r);
 		if (overlap) {
-			GnmRange *r2 = (GnmRange *) overlap->data;
+			GnmRange *r2 = overlap->data;
 
 			/* Unmerge r2, then merge (r U r2) */
 			gnm_sheet_merge_remove (esheet->sheet, r2,
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index c68cfec..17a9ca9 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -6187,9 +6187,9 @@ excel_write_workbook (ExcelWriteState *ewb)
 				num_objs += s->num_objs + 1;
 			}
 			for (b = s->blips; b; b = b->next) {
-					BlipInf *bi = (BlipInf *) b->data;
+				BlipInf *bi = b->data;
 				bliplen += (bi->header_len + bi->bytes.len);
-				}
+			}
 		}
 
 		if (ewb->num_obj_groups > 0) {
diff --git a/src/commands.c b/src/commands.c
index 814d829..c46e17b 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -245,7 +245,7 @@ cmd_selection_is_locked_effective (Sheet *sheet, GSList *selection,
 				   WorkbookControl *wbc, char const *cmd_name)
 {
 	for (; selection; selection = selection->next) {
-		GnmRange *range = (GnmRange *)selection->data;
+		GnmRange *range = selection->data;
 		if (cmd_cell_range_is_locked_effective (sheet, range, wbc, cmd_name))
 			return TRUE;
 	}
diff --git a/src/dialogs/dialog-scenarios.c b/src/dialogs/dialog-scenarios.c
index a3c7ad6..ea5b118 100644
--- a/src/dialogs/dialog-scenarios.c
+++ b/src/dialogs/dialog-scenarios.c
@@ -604,7 +604,7 @@ scenarios_cancel_clicked_cb (G_GNUC_UNUSED GtkWidget *button,
 	/* Remove report sheets created on this dialog session. */
 	for (cur = state->new_report_sheets; cur != NULL;
 	     cur = cur->next) {
-		Sheet *sheet = (Sheet *) cur->data;
+		Sheet *sheet = cur->data;
 
 		/* Check that if the focus is on a deleted sheet. */
 		if (wb_control_cur_sheet (wbc) == sheet)
diff --git a/src/file-autoft.c b/src/file-autoft.c
index 8104a15..835cb8b 100644
--- a/src/file-autoft.c
+++ b/src/file-autoft.c
@@ -146,13 +146,10 @@ category_list_get_from_dir_list (GSList *dir_list)
 	g_return_val_if_fail (dir_list != NULL, NULL);
 
 	for (dir_iterator = dir_list; dir_iterator != NULL; dir_iterator = dir_iterator->next) {
-		gchar *dir_name;
+		gchar *dir_name = dir_iterator->data;
 		GDir *dir;
 		char const *d_name;
 
-		dir_name = (gchar *) dir_iterator->data;
-		g_assert (dir_name != NULL);
-
 		dir = g_dir_open (dir_name, 0, NULL);
 		if (dir == NULL)
 			continue;
@@ -229,9 +226,7 @@ category_group_list_get (void)
 
 	current_group = NULL;
 	for (l = categories; l != NULL; l = l->next) {
-		FormatTemplateCategory *category;
-
-		category = (FormatTemplateCategory *) l->data;
+		FormatTemplateCategory *category = l->data;
 		if (current_group == NULL || strcmp (current_group->name, category->name) != 0) {
 			if (current_group != NULL) {
 				category_groups = g_list_prepend (category_groups, current_group);
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index 2c5a20f..5091ce0 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -2539,7 +2539,6 @@ static void
 target_list_add_list (GtkTargetList *targets, GtkTargetList *added_targets)
 {
 	GList *ptr;
-	GtkTargetPair *tp;
 
 	g_return_if_fail (targets != NULL);
 
@@ -2547,7 +2546,7 @@ target_list_add_list (GtkTargetList *targets, GtkTargetList *added_targets)
 		return;
 
 	for (ptr = added_targets->list; ptr !=  NULL; ptr = ptr->next) {
-		tp = (GtkTargetPair *)ptr->data;
+		GtkTargetPair *tp = ptr->data;
 		gtk_target_list_add (targets, tp->target, tp->flags, tp->info);
 	}
 }
@@ -2602,7 +2601,7 @@ gnm_pane_drag_begin (GnmPane *pane, SheetObject *so, GdkEvent *event)
 		GList *l;
 		g_printerr ("%d offered formats:\n", g_list_length (targets->list));
 		for (l = targets->list; l; l = l->next) {
-			GtkTargetPair *pair = (GtkTargetPair *)l->data;
+			GtkTargetPair *pair = l->data;
 			char *target_name = gdk_atom_name (pair->target);
 			g_printerr ("%s\n", target_name);
 			g_free (target_name);
diff --git a/src/graph.c b/src/graph.c
index 1281a71..7f06b1d 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -488,13 +488,13 @@ gnm_go_data_vector_load_len (GODataVector *dat)
 		if (gnm_expr_is_rangeref (vec->dep.texpr->expr) && ((l = gnm_expr_top_get_ranges (vec->dep.texpr)))) {
 			unsigned len = g_slist_length (l);
 			if (l->next == NULL) /* only one range */
-				vec->val = (GnmValue *) l->data;
+				vec->val = l->data;
 			else {
 				GSList *cur = l;
 				unsigned i;
 				vec->val = value_new_array_empty (len, 1);
 				for (i = 0; i < len; i++) {
-					vec->val->v_array.vals[i][0] = (GnmValue *) cur->data;
+					vec->val->v_array.vals[i][0] = cur->data;
 					cur = cur->next;
 				}
 			}
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index 6009d76..2fdb1b9 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -615,7 +615,6 @@ x_targets_received (GtkClipboard *clipboard, GdkAtom *targets,
 	if (table_atom == GDK_NONE) {
 		GtkTargetList *tl = gtk_target_list_new (NULL, 0);
 		GList *l;
-		GtkTargetPair *tp;
 		gboolean found = FALSE;
 
 		gtk_target_list_add_image_targets (tl, 0, FALSE);
@@ -623,7 +622,7 @@ x_targets_received (GtkClipboard *clipboard, GdkAtom *targets,
 		/* Find an image format */
 		for (i = 0 ; i < n_targets && !found; i++) {
 			for (l = tl->list; l && !found; l = l->next) {
-				tp = (GtkTargetPair *)l->data;
+				GtkTargetPair *tp = l->data;
 				if (tp->target == targets[i]) {
 					ctxt->image_atom = targets[i];
 					found = TRUE;
@@ -1009,7 +1008,6 @@ target_list_to_entries (GtkTargetList *target_list, int *n_entries)
 	GtkTargetEntry *entries;
 	int n_targets, i;
 	GList *p;
-	GtkTargetPair *tp;
 
 	if (!target_list || !target_list->list || n_entries == NULL)
 		return NULL;
@@ -1020,7 +1018,7 @@ target_list_to_entries (GtkTargetList *target_list, int *n_entries)
 
 	entries = g_new0 (GtkTargetEntry, n_targets);
 	for (p = target_list->list, i = 0; p != NULL; p = p->next, i++) {
-		tp = (GtkTargetPair *) p->data;
+		GtkTargetPair *tp = p->data;
 		entries[i].target = gdk_atom_name (tp->target);
 		entries[i].flags  = tp->flags;
 		entries[i].info   = tp->info;
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index c29bd3d..7d02b64 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -231,11 +231,10 @@ gnm_sog_get_target_list (SheetObject const *so)
 	GtkTargetList *tl = gtk_target_list_new (NULL, 0);
 	char *mime_str = go_image_format_to_mime ("svg");
 	GSList *mimes, *ptr;
-	char *mime;
 
 	mimes = go_strsplit_to_slist (mime_str, ',');
 	for (ptr = mimes; ptr != NULL; ptr = ptr->next) {
-		mime = (char *) ptr->data;
+		const char *mime = ptr->data;
 
 		if (mime != NULL && *mime != '\0')
 			gtk_target_list_add (tl, gdk_atom_intern (mime, FALSE),
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 2e6de2b..3e60189 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -356,12 +356,11 @@ gnm_soi_get_target_list (SheetObject const *so)
 	GtkTargetList *tl = gtk_target_list_new (NULL, 0);
 	char *mime_str = go_image_format_to_mime (soi->type);
 	GSList *mimes, *ptr;
-	char *mime;
 	GdkPixbuf *pixbuf;
 
 	mimes = go_strsplit_to_slist (mime_str, ',');
 	for (ptr = mimes; ptr != NULL; ptr = ptr->next) {
-		mime = (char *) ptr->data;
+		const char *mime = ptr->data;
 
 		if (mime != NULL && *mime != '\0')
 			gtk_target_list_add (tl, gdk_atom_intern (mime, FALSE),
diff --git a/src/sheet-object.c b/src/sheet-object.c
index 9947cf9..a9a4ba3 100644
--- a/src/sheet-object.c
+++ b/src/sheet-object.c
@@ -1039,17 +1039,15 @@ cb_sheet_objects_dup (GnmDependent *dep, SheetObject *so, gpointer user)
 void
 sheet_objects_dup (Sheet const *src, Sheet *dst, GnmRange *range)
 {
-	SheetObject *so;
-	SheetObject *new_so;
 	GSList *list;
 
 	g_return_if_fail (IS_SHEET (dst));
 	g_return_if_fail (dst->sheet_objects == NULL);
 
 	for (list = src->sheet_objects; list != NULL; list = list->next) {
-		so = (SheetObject *) list->data;
+		SheetObject *so = list->data;
 		if (range == NULL || range_overlap (range, &so->anchor.cell_bound)) {
-			new_so = sheet_object_dup (so);
+			SheetObject *new_so = sheet_object_dup (so);
 			if (new_so != NULL) {
 				sheet_object_set_sheet (new_so, dst);
 				sheet_object_foreach_dep (new_so, cb_sheet_objects_dup,
diff --git a/src/tools/filter.c b/src/tools/filter.c
index 2d9efd0..cd2e789 100644
--- a/src/tools/filter.c
+++ b/src/tools/filter.c
@@ -54,7 +54,7 @@ filter (data_analysis_output_t *dao, Sheet *sheet, GSList *rows,
 			ri->in_advanced_filter = TRUE;
 		}
 		while (rows != NULL) {
-			gint *row = (gint *) rows->data;
+			const gint *row = rows->data;
 			colrow_set_visibility (sheet, FALSE, TRUE, *row, *row);
 			rows = rows->next;
 		}
@@ -75,7 +75,7 @@ filter (data_analysis_output_t *dao, Sheet *sheet, GSList *rows,
 		++r;
 
 		while (rows != NULL) {
-			gint *row = (gint *) rows->data;
+			const gint *row = rows->data;
 			for (i=input_col_b; i<=input_col_e; i++) {
 				cell = sheet_cell_get (sheet, i, *row);
 				if (cell == NULL)
diff --git a/src/tools/simulation.c b/src/tools/simulation.c
index 35de04b..7f5b541 100644
--- a/src/tools/simulation.c
+++ b/src/tools/simulation.c
@@ -84,7 +84,7 @@ eval_inputs_list (simulation_t *sim, gnm_float **outputs, int iter,
 
 	/* Recompute inputs. */
 	for (cur = sim->list_inputs; cur != NULL; cur = cur->next) {
-		GnmCell *cell = (GnmCell *) cur->data;
+		GnmCell *cell = cur->data;
 
 		cell_queue_recalc (cell);
 		gnm_cell_eval (cell);
@@ -111,7 +111,7 @@ eval_outputs_list (simulation_t *sim, gnm_float **outputs, int iter,
 
 	/* Recompute outputs. */
 	for (cur = sim->list_outputs; cur != NULL; cur = cur->next) {
-		GnmCell *cell = (GnmCell *) cur->data;
+		GnmCell *cell = cur->data;
 
 		gnm_cell_eval (cell);
 		if (cell->value == NULL || ! VALUE_IS_NUMBER (cell->value)) {
@@ -376,14 +376,14 @@ simulation_tool (WorkbookControl        *wbc,
 
 	i = 0;
 	for (cur = sim->list_outputs; cur != NULL; cur = cur->next) {
-		GnmCell *cell = (GnmCell *) cur->data;
+		GnmCell *cell = cur->data;
 
 		sim->cellnames[i++] =
 			(gchar *) dao_find_name (sheet, cell->pos.col,
 						 cell->pos.row);
 	}
 	for (cur = sim->list_inputs; cur != NULL; cur = cur->next) {
-		GnmCell *cell = (GnmCell *) cur->data;
+		GnmCell *cell = cur->data;
 		gchar *tmp = dao_find_name (sheet, cell->pos.col,
 					    cell->pos.row);
 		gchar *prefix = _("(Input) ");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]