[Xfce4-commits] [xfce/exo] 01/01: Close open fd, fix typo, prevent null dereference and division by 0, remove unused code

noreply at xfce.org noreply at xfce.org
Wed Feb 18 04:19:13 CET 2015


This is an automated email from the git hooks/post-receive script.

bluesabre pushed a commit to branch master
in repository xfce/exo.

commit 1a63e7adc00d06b0c1c9ad4556036dc72cfe6994
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Tue Feb 17 22:19:05 2015 -0500

    Close open fd, fix typo, prevent null dereference and division by 0, remove unused code
---
 exo-helper/exo-helper-chooser.c |    2 +-
 exo/exo-gdk-pixbuf-extensions.c |    2 ++
 exo/exo-icon-view-accessible.c  |    2 +-
 exo/exo-icon-view.c             |   10 ++++------
 exo/exo-wrap-table.c            |    5 +++--
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/exo-helper/exo-helper-chooser.c b/exo-helper/exo-helper-chooser.c
index aeebef3..8b6a9e3 100644
--- a/exo-helper/exo-helper-chooser.c
+++ b/exo-helper/exo-helper-chooser.c
@@ -255,7 +255,7 @@ exo_helper_chooser_update (ExoHelperChooser *chooser)
   const gchar  *icon_name;
   ExoHelper    *helper;
   GdkPixbuf    *icon = NULL;
-  gint          icon_size;
+  gint          icon_size = 0;
 
   g_return_if_fail (EXO_IS_HELPER_CHOOSER (chooser));
 
diff --git a/exo/exo-gdk-pixbuf-extensions.c b/exo/exo-gdk-pixbuf-extensions.c
index cdf6427..f9f1d97 100644
--- a/exo/exo-gdk-pixbuf-extensions.c
+++ b/exo/exo-gdk-pixbuf-extensions.c
@@ -786,6 +786,8 @@ err1: /* initialize the library's i18n support */
       display_name = g_filename_display_name (filename);
       g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (sverrno), _("Failed to open file \"%s\": %s"), display_name, g_strerror (sverrno));
       g_free (display_name);
+
+      close(fd);
       return NULL;
     }
 
diff --git a/exo/exo-icon-view-accessible.c b/exo/exo-icon-view-accessible.c
index 7bb9157..bbbbeca 100644
--- a/exo/exo-icon-view-accessible.c
+++ b/exo/exo-icon-view-accessible.c
@@ -871,7 +871,7 @@ exo_icon_view_item_accessible_is_showing (ExoIconViewItemAccessible *item)
   if (icon_view->priv->hadjustment)
     visible_rect.x += icon_view->priv->hadjustment->value;
   visible_rect.y = 0;
-  if (icon_view->priv->hadjustment)
+  if (icon_view->priv->vadjustment)
     visible_rect.y += icon_view->priv->vadjustment->value;
   visible_rect.width = item->widget->allocation.width;
   visible_rect.height = item->widget->allocation.height;
diff --git a/exo/exo-icon-view.c b/exo/exo-icon-view.c
index 0287df4..388e2a5 100644
--- a/exo/exo-icon-view.c
+++ b/exo/exo-icon-view.c
@@ -3805,11 +3805,7 @@ exo_icon_view_get_item_at_coords (const ExoIconView    *icon_view,
 
                   box = item->box[info->position];
                   if ((x >= box.x && x <= box.x + box.width &&
-                       y >= box.y && y <= box.y + box.height) ||
-                      (x >= box.x  &&
-                       x <= box.x + box.width &&
-                       y >= box.y &&
-                       y <= box.y + box.height))
+                       y >= box.y && y <= box.y + box.height))
                     {
                       if (cell_at_pos != NULL)
                         *cell_at_pos = info;
@@ -4172,7 +4168,6 @@ find_cell (ExoIconView     *icon_view,
   if (cell < 0)
     {
       current = step > 0 ? 0 : n_focusable - 1;
-      cell = focusable[current];
     }
 
   if (current + *count < 0)
@@ -5955,6 +5950,9 @@ exo_icon_view_set_cursor (ExoIconView     *icon_view,
   /* scroll to the item (maybe delayed) */
   exo_icon_view_scroll_to_path (icon_view, path, FALSE, 0.0f, 0.0f);
 
+  if (!info)
+    return;
+
   if (start_editing)
     exo_icon_view_start_editing (icon_view, item, info, NULL);
 }
diff --git a/exo/exo-wrap-table.c b/exo/exo-wrap-table.c
index 020cea6..2b2ed24 100644
--- a/exo/exo-wrap-table.c
+++ b/exo/exo-wrap-table.c
@@ -264,7 +264,7 @@ exo_wrap_table_size_request (GtkWidget      *widget,
   gint          max_height = 0;
   gint          num_children;
   gint          num_cols;
-  gint          num_rows;
+  gint          num_rows = 0;
 
   /* determine the max size request */
   num_children = exo_wrap_table_get_max_child_size (table, &max_width, &max_height);
@@ -275,7 +275,8 @@ exo_wrap_table_size_request (GtkWidget      *widget,
       num_cols = exo_wrap_table_get_num_fitting (widget->allocation.width
                                                  - GTK_CONTAINER (widget)->border_width * 2,
                                                  table->priv->col_spacing, max_width);
-      num_rows = num_children / num_cols;
+      if (G_LIKELY (num_cols > 0))
+        num_rows = num_children / num_cols;
       num_rows = MAX (num_rows, 1);
 
       if ((num_children % num_rows) > 0)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list