[Xfce4-commits] [xfce/xfce4-settings] 01/01: Fix logically dead code in a few components, prevent division by zero
noreply at xfce.org
noreply at xfce.org
Sat Feb 7 02:24:26 CET 2015
This is an automated email from the git hooks/post-receive script.
bluesabre pushed a commit to branch master
in repository xfce/xfce4-settings.
commit 74a1bdb748807c3126c55f571ee1495eb50dbec2
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Fri Feb 6 20:24:21 2015 -0500
Fix logically dead code in a few components, prevent division by zero
---
dialogs/display-settings/main.c | 19 +++++++++----------
dialogs/keyboard-settings/xfce-keyboard-settings.c | 2 +-
xfsettingsd/clipboard-manager.c | 9 +++++++--
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 93d7dc1..5ea3489 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1191,14 +1191,9 @@ display_settings_combobox_populate (GtkBuilder *builder)
{
/* Insert the output in the store */
gtk_list_store_append (store, &iter);
- if (xfce_randr->mode[m] == None)
- gtk_list_store_set (store, &iter,
- COLUMN_OUTPUT_NAME, xfce_randr->friendly_name[m],
- COLUMN_OUTPUT_ID, m, -1);
- else
- gtk_list_store_set (store, &iter,
- COLUMN_OUTPUT_NAME, xfce_randr->friendly_name[m],
- COLUMN_OUTPUT_ID, m, -1);
+ gtk_list_store_set (store, &iter,
+ COLUMN_OUTPUT_NAME, xfce_randr->friendly_name[m],
+ COLUMN_OUTPUT_ID, m, -1);
/* Select active output */
if (m == active_output)
@@ -1568,7 +1563,7 @@ get_mirrored_configuration (void)
if (!xfce_randr)
return FALSE;
- if (!xfce_randr->noutput > 1)
+ if (xfce_randr->noutput <= 1)
return FALSE;
/* Can outputs be cloned? */
@@ -3082,6 +3077,7 @@ main (gint argc, gchar **argv)
if (!xfce_randr)
{
+ succeeded = FALSE;
command = g_find_program_in_path ("amdcccle");
if (command != NULL)
@@ -3112,7 +3108,10 @@ main (gint argc, gchar **argv)
/* Hook to make sure the libxfce4ui library is linked */
if (xfce_titled_dialog_get_type () == 0)
- return EXIT_FAILURE;
+ {
+ succeeded = FALSE;
+ goto cleanup;
+ }
if (xfce_randr->noutput <= 1 || !minimal)
display_settings_show_main_dialog (display);
diff --git a/dialogs/keyboard-settings/xfce-keyboard-settings.c b/dialogs/keyboard-settings/xfce-keyboard-settings.c
index 63b461a..384f17d 100644
--- a/dialogs/keyboard-settings/xfce-keyboard-settings.c
+++ b/dialogs/keyboard-settings/xfce-keyboard-settings.c
@@ -1076,7 +1076,7 @@ xfce_keyboard_settings_edit_button_clicked (XfceKeyboardSettings *settings)
if (G_LIKELY (gtk_tree_model_get_iter (model, &iter, path)))
{
GtkWidget *command_dialog;
- gboolean finished;
+ gboolean finished = FALSE;
gboolean snotify;
gchar *shortcut_label;
gchar *shortcut;
diff --git a/xfsettingsd/clipboard-manager.c b/xfsettingsd/clipboard-manager.c
index dbf2f0d..b142915 100644
--- a/xfsettingsd/clipboard-manager.c
+++ b/xfsettingsd/clipboard-manager.c
@@ -406,6 +406,7 @@ send_incrementally (GsdClipboardManager *manager,
IncrConversion *rdata;
gulong length;
gulong items;
+ gulong bytes;
guchar *data;
list = g_slist_find_custom (manager->priv->conversions, xev,
@@ -422,7 +423,9 @@ send_incrementally (GsdClipboardManager *manager,
rdata->offset += length;
- items = length / clipboard_bytes_per_item (rdata->data->format);
+ bytes = clipboard_bytes_per_item (rdata->data->format);
+ items = bytes == 0 ? 0 : length / bytes;
+
XChangeProperty (manager->priv->display, rdata->requestor,
rdata->property, rdata->data->type,
rdata->data->format, PropModeAppend,
@@ -533,6 +536,7 @@ convert_clipboard_target (IncrConversion *rdata,
gint n_targets;
GSList *list;
gulong items;
+ gulong bytes;
XWindowAttributes atts;
if (rdata->target == XA_TARGETS) {
@@ -571,7 +575,8 @@ convert_clipboard_target (IncrConversion *rdata,
}
rdata->data = target_data_ref (tdata);
- items = tdata->length / clipboard_bytes_per_item (tdata->format);
+ bytes = clipboard_bytes_per_item (tdata->format);
+ items = bytes == 0 ? 0 : tdata->length / bytes;
if (tdata->length <= SELECTION_MAX_SIZE)
XChangeProperty (manager->priv->display, rdata->requestor,
rdata->property,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list