From 32a360d6c14df5f5338ac602cce3174c2443aa47 Mon Sep 17 00:00:00 2001 From: Monsta Date: Sun, 9 Nov 2014 13:10:36 +0300 Subject: pidgin plugin: various fixes - add missing spaces (code looked ugly) - remove a GError variable which has never been used actually (and avoid dereferencing NULL pointer at the same time) - don't leak memory --- sendto/plugins/pidgin/pidgin.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'sendto') diff --git a/sendto/plugins/pidgin/pidgin.c b/sendto/plugins/pidgin/pidgin.c index 941d2b6..3189c71 100644 --- a/sendto/plugins/pidgin/pidgin.c +++ b/sendto/plugins/pidgin/pidgin.c @@ -371,7 +371,6 @@ static gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, GList *file_list) { - GError *error; GList *file_iter; GFile *file; @@ -387,7 +386,7 @@ gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, GValue val = {0,}; - if(proxy == NULL) + if (proxy == NULL) return FALSE; gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter); @@ -403,25 +402,24 @@ gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, alias = g_value_get_string (&val); contacts_group = g_hash_table_lookup (contact_hash, alias); g_value_unset (&val); - dat = g_ptr_array_index (contacts_group, (depth == 2)?indices[1]:0); + dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0); - for(file_iter = file_list; file_iter != NULL; + for (file_iter = file_list; file_iter != NULL; file_iter = g_list_next(file_iter)) { - error= NULL; - file = g_file_new_for_uri ((gchar *)file_iter->data); file_path = g_file_get_path (file); g_object_unref (file); - if(file_path == NULL) { - g_warning("[Pidgin] %d Unable to convert URI `%s' to absolute file path", - error->code, (gchar *)file_iter->data); - g_error_free(error); + if (file_path == NULL) { + g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path", + (gchar *)file_iter->data); continue; } - if(!send_file(dat->account, dat->name, file_path)) + if (!send_file(dat->account, dat->name, file_path)) g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name); + + g_free (file_path); } return TRUE; } -- cgit v1.2.1