pidgin/pidgin

Fix Pidgin clang scan-build warnings

2014-04-03, Tomasz Wasilczyk
1e257009ac10
Parents 3d727b2e6f82
Children 5ef990c032ad
Fix Pidgin clang scan-build warnings
--- a/pidgin/gtkaccount.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkaccount.c Thu Apr 03 18:23:35 2014 +0200
@@ -329,7 +329,7 @@
GHashTable *table = NULL;
const char *label = NULL;
- if(PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(dialog->prpl_info, get_account_text_table)) {
+ if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(dialog->prpl_info, get_account_text_table)) {
table = dialog->prpl_info->get_account_text_table(NULL);
label = g_hash_table_lookup(table, "login_label");
@@ -708,7 +708,7 @@
const char *value = NULL;
char *c;
- if (dialog->account != NULL) {
+ if (dialog->account != NULL && username != NULL) {
if(purple_account_user_split_get_reverse(split))
c = strrchr(username,
purple_account_user_split_get_separator(split));
--- a/pidgin/gtkconv.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkconv.c Thu Apr 03 18:23:35 2014 +0200
@@ -7749,7 +7749,7 @@
gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title);
if (pidgin_conv_window_is_active_conversation(conv)) {
const char* current_title = gtk_window_get_title(GTK_WINDOW(win->window));
- if (current_title == NULL || strcmp(current_title, title) != 0)
+ if (current_title == NULL || g_strcmp0(current_title, title) != 0)
gtk_window_set_title(GTK_WINDOW(win->window), title);
}
--- a/pidgin/gtknotify.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtknotify.c Thu Apr 03 18:23:35 2014 +0200
@@ -789,6 +789,7 @@
g_free(to_text);
g_free(from_text);
g_free(subject_text);
+ (void)first;
/* If we don't keep track of this, will leak "data" for each of the notifications except the last */
data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE, &new_data);
@@ -1737,6 +1738,7 @@
button = gtk_dialog_add_button(GTK_DIALOG(dialog),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+ gtk_widget_set_sensitive(button, TRUE);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
--- a/pidgin/gtkplugin.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkplugin.c Thu Apr 03 18:23:35 2014 +0200
@@ -86,6 +86,9 @@
return TRUE;
}
+ if (!plugin->info)
+ return FALSE;
+
pinfo = plugin->info->prefs_info;
if (!pinfo)
--- a/pidgin/gtkprefs.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkprefs.c Thu Apr 03 18:23:35 2014 +0200
@@ -4027,8 +4027,12 @@
strcpy(pref + strlen(pref) - strlen("plugin"), "device");
devices = get_vv_element_devices(value);
if (g_list_find_custom(devices, purple_prefs_get_string(pref),
- (GCompareFunc)strcmp) == NULL)
- purple_prefs_set_string(pref, g_list_next(devices)->data);
+ (GCompareFunc)strcmp) == NULL)
+ {
+ GList *next = g_list_next(devices);
+ if (next)
+ purple_prefs_set_string(pref, next->data);
+ }
widget = pidgin_prefs_dropdown_from_list(vbox, _("_Device"),
PURPLE_PREF_STRING, pref, devices);
g_list_free_full(devices, g_free);
@@ -4071,8 +4075,12 @@
/* Setup device preference */
devices = get_vv_element_devices(purple_prefs_get_string(plugin_pref));
if (g_list_find_custom(devices, purple_prefs_get_string(device_pref),
- (GCompareFunc)strcmp) == NULL)
- purple_prefs_set_string(device_pref, g_list_next(devices)->data);
+ (GCompareFunc)strcmp) == NULL)
+ {
+ GList *next = g_list_next(devices);
+ if (next)
+ purple_prefs_set_string(device_pref, next->data);
+ }
widget = pidgin_prefs_dropdown_from_list(vbox, _("_Device"),
PURPLE_PREF_STRING, device_pref,
devices);
--- a/pidgin/gtkstatusbox.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkstatusbox.c Thu Apr 03 18:23:35 2014 +0200
@@ -316,9 +316,9 @@
box->icon_box_menu = gtk_menu_new();
- menu_item = pidgin_new_item_from_stock(box->icon_box_menu, _("Select Buddy Icon"), GTK_STOCK_ADD,
- G_CALLBACK(choose_buddy_icon_cb),
- box, 0, 0, NULL);
+ pidgin_new_item_from_stock(box->icon_box_menu,
+ _("Select Buddy Icon"), GTK_STOCK_ADD,
+ G_CALLBACK(choose_buddy_icon_cb), box, 0, 0, NULL);
menu_item = pidgin_new_item_from_stock(box->icon_box_menu, _("Remove"), GTK_STOCK_REMOVE,
G_CALLBACK(remove_buddy_icon_cb),
--- a/pidgin/gtkthemes.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkthemes.c Thu Apr 03 18:23:35 2014 +0200
@@ -272,9 +272,10 @@
child->sml = g_strndup(i+1, strchr(i, ']') - i - 1);
child->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- if (theme->list)
+ if (theme->list) {
+ g_return_if_fail(list != NULL);
list->next = child;
- else
+ } else
theme->list = child;
/* Reverse the Smiley list since it was built in reverse order for efficiency reasons */
if (list != NULL)
--- a/pidgin/gtkwebview.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/gtkwebview.c Thu Apr 03 18:23:35 2014 +0200
@@ -1511,7 +1511,6 @@
pidgin_webview_finalize(GObject *webview)
{
PidginWebViewPriv *priv = PIDGIN_WEBVIEW_GET_PRIVATE(webview);
- gpointer temp;
if (priv->inspector_win != NULL)
gtk_widget_destroy(GTK_WIDGET(priv->inspector_win));
@@ -1520,9 +1519,8 @@
g_source_remove(priv->loader);
while (!g_queue_is_empty(priv->load_queue)) {
- temp = g_queue_pop_head(priv->load_queue);
- temp = g_queue_pop_head(priv->load_queue);
- g_free(temp);
+ g_queue_pop_head(priv->load_queue);
+ g_free(g_queue_pop_head(priv->load_queue));
}
g_queue_free(priv->load_queue);
--- a/pidgin/plugins/extplacement.c Thu Apr 03 18:01:10 2014 +0200
+++ b/pidgin/plugins/extplacement.c Thu Apr 03 18:23:35 2014 +0200
@@ -57,6 +57,13 @@
for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
win = l->data;
+ if (!conv || !conv->active_conv ||
+ !G_TYPE_FROM_INSTANCE(conv->active_conv))
+ {
+ g_warn_if_reached();
+ continue;
+ }
+
if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") &&
G_TYPE_FROM_INSTANCE(pidgin_conv_window_get_active_conversation(win)) != G_TYPE_FROM_INSTANCE(conv->active_conv))
continue;