[nautilus] all: fix some issues highlighted by static analysis



commit c039b03590c86f5142c78d616700ef7af7c8a5a8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 26 16:19:31 2012 -0400

    all: fix some issues highlighted by static analysis
    
    Thanks to Jasper for the clang scanner tricks.

 libnautilus-private/nautilus-file-operations.c |   30 +++++++++---------
 libnautilus-private/nautilus-file.c            |    3 --
 libnautilus-private/nautilus-icon-container.c  |    5 ---
 libnautilus-private/nautilus-icon-dnd.c        |    2 -
 src/nautilus-notebook.c                        |   10 +-----
 src/nautilus-pathbar.c                         |    3 --
 src/nautilus-properties-window.c               |   39 ++++++++++++-----------
 src/nautilus-query-editor.c                    |    1 -
 src/nautilus-view.c                            |    3 --
 src/nautilus-window.c                          |    2 -
 10 files changed, 36 insertions(+), 62 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 00326b7..0ed15c5 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -2802,13 +2802,13 @@ verify_destination (CommonJob *job,
 		primary = f (_("Error while copying to \"%B\"."), dest);
 		secondary = f (_("The destination is not a folder."));
 
-		response = run_error (job,
-				      primary,
-				      secondary,
-				      NULL,
-				      FALSE,
-				      GTK_STOCK_CANCEL,
-				      NULL);
+		run_error (job,
+			   primary,
+			   secondary,
+			   NULL,
+			   FALSE,
+			   GTK_STOCK_CANCEL,
+			   NULL);
 		
 		abort_job (job);
 		return;
@@ -2866,13 +2866,13 @@ verify_destination (CommonJob *job,
 		primary = f (_("Error while copying to \"%B\"."), dest);
 		secondary = f (_("The destination is read-only."));
 
-		response = run_error (job,
-				      primary,
-				      secondary,
-				      NULL,
-				      FALSE,
-				      GTK_STOCK_CANCEL,
-				      NULL);
+		run_error (job,
+			   primary,
+			   secondary,
+			   NULL,
+			   FALSE,
+			   GTK_STOCK_CANCEL,
+			   NULL);
 		
 		g_error_free (error);
 
@@ -5351,7 +5351,7 @@ link_file (CopyMoveJob *job,
 	}
 	
 	/* Other error */
-	else {
+	else if (error != NULL) {
 		if (common->skip_all_error) {
 			goto out;
 		}
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 05354c0..3651416 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1177,8 +1177,6 @@ nautilus_file_get_start_stop_type (NautilusFile *file)
 
 	g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
 
-	ret = G_DRIVE_START_STOP_TYPE_UNKNOWN;
-
 	ret = file->details->start_stop_type;
 	if (ret != G_DRIVE_START_STOP_TYPE_UNKNOWN)
 		goto out;
@@ -2710,7 +2708,6 @@ get_time (NautilusFile *file,
 		return UNKNOWN;
 	}
 
-	time = 0;
 	switch (type) {
 	case NAUTILUS_DATE_TYPE_MODIFIED:
 		time = file->details->mtime;
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 7c67845..69aa1d0 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -1318,8 +1318,6 @@ lay_down_icons_horizontal (NautilusIconContainer *container,
 								 &bounds.x1, &bounds.y1);
 
 		icon_bounds = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
-		text_bounds = nautilus_icon_canvas_item_get_text_rectangle (icon->item, TRUE);
-
 		icon_width = ceil ((bounds.x1 - bounds.x0)/grid_width) * grid_width;
 		
 		/* Calculate size above/below baseline */
@@ -1386,9 +1384,6 @@ lay_down_icons_horizontal (NautilusIconContainer *container,
 			}
 		
 		lay_down_one_line (container, line_start, NULL, y, max_height_above, positions, TRUE);
-		
-		/* Advance to next line. */
-		y += max_height_below + ICON_PAD_BOTTOM;
 	}
 
 	g_array_free (positions, TRUE);
diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c
index eb85f1b..5afe2c7 100644
--- a/libnautilus-private/nautilus-icon-dnd.c
+++ b/libnautilus-private/nautilus-icon-dnd.c
@@ -587,8 +587,6 @@ nautilus_icon_container_selection_items_local (NautilusIconContainer *container,
 	/* must have at least one item */
 	g_assert (items);
 
-	result = FALSE;
-
 	/* get the URI associated with the container */
 	container_uri_string = get_container_uri (container);
 	
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index c9cc5b1..743b896 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -436,16 +436,8 @@ nautilus_notebook_add_tab (NautilusNotebook *notebook,
 	nautilus_notebook_sync_tab_label (notebook, slot);
 	nautilus_notebook_sync_loading (notebook, slot);
 
-
-	/* FIXME gtk bug! */
-	/* FIXME: this should be fixed in gtk 2.12; check & remove this! */
-	/* The signal handler may have reordered the tabs */
-	position = gtk_notebook_page_num (gnotebook, GTK_WIDGET (slot));
-
-	if (jump_to)
-	{
+	if (jump_to) {
 		gtk_notebook_set_current_page (gnotebook, position);
-
 	}
 
 	return position;
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index c0317bb..019e1ed 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -606,10 +606,8 @@ nautilus_path_bar_size_allocate (GtkWidget     *widget,
 
                 if (direction == GTK_TEXT_DIR_RTL) {
 			child_allocation.x -= path_bar->spacing;
-	  		down_slider_offset = child_allocation.x - widget_allocation.x - path_bar->slider_width;
 	  		down_slider_offset = 0;
 		} else {
-			down_slider_offset = child_allocation.x - widget_allocation.x;
 	  		down_slider_offset = allocation->width - path_bar->slider_width;
 	  		child_allocation.x += child_allocation.width + path_bar->spacing;
 		}
@@ -1741,7 +1739,6 @@ nautilus_path_bar_update_path (NautilusPathBar *path_bar,
 	fake_root = NULL;
         result = TRUE;
 	first_directory = TRUE;
-	last_directory = FALSE;
 	new_buttons = NULL;
 	current_button_data = NULL;
 
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index db3b2eb..7a772c8 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2033,7 +2033,6 @@ directory_contents_value_field_update (NautilusPropertiesWindow *window)
 	g_assert (NAUTILUS_IS_PROPERTIES_WINDOW (window));
 
 	status = NAUTILUS_REQUEST_DONE;
-	file_status = NAUTILUS_REQUEST_NOT_STARTED;
 	total_count = window->details->total_count;
 	total_size = window->details->total_size;
 	unreadable_directory_count = FALSE;
@@ -4115,8 +4114,7 @@ create_simple_permissions (NautilusPropertiesWindow *window, GtkGrid *page_grid)
 	}
 
 	append_blank_slim_row (page_grid);
-
-	group_label = attach_title_field (page_grid, _("Others"));
+	attach_title_field (page_grid, _("Others"));
 	
 	if (has_directory) {
 		add_permissions_combo_box (window, page_grid,
@@ -4161,7 +4159,8 @@ create_permission_checkboxes (NautilusPropertiesWindow *window,
 	gtk_grid_attach_next_to (page_grid, GTK_WIDGET (check_button_grid),
 				 GTK_WIDGET (owner_perm_label),
 				 GTK_POS_RIGHT, 1, 3);
-	
+
+	/* user */
 	w = add_permissions_checkbox (window,
 				      check_button_grid, 
 				      NULL,
@@ -4178,14 +4177,15 @@ create_permission_checkboxes (NautilusPropertiesWindow *window,
 				      owner_perm_label,
 				      is_folder);
 
-	w = add_permissions_checkbox (window,
-				      check_button_grid,
-				      w,
-				      PERMISSIONS_CHECKBOXES_EXECUTE,
-				      UNIX_PERM_USER_EXEC,
-				      owner_perm_label,
-				      is_folder);
+	add_permissions_checkbox (window,
+				  check_button_grid,
+				  w,
+				  PERMISSIONS_CHECKBOXES_EXECUTE,
+				  UNIX_PERM_USER_EXEC,
+				  owner_perm_label,
+				  is_folder);
 
+	/* group */
 	w = add_permissions_checkbox (window,
 				      check_button_grid, 
 				      NULL,
@@ -4202,14 +4202,15 @@ create_permission_checkboxes (NautilusPropertiesWindow *window,
 				      group_perm_label,
 				      is_folder);
 	
-	w = add_permissions_checkbox (window,
-				      check_button_grid, 
-				      w,
-				      PERMISSIONS_CHECKBOXES_EXECUTE,
-				      UNIX_PERM_GROUP_EXEC,
-				      group_perm_label,
-				      is_folder);
-	
+	add_permissions_checkbox (window,
+				  check_button_grid, 
+				  w,
+				  PERMISSIONS_CHECKBOXES_EXECUTE,
+				  UNIX_PERM_GROUP_EXEC,
+				  group_perm_label,
+				  is_folder);
+
+	/* other */
 	w = add_permissions_checkbox (window,
 				      check_button_grid, 
 				      NULL,
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index cc9596b..2816823 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -810,7 +810,6 @@ type_add_rows_from_query (NautilusQueryEditor    *editor,
 
 		row = nautilus_query_editor_add_row (editor,
 						     NAUTILUS_QUERY_EDITOR_ROW_TYPE);
-		model = gtk_combo_box_get_model (GTK_COMBO_BOX (row->type_widget));
 		
 		type_add_custom_type (row, mime_type, desc, &iter);
 		gtk_combo_box_set_active_iter  (GTK_COMBO_BOX (row->type_widget),
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index fcc310b..1204ed7 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -2408,7 +2408,6 @@ update_undo_actions (NautilusView *view)
 
 	undo_label = undo_description = redo_label = redo_description = NULL;
 
-	is_undo = FALSE;
 	undo_active = FALSE;
 	redo_active = FALSE;
 
@@ -4536,8 +4535,6 @@ reset_open_with_menu (NautilusView *view, GList *selection)
 				      "OpenWithGroup",
 				      &view->details->open_with_merge_id,
 				      &view->details->open_with_action_group);
-	
-	num_applications = 0;
 
 	other_applications_visible = (selection != NULL);
 	filter_default = (selection != NULL);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 300073d..a46c43d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1465,7 +1465,6 @@ nautilus_window_sync_zoom_widgets (NautilusWindow *window)
 		can_zoom_in = can_zoom && nautilus_view_can_zoom_in (view);
 		can_zoom_out = can_zoom && nautilus_view_can_zoom_out (view);
 	} else {
-		zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
 		supports_zooming = FALSE;
 		can_zoom = FALSE;
 		can_zoom_in = FALSE;
@@ -1823,7 +1822,6 @@ nautilus_window_button_press_event (GtkWidget *widget,
 	NautilusWindow *window;
 	gboolean handled;
 
-	handled = FALSE;
 	window = NAUTILUS_WINDOW (widget);
 
 	if (mouse_extra_buttons && (event->button == mouse_back_button)) {



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