/dev/tomkiewicz/new-smileys: 60a5d065ca81: Merge default

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu Apr 3 14:36:30 EDT 2014


Changeset: 60a5d065ca814561488bee97db7a73dce1e15534
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-03 20:36 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/60a5d065ca81

Description:

Merge default

diffstat:

 finch/gntplugin.c                          |    5 +
 finch/libgnt/gntbox.c                      |   11 +
 finch/libgnt/gntmain.c                     |    1 +
 finch/libgnt/gntmenu.c                     |    2 +
 finch/libgnt/gnttextview.c                 |   16 +
 finch/libgnt/gnttree.c                     |    3 +-
 finch/libgnt/gntwm.c                       |    6 +
 finch/libgnt/wms/irssi.c                   |    3 +
 finch/libgnt/wms/s.c                       |    3 +
 libpurple/cipher.c                         |  254 +++++++++++++++++-----------
 libpurple/memorypool.c                     |    3 +
 libpurple/protocols/gg/lib/common.c        |    6 +-
 libpurple/protocols/gg/lib/config.h        |    2 +-
 libpurple/protocols/gg/lib/internal.h      |    3 +
 libpurple/protocols/irc/msgs.c             |    4 +-
 libpurple/protocols/jabber/caps.c          |    7 +
 libpurple/protocols/msn/contact.c          |    1 -
 libpurple/protocols/msn/msn.c              |    9 +-
 libpurple/protocols/msn/p2p.c              |    4 +
 libpurple/protocols/mxit/chunk.c           |    6 +
 libpurple/protocols/oscar/family_feedbag.c |    6 +
 libpurple/protocols/silc/buddy.c           |    2 +
 libpurple/protocols/yahoo/yahoo_profile.c  |    6 +-
 libpurple/protocols/zephyr/Zinternal.c     |   20 +-
 libpurple/protocols/zephyr/zephyr.c        |    1 -
 libpurple/prpl.h                           |    4 +-
 libpurple/tests/test_trie.c                |    5 +-
 pidgin/gtkaccount.c                        |    4 +-
 pidgin/gtkconv.c                           |    2 +-
 pidgin/gtknotify.c                         |    2 +
 pidgin/gtkplugin.c                         |    3 +
 pidgin/gtkprefs.c                          |   16 +-
 pidgin/gtkstatusbox.c                      |    6 +-
 pidgin/gtkwebview.c                        |    6 +-
 pidgin/plugins/extplacement.c              |    7 +
 35 files changed, 299 insertions(+), 140 deletions(-)

diffs (truncated from 1090 to 300 lines):

diff --git a/finch/gntplugin.c b/finch/gntplugin.c
--- a/finch/gntplugin.c
+++ b/finch/gntplugin.c
@@ -83,6 +83,9 @@ has_prefs(PurplePlugin *plugin)
 		return TRUE;
 	}
 
+	if (!plugin->info)
+		return FALSE;
+
 	pinfo = plugin->info->prefs_info;
 	if (!pinfo)
 		return FALSE;
@@ -247,6 +250,8 @@ configure_plugin_cb(GntWidget *button, g
 		return;
 	plugin->ui_data = ui_data = g_new0(FinchPluginUiData, 1);
 
+	g_return_if_fail(plugin->info != NULL);
+
 	if (PURPLE_IS_GNT_PLUGIN(plugin) &&
 			(callback = FINCH_PLUGIN_UI_INFO(plugin)) != NULL)
 	{
diff --git a/finch/libgnt/gntbox.c b/finch/libgnt/gntbox.c
--- a/finch/libgnt/gntbox.c
+++ b/finch/libgnt/gntbox.c
@@ -731,6 +731,11 @@ void gnt_box_sync_children(GntBox *box)
 		int height, width;
 		int x, y;
 
+		if (G_UNLIKELY(w == NULL)) {
+			g_warn_if_reached();
+			continue;
+		}
+
 		if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_INVISIBLE))
 			continue;
 
@@ -819,6 +824,12 @@ void gnt_box_readjust(GntBox *box)
 	for (iter = box->list; iter; iter = iter->next)
 	{
 		GntWidget *w = iter->data;
+
+		if (G_UNLIKELY(w == NULL)) {
+			g_warn_if_reached();
+			continue;
+		}
+
 		if (GNT_IS_BOX(w))
 			gnt_box_readjust(GNT_BOX(w));
 		else
diff --git a/finch/libgnt/gntmain.c b/finch/libgnt/gntmain.c
--- a/finch/libgnt/gntmain.c
+++ b/finch/libgnt/gntmain.c
@@ -469,6 +469,7 @@ void gnt_init()
 
 #ifdef NO_WIDECHAR
 	ascii_only = TRUE;
+	(void)locale;
 #else
 	if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) {
 		ascii_only = FALSE;
diff --git a/finch/libgnt/gntmenu.c b/finch/libgnt/gntmenu.c
--- a/finch/libgnt/gntmenu.c
+++ b/finch/libgnt/gntmenu.c
@@ -121,6 +121,8 @@ menu_tree_add(GntMenu *menu, GntMenuItem
 {
 	char trigger[4] = "\0 )\0";
 
+	g_return_if_fail(item != NULL);
+
 	if ((trigger[1] = gnt_menuitem_get_trigger(item)) && trigger[1] != ' ')
 		trigger[0] = '(';
 
diff --git a/finch/libgnt/gnttextview.c b/finch/libgnt/gnttextview.c
--- a/finch/libgnt/gnttextview.c
+++ b/finch/libgnt/gnttextview.c
@@ -335,7 +335,13 @@ gnt_text_view_clicked(GntWidget *widget,
 		GntTextView *view = GNT_TEXT_VIEW(widget);
 		if (text_view_contains(view, select_start)) {
 			GString *clip;
+
+			g_return_val_if_fail(select_start != NULL, TRUE);
+
 			select_end = gnt_text_view_get_p(view, x - widget->priv.x, y - widget->priv.y);
+
+			g_return_val_if_fail(select_end != NULL, TRUE);
+
 			if (select_end < select_start) {
 				gchar *t = select_start;
 				select_start = select_end;
@@ -758,6 +764,12 @@ int gnt_text_view_tag_change(GntTextView
 				GList *segs, *snext;
 				GntTextLine *line = iter->data;
 				inext = iter->next;
+
+				if (G_UNLIKELY(line == NULL)) {
+					g_warn_if_reached();
+					continue;
+				}
+
 				for (segs = line->segments; segs; segs = snext) {
 					GntTextSegment *seg = segs->data;
 					snext = segs->next;
@@ -771,6 +783,10 @@ int gnt_text_view_tag_change(GntTextView
 						/* This segment starts in the middle of the tag */
 						if (text == NULL) {
 							free_text_segment(seg, NULL);
+							if (G_UNLIKELY(line == NULL)) {
+								g_warn_if_reached();
+								break;
+							}
 							line->segments = g_list_delete_link(line->segments, segs);
 							if (line->segments == NULL) {
 								free_text_line(line, NULL);
diff --git a/finch/libgnt/gnttree.c b/finch/libgnt/gnttree.c
--- a/finch/libgnt/gnttree.c
+++ b/finch/libgnt/gnttree.c
@@ -1314,7 +1314,8 @@ void gnt_tree_sort_row(GntTree *tree, gp
 		else
 			tree->root = row;
 		row->next = s;
-		s->prev = row;  /* s cannot be NULL */
+		g_return_if_fail(s != NULL); /* s cannot be NULL */
+		s->prev = row;
 		row->prev = NULL;
 		newp = g_list_index(tree->list, s) - 1;
 	} else {
diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -2251,8 +2251,14 @@ gboolean gnt_wm_process_click(GntWM *wm,
 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget)
 {
 	GntWS *ws = gnt_wm_widget_find_workspace(wm, widget);
+
+	g_return_if_fail(wm != NULL);
+
 	if (wm->cws != ws)
 		gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws));
+
+	g_return_if_fail(wm->cws != NULL);
+
 	if (widget != wm->cws->ordered->data) {
 		GntWidget *wid = wm->cws->ordered->data;
 		wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget);
diff --git a/finch/libgnt/wms/irssi.c b/finch/libgnt/wms/irssi.c
--- a/finch/libgnt/wms/irssi.c
+++ b/finch/libgnt/wms/irssi.c
@@ -155,6 +155,9 @@ irssi_new_window(GntWM *wm, GntWidget *w
 	const char *name;
 	int x, y, w, h;
 
+	g_return_if_fail(win != NULL);
+	g_return_if_fail(wm != NULL);
+
 	name = gnt_widget_get_name(win);
 	if (!name || !strstr(name, "conversation-window")) {
 		if (!GNT_IS_MENU(win) && !GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_TRANSIENT)) {
diff --git a/finch/libgnt/wms/s.c b/finch/libgnt/wms/s.c
--- a/finch/libgnt/wms/s.c
+++ b/finch/libgnt/wms/s.c
@@ -84,6 +84,9 @@ s_new_window(GntWM *wm, GntWidget *win)
 	const char *name;
 	gboolean blist = FALSE;
 
+	g_return_if_fail(win != NULL);
+	g_return_if_fail(wm != NULL);
+
 	if (!GNT_IS_MENU(win)) {
 		getmaxyx(stdscr, maxy, maxx);
 
diff --git a/libpurple/cipher.c b/libpurple/cipher.c
--- a/libpurple/cipher.c
+++ b/libpurple/cipher.c
@@ -51,6 +51,46 @@ purple_cipher_get_type(void) {
 	return type;
 }
 
+static const gchar *
+purple_cipher_get_name(PurpleCipher *cipher)
+{
+	PurpleCipherClass *klass;
+	const gchar *name;
+
+	if (!PURPLE_IS_CIPHER(cipher))
+		return "(error: not a cipher)";
+
+	klass = PURPLE_CIPHER_GET_CLASS(cipher);
+	if (!klass)
+		return "(error: unknown cipher class)";
+
+	name = g_type_name(G_TYPE_FROM_CLASS(klass));
+	if (!name)
+		return "(error: unknown cipher name)";
+
+	return name;
+}
+
+static const gchar *
+purple_hash_get_name(PurpleHash *hash)
+{
+	PurpleHashClass *klass;
+	const gchar *name;
+
+	if (!PURPLE_IS_HASH(hash))
+		return "(error: not a hash)";
+
+	klass = PURPLE_HASH_GET_CLASS(hash);
+	if (!klass)
+		return "(error: unknown hash class)";
+
+	name = g_type_name(G_TYPE_FROM_CLASS(klass));
+	if (!name)
+		return "(error: unknown hash name)";
+
+	return name;
+}
+
 void
 purple_cipher_reset(PurpleCipher *cipher) {
 	PurpleCipherClass *klass = NULL;
@@ -59,12 +99,13 @@ purple_cipher_reset(PurpleCipher *cipher
 
 	klass = PURPLE_CIPHER_GET_CLASS(cipher);
 
-	if(klass && klass->reset)
+	if (klass && klass->reset)
 		klass->reset(cipher);
-	else
-		purple_debug_warning("cipher", "the %s cipher does not implement the "
-						"reset method\n",
-						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
+	else {
+		purple_debug_warning("cipher", "the %s cipher does not "
+			"implement the reset method",
+			purple_cipher_get_name(cipher));
+	}
 }
 
 void
@@ -75,12 +116,13 @@ purple_cipher_reset_state(PurpleCipher *
 
 	klass = PURPLE_CIPHER_GET_CLASS(cipher);
 
-	if(klass && klass->reset_state)
+	if (klass && klass->reset_state)
 		klass->reset_state(cipher);
-	else
-		purple_debug_warning("cipher", "the %s cipher does not implement the "
-						"reset_state method\n",
-						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
+	else {
+		purple_debug_warning("cipher", "the %s cipher does not "
+			"implement the reset_state method",
+			purple_cipher_get_name(cipher));
+	}
 }
 
 void
@@ -93,12 +135,13 @@ purple_cipher_set_iv(PurpleCipher *ciphe
 
 	klass = PURPLE_CIPHER_GET_CLASS(cipher);
 
-	if(klass && klass->set_iv)
+	if (klass && klass->set_iv)
 		klass->set_iv(cipher, iv, len);
-	else
-		purple_debug_warning("cipher", "the %s cipher does not implement the "
-						"set_iv method\n",
-						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
+	else {
+		purple_debug_warning("cipher", "the %s cipher does not "
+			"implement the set_iv method",
+			purple_cipher_get_name(cipher));
+	}
 }
 
 void
@@ -111,12 +154,13 @@ purple_cipher_append(PurpleCipher *ciphe
 
 	klass = PURPLE_CIPHER_GET_CLASS(cipher);
 
-	if(klass && klass->append)
+	if (klass && klass->append)
 		klass->append(cipher, data, len);
-	else
-		purple_debug_warning("cipher", "the %s cipher does not implement the "
-						"append method\n",
-						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
+	else {
+		purple_debug_warning("cipher", "the %s cipher does not "
+			"implement the append method",
+			purple_cipher_get_name(cipher));
+	}
 }
 
 gboolean
@@ -128,12 +172,13 @@ purple_cipher_digest(PurpleCipher *ciphe
 
 	klass = PURPLE_CIPHER_GET_CLASS(cipher);



More information about the Commits mailing list