gobjectification: 0f8b96e8: Fixed some casting

aluink at soc.pidgin.im aluink at soc.pidgin.im
Wed Jul 15 23:05:34 EDT 2009


-----------------------------------------------------------------
Revision: 0f8b96e8a4baefb1049aee2d250f30cd41ecd68d
Ancestor: 88410be64b652329905cc1f5d103ff8ef8860f23
Author: aluink at soc.pidgin.im
Date: 2009-07-16T02:59:09
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/0f8b96e8a4baefb1049aee2d250f30cd41ecd68d

Modified files:
        libpurple/blist.c libpurple/buddy.c libpurple/chat.c
        libpurple/contact.c libpurple/group.c

ChangeLog: 

Fixed some casting

-------------- next part --------------
============================================================
--- libpurple/blist.c	635658623a50d0d0de2eada54b96e2fe66a5e5ef
+++ libpurple/blist.c	eae3e2bb17edaa994febf88cc06a1ba8d781f88e
@@ -294,7 +294,7 @@ parse_group(xmlnode *groupnode)
 		if (cnode->type != XMLNODE_TYPE_TAG)
 			continue;
 		if (purple_strequal(cnode->name, "setting"))
-			parse_setting((PurpleBlistNode*)group, cnode);
+			parse_setting(PURPLE_BLIST_NODE(group), cnode);
 		else if (purple_strequal(cnode->name, "contact") ||
 				purple_strequal(cnode->name, "person"))
 			parse_contact(group, cnode);
@@ -457,8 +457,8 @@ void purple_blist_rename_group(PurpleGro
 		/* We're merging two groups */
 		PurpleBlistNode *prev, *child, *next;
 
-		prev = purple_blist_get_last_child((PurpleBlistNode*)dest);
-		child = ((PurpleBlistNode*)source)->child;
+		prev = purple_blist_get_last_child(PURPLE_BLIST_NODE(dest));
+		child = (PURPLE_BLIST_NODE(source))->child;
 
 		/*
 		 * TODO: This seems like a dumb way to do this... why not just
@@ -532,7 +532,7 @@ void purple_blist_rename_group(PurpleGro
 				PurpleBuddy *buddy = (PurpleBuddy *)l->data;
 
 				if(buddy && purple_buddy_get_account(buddy)== account)
-					buddies = g_list_append(buddies, (PurpleBlistNode *)buddy);
+					buddies = g_list_append(buddies, PURPLE_BLIST_NODE(buddy));
 			}
 
 			if(prpl_info->rename_group) {
@@ -542,7 +542,7 @@ void purple_blist_rename_group(PurpleGro
 
 				/* Make a list of what the groups each buddy is in */
 				for(cur = buddies; cur; cur = cur->next) {
-					PurpleBlistNode *node = (PurpleBlistNode *)cur->data;
+					PurpleBlistNode *node = PURPLE_BLIST_NODE(cur->data);
 					groups = g_list_prepend(groups, node->parent->parent);
 				}
 
@@ -574,7 +574,7 @@ void purple_blist_rename_buddy(PurpleBud
 	hb = g_new(struct _purple_hbuddy, 1);
 	hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
 	hb->account = purple_buddy_get_account(buddy);
-	hb->group = ((PurpleBlistNode *)buddy)->parent->parent;
+	hb->group = (PURPLE_BLIST_NODE(buddy))->parent->parent;
 	g_hash_table_remove(list->buddies, hb);
 	
 	account_buddies = g_hash_table_lookup(list->buddies_cache, purple_buddy_get_account(buddy));
@@ -587,7 +587,7 @@ void purple_blist_rename_buddy(PurpleBud
 	hb2 = g_new(struct _purple_hbuddy, 1);
 	hb2->name = g_strdup(hb->name);
 	hb2->account = purple_buddy_get_account(buddy);
-	hb2->group = ((PurpleBlistNode *)buddy)->parent->parent;
+	hb2->group = (PURPLE_BLIST_NODE(buddy))->parent->parent;
 
 	g_hash_table_replace(account_buddies, hb2, buddy);
 
@@ -608,7 +608,7 @@ void purple_blist_add_contact(PurpleCont
 	PurpleBlistNode *gnode, *cnode, *bnode;
 
 	g_return_if_fail(contact != NULL);
-	g_return_if_fail(PURPLE_IS_CONTACT((PurpleBlistNode*)contact));
+	g_return_if_fail(PURPLE_IS_CONTACT(PURPLE_BLIST_NODE(contact)));
 
 	if (PURPLE_BLIST_NODE(contact) == node)
 		return;
@@ -627,8 +627,8 @@ void purple_blist_add_contact(PurpleCont
 		}
 	}
 
-	gnode = (PurpleBlistNode*)g;
-	cnode = (PurpleBlistNode*)contact;
+	gnode = PURPLE_BLIST_NODE(g);
+	cnode = PURPLE_BLIST_NODE(contact);
 
 	/* If node is already in the list somewhere */	
 	if (cnode->parent) {
@@ -743,11 +743,11 @@ void purple_blist_add_group(PurpleGroup 
 void purple_blist_add_group(PurpleGroup *group, PurpleBlistNode *node)
 {
 	PurpleBlistUiOps *ops;
-	PurpleBlistNode *gnode = (PurpleBlistNode*)group;
+	PurpleBlistNode *gnode = PURPLE_BLIST_NODE(group);
 	PurpleBuddyList *list = purple_blist_get_list();
 
 	g_return_if_fail(group != NULL);
-	g_return_if_fail(PURPLE_IS_GROUP((PurpleBlistNode *)group));
+	g_return_if_fail(PURPLE_IS_GROUP(PURPLE_BLIST_NODE(group)));
 
 	ops = purple_blist_get_ui_ops();
 
@@ -790,7 +790,7 @@ void purple_blist_remove_contact(PurpleC
 
 	g_return_if_fail(contact != NULL);
 
-	node = (PurpleBlistNode *)contact;
+	node = PURPLE_BLIST_NODE(contact);
 	gnode = node->parent;
 
 	if (node->child) {
@@ -876,7 +876,7 @@ void purple_blist_remove_chat(PurpleChat
 
 	g_return_if_fail(chat != NULL);
 
-	node = (PurpleBlistNode *)chat;
+	node = PURPLE_BLIST_NODE(chat);
 	gnode = node->parent;
 	group = (PurpleGroup *)gnode;
 
@@ -915,7 +915,7 @@ purple_blist_remove_group(PurpleGroup *g
 
 	g_return_if_fail(group != NULL);
 
-	node = (PurpleBlistNode *)group;
+	node = PURPLE_BLIST_NODE(group);
 
 	if (purple_blist_node_is_empty(PURPLE_BLIST_NODE(group)))
 		return;
@@ -1148,7 +1148,7 @@ gboolean purple_group_on_account(PurpleG
 gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account)
 {
 	PurpleBlistNode *cnode;
-	for (cnode = ((PurpleBlistNode *)g)->child; cnode; cnode = cnode->next) {
+	for (cnode = (PURPLE_BLIST_NODE(g))->child; cnode; cnode = cnode->next) {
 		if (PURPLE_IS_CONTACT(cnode)) {
 			if(purple_contact_on_account((PurpleContact *) cnode, account))
 				return TRUE;
@@ -1164,12 +1164,12 @@ void purple_blist_add_chat(PurpleChat *c
 
 void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node)
 {
-	PurpleBlistNode *cnode = (PurpleBlistNode*)chat;
+	PurpleBlistNode *cnode = PURPLE_BLIST_NODE(chat);
 	PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
 	PurpleBuddyList *list = purple_blist_get_list();
 
 	g_return_if_fail(chat != NULL);
-	g_return_if_fail(PURPLE_IS_CHAT((PurpleBlistNode *)chat));
+	g_return_if_fail(PURPLE_IS_CHAT(PURPLE_BLIST_NODE(chat)));
 
 	if (node == NULL) {
 		if (group == NULL)
@@ -1219,12 +1219,12 @@ void purple_blist_add_chat(PurpleChat *c
 			((PurpleGroup *)node->parent)->currentsize++;
 		}
 	} else {
-		if (((PurpleBlistNode *)group)->child)
-			((PurpleBlistNode *)group)->child->prev = cnode;
-		cnode->next = ((PurpleBlistNode *)group)->child;
+		if ((PURPLE_BLIST_NODE(group))->child)
+			(PURPLE_BLIST_NODE(group))->child->prev = cnode;
+		cnode->next = (PURPLE_BLIST_NODE(group))->child;
 		cnode->prev = NULL;
-		((PurpleBlistNode *)group)->child = cnode;
-		cnode->parent = (PurpleBlistNode *)group;
+		(PURPLE_BLIST_NODE(group))->child = cnode;
+		cnode->parent = PURPLE_BLIST_NODE(group);
 		group->totalsize++;
 		if (purple_account_is_connected(chat->account)) {
 			group->online++;
@@ -1252,13 +1252,13 @@ void purple_blist_add_buddy(PurpleBuddy 
 	PurpleBuddyList *list = purple_blist_get_list();
 
 	g_return_if_fail(buddy != NULL);
-	g_return_if_fail(PURPLE_IS_BUDDY((PurpleBlistNode*)buddy));
+	g_return_if_fail(PURPLE_IS_BUDDY(PURPLE_BLIST_NODE(buddy)));
 
-	bnode = (PurpleBlistNode *)buddy;
+	bnode = PURPLE_BLIST_NODE(buddy);
 
 	/* if we're moving to overtop of ourselves, do nothing */
 	if (bnode == node || (!node && bnode->parent &&
-				contact && bnode->parent == (PurpleBlistNode*)contact
+				contact && bnode->parent == PURPLE_BLIST_NODE(contact)
 				&& bnode == bnode->parent->child))
 		return;
 
@@ -1279,10 +1279,10 @@ void purple_blist_add_buddy(PurpleBuddy 
 		}
 		c = purple_contact_new();
 		purple_blist_add_contact(c, g,
-				purple_blist_get_last_child((PurpleBlistNode*)g));
+				purple_blist_get_last_child(PURPLE_BLIST_NODE(g)));
 	}
 
-	cnode = (PurpleBlistNode *)c;
+	cnode = PURPLE_BLIST_NODE(c);
 
 	if (bnode->parent) {
 		if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
@@ -1298,7 +1298,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 		((PurpleContact*)bnode->parent)->totalsize--;
 		/* the group totalsize will be taken care of by remove_contact below */
 
-		if (bnode->parent->parent != (PurpleBlistNode*)g)
+		if (bnode->parent->parent != PURPLE_BLIST_NODE(g))
 			serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g);
 
 		if (bnode->next)
@@ -1313,7 +1313,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 
 		purple_blist_schedule_save();
 
-		if (bnode->parent->parent != (PurpleBlistNode*)g) {
+		if (bnode->parent->parent != PURPLE_BLIST_NODE(g)) {
 			hb = g_new(struct _purple_hbuddy, 1);
 			hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
 			hb->account = purple_buddy_get_account(buddy);
@@ -1365,7 +1365,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 	hb = g_new(struct _purple_hbuddy, 1);
 	hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
 	hb->account = purple_buddy_get_account(buddy);
-	hb->group = ((PurpleBlistNode*)buddy)->parent->parent;
+	hb->group = (PURPLE_BLIST_NODE(buddy))->parent->parent;
 
 	g_hash_table_replace(list->buddies, hb, buddy);
 
@@ -1374,7 +1374,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 	hb2 = g_new(struct _purple_hbuddy, 1);
 	hb2->name = g_strdup(hb->name);
 	hb2->account = purple_buddy_get_account(buddy);
-	hb2->group = ((PurpleBlistNode*)buddy)->parent->parent;
+	hb2->group = (PURPLE_BLIST_NODE(buddy))->parent->parent;
 
 	g_hash_table_replace(account_buddies, hb2, buddy);
 
@@ -1460,7 +1460,7 @@ PurpleBuddy *purple_find_buddy_in_group(
 
 	hb.name = g_strdup(purple_normalize(account, name));
 	hb.account = account;
-	hb.group = (PurpleBlistNode*)group;
+	hb.group = PURPLE_BLIST_NODE(group);
 
 	ret = g_hash_table_lookup(purple_blist_get_list()->buddies, &hb);
 	g_free(hb.name);
@@ -1473,7 +1473,7 @@ purple_chat_get_group(PurpleChat *chat)
 {
 	g_return_val_if_fail(chat != NULL, NULL);
 
-	return (PurpleGroup *)(((PurpleBlistNode *)chat)->parent);
+	return (PurpleGroup *)((PURPLE_BLIST_NODE(chat))->parent);
 }
 
 static void
============================================================
--- libpurple/buddy.c	d8fe046406a6b4d5a1a06dc1a56271d1f9ac4c58
+++ libpurple/buddy.c	56414ab0aa4e252ce19cf15ae78dc1a4c1c12cc5
@@ -78,10 +78,10 @@ parse_buddy(PurpleGroup *group, PurpleCo
 
 	buddy = purple_buddy_new(account, name, alias);
 	purple_blist_add_buddy(buddy, contact, group,
-	purple_blist_get_last_child((PurpleBlistNode*)contact));
+	purple_blist_get_last_child(PURPLE_BLIST_NODE(contact)));
 
 	for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
-		parse_setting((PurpleBlistNode*)buddy, x);
+		parse_setting(PURPLE_BLIST_NODE(buddy), x);
 	}
 
 	g_free(name);
@@ -139,7 +139,7 @@ purple_blist_update_buddy_icon(PurpleBud
 void
 purple_blist_update_buddy_icon(PurpleBuddy *buddy)
 {
-	purple_blist_update_node_icon((PurpleBlistNode *)buddy);
+	purple_blist_update_node_icon(PURPLE_BLIST_NODE(buddy));
 }
 
 void purple_buddy_set_alias(PurpleBuddy *buddy, const char *alias)
@@ -261,7 +261,7 @@ purple_buddy_set_icon(PurpleBuddy *buddy
 
 	purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy);
 
-	purple_blist_update_node_icon((PurpleBlistNode*)buddy);
+	purple_blist_update_node_icon(PURPLE_BLIST_NODE(buddy));
 }
 
 PurpleAccount *
@@ -614,7 +614,7 @@ purple_buddy_init(GTypeInstance *instanc
 	purple_presence_set_status_active(priv->presence, "offline", TRUE);
 
 	if (ops && ops->new_node)
-		ops->new_node((PurpleBlistNode *)buddy);
+		ops->new_node(PURPLE_BLIST_NODE(buddy));
 
 	PURPLE_DBUS_REGISTER_POINTER(buddy, PurpleBuddy);
 }
============================================================
--- libpurple/chat.c	0f8af602adb68f553c34050d7b47ac03adc38610
+++ libpurple/chat.c	eb0b91d585f041dcbe0bf0482f8f967c8b08b668
@@ -114,10 +114,10 @@ parse_chat(PurpleGroup *group, xmlnode *
 
 	chat = purple_chat_new(account, alias, components);
 	purple_blist_add_chat(chat, group,
-			purple_blist_get_last_child((PurpleBlistNode*)group));
+			purple_blist_get_last_child(PURPLE_BLIST_NODE(group)));
 
 	for (x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
-		parse_setting((PurpleBlistNode*)chat, x);
+		parse_setting(PURPLE_BLIST_NODE(chat), x);
 	}
 
 	g_free(alias);
@@ -346,7 +346,7 @@ purple_chat_init(GTypeInstance *instance
 	PurpleChat *chat = PURPLE_CHAT(instance);
 
 	if (ops != NULL && ops->new_node != NULL)
-		ops->new_node((PurpleBlistNode *)chat);
+		ops->new_node(PURPLE_BLIST_NODE(chat));
 
 	PURPLE_DBUS_REGISTER_POINTER(chat, PurpleChat);
 }
============================================================
--- libpurple/contact.c	e6db63186df849fa184159382f803da9fb0b6f58
+++ libpurple/contact.c	abb2b7bcb4c3fc6e149ca3fe4c1cbb9d798ff16d
@@ -75,7 +75,7 @@ parse_contact(PurpleGroup *group, xmlnod
 	const char *alias;
 
 	purple_blist_add_contact(contact, group,
-			purple_blist_get_last_child((PurpleBlistNode*)group));
+			purple_blist_get_last_child(PURPLE_BLIST_NODE(group)));
 
 	if ((alias = xmlnode_get_attrib(cnode, "alias"))) {
 		purple_blist_alias_contact(contact, alias);
@@ -87,11 +87,11 @@ parse_contact(PurpleGroup *group, xmlnod
 		if (purple_strequal(x->name, "buddy"))
 			parse_buddy(group, contact, x);
 		else if (purple_strequal(x->name, "setting"))
-			parse_setting((PurpleBlistNode*)contact, x);
+			parse_setting(PURPLE_BLIST_NODE(contact), x);
 	}
 
 	/* if the contact is empty, don't keep it around.  it causes problems */
-	if (!((PurpleBlistNode*)contact)->child)
+	if (!(PURPLE_BLIST_NODE(contact))->child)
 		purple_blist_remove_contact(contact);
 }
 
@@ -104,7 +104,7 @@ purple_contact_compute_priority_buddy(Pu
 	g_return_if_fail(contact != NULL);
 
 	contact->priority = NULL;
-	for (bnode = ((PurpleBlistNode*)contact)->child;
+	for (bnode = (PURPLE_BLIST_NODE(contact))->child;
 			bnode != NULL;
 			bnode = bnode->next)
 	{
@@ -175,7 +175,7 @@ void purple_blist_alias_contact(PurpleCo
 	if (ops && ops->update)
 		ops->update(PURPLE_BLIST_NODE(contact));
 
-	for(bnode = ((PurpleBlistNode *)contact)->child; bnode != NULL; bnode = bnode->next)
+	for(bnode = (PURPLE_BLIST_NODE(contact))->child; bnode != NULL; bnode = bnode->next)
 	{
 		PurpleBuddy *buddy = (PurpleBuddy *)bnode;
 
@@ -391,7 +391,7 @@ purple_contact_init(GTypeInstance *insta
 	contact->online = 0;
 
 	if (ops && ops->new_node)
-		ops->new_node((PurpleBlistNode *)contact);
+		ops->new_node(PURPLE_BLIST_NODE(contact));
 
 	PURPLE_DBUS_REGISTER_POINTER(contact, PurpleContact);
 }
============================================================
--- libpurple/group.c	85176f73aafb5b9c6d76c5077df8315e9e29f427
+++ libpurple/group.c	2032914afd2ae21abc0be757905dc36b92a152ac
@@ -73,7 +73,7 @@ GSList *purple_group_get_accounts(Purple
 	GSList *l = NULL;
 	PurpleBlistNode *gnode, *cnode, *bnode;
 
-	gnode = (PurpleBlistNode *)group;
+	gnode = PURPLE_BLIST_NODE(group);
 
 	for (cnode = gnode->child;  cnode; cnode = cnode->next) {
 		if (PURPLE_IS_CHAT(cnode)) {
@@ -132,10 +132,10 @@ PurpleGroup *purple_buddy_get_group(Purp
 {
 	g_return_val_if_fail(buddy != NULL, NULL);
 
-	if (((PurpleBlistNode *)buddy)->parent == NULL)
+	if ((PURPLE_BLIST_NODE(buddy))->parent == NULL)
 		return NULL;
 
-	return (PurpleGroup *)(((PurpleBlistNode*)buddy)->parent->parent);
+	return (PurpleGroup *)((PURPLE_BLIST_NODE(buddy))->parent->parent);
 }
 
 void
@@ -325,7 +325,7 @@ purple_group_init(GTypeInstance *instanc
 	group->online = 0;
 
 	if (ops && ops->new_node)
-		ops->new_node((PurpleBlistNode *)group);
+		ops->new_node(PURPLE_BLIST_NODE(group));
 
 	PURPLE_DBUS_REGISTER_POINTER(group, PurpleGroup);
 }


More information about the Commits mailing list