changeset 24110:2c6c9d72f54f

A couple of compile warning fixes, a couple of memory leak plugs.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 23 Sep 2008 07:51:55 +0000
parents f29588a95ea9
children 14915e96311e
files libpurple/protocols/jabber/data.c libpurple/protocols/jabber/data.h libpurple/protocols/jabber/message.c
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/data.c	Tue Sep 23 07:38:47 2008 +0000
+++ b/libpurple/protocols/jabber/data.c	Tue Sep 23 07:51:55 2008 +0000
@@ -82,9 +82,10 @@
 }
 
 
-void
-jabber_data_delete(JabberData *data)
+static void
+jabber_data_delete(gpointer cbdata)
 {
+	JabberData *data = cbdata;
 	g_free(data->cid);
 	g_free(data->type);
 	g_free(data->data);
--- a/libpurple/protocols/jabber/data.h	Tue Sep 23 07:38:47 2008 +0000
+++ b/libpurple/protocols/jabber/data.h	Tue Sep 23 07:51:55 2008 +0000
@@ -39,8 +39,6 @@
   XEP 0231 */
 JabberData *jabber_data_create_from_xml(xmlnode *tag);
 
-void jabber_data_delete(JabberData *data);
-
 const char *jabber_data_get_cid(const JabberData *data);
 const char *jabber_data_get_type(const JabberData *data);
 
@@ -61,7 +59,7 @@
 const JabberData *jabber_data_find_local_by_alt(const gchar *alt);
 const JabberData *jabber_data_find_local_by_cid(const gchar *cid);
 const JabberData *jabber_data_find_remote_by_cid(const gchar *cid);
-												 
+
 /* store data objects */
 void jabber_data_associate_local(JabberData *data, const gchar *alt);
 void jabber_data_associate_remote(JabberData *data);
--- a/libpurple/protocols/jabber/message.c	Tue Sep 23 07:38:47 2008 +0000
+++ b/libpurple/protocols/jabber/message.c	Tue Sep 23 07:51:55 2008 +0000
@@ -428,13 +428,12 @@
 
 			if (g_str_has_prefix(src, "cid:")) {
 				const gchar *alt = xmlnode_get_attrib(img, "alt");
-				gchar *escaped = NULL;
 				/* if the "alt" attribute is empty, put the cid as smiley string */
 				if (alt && alt[0] != '\0') {
 					/* if the "alt" is the same as the CID, as Jabbim does,
 					 this prevents linkification... */
 					if (purple_email_is_valid(alt)) {
-						const gchar *safe_alt = g_strdup_printf("smiley:%s", alt);
+						gchar *safe_alt = g_strdup_printf("smiley:%s", alt);
 						out = g_string_append(out, safe_alt);
 						g_free(safe_alt);
 					} else {
@@ -596,7 +595,7 @@
 				const gchar *who = xmlnode_get_attrib(packet, "from");
 				PurpleAccount *account = purple_connection_get_account(gc);
 				PurpleConversation *conv = NULL;
-				const GList *smiley_refs = NULL;
+				GList *smiley_refs = NULL;
 				gchar *reformatted_xhtml;
 
 				if (purple_account_get_bool(account, "custom_smileys", TRUE)) {
@@ -683,7 +682,7 @@
 				}
 
 				/* we don't need the list of CIDs anymore */
-				for (; smiley_refs ; smiley_refs = g_list_next(smiley_refs)) {
+				for (; smiley_refs ; smiley_refs = g_list_delete_link(smiley_refs, smiley_refs)) {
 					JabberSmileyRef *ref = (JabberSmileyRef *) smiley_refs->data;
 					g_free(ref->cid);
 					g_free(ref->alt);
@@ -888,6 +887,7 @@
 				g_free(img_text);
 				pos += strlen(escaped);
 				g_free(escaped);
+				xmlnode_free(img);
 				break;
 			} else {
 				/* cleanup from the before the next round... */