gobjectification: d09665d5: Fix some uses of PurpleCircBuffer.

qulogic at pidgin.im qulogic at pidgin.im
Wed May 11 03:13:17 EDT 2011


----------------------------------------------------------------------
Revision: d09665d5d50728e95aa519558adde8b648c0a28f
Parent:   ee8168f07a41fb037f978532fd6262ae9b6c605d
Author:   qulogic at pidgin.im
Date:     05/11/11 01:08:20
Branch:   im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/d09665d5d50728e95aa519558adde8b648c0a28f

Changelog: 

Fix some uses of PurpleCircBuffer.

Changes against parent ee8168f07a41fb037f978532fd6262ae9b6c605d

  patched  libpurple/protocols/bonjour/jabber.c
  patched  libpurple/protocols/bonjour/jabber.h

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/jabber.c	b7a1d8ecd254620dcc9d1d3ccead88494c6be540
+++ libpurple/protocols/bonjour/jabber.c	83e1dd731a12277c67b97c6afafa3f2257a22bc9
@@ -89,7 +89,7 @@ bonjour_jabber_conv_new(PurpleBuddy *pb,
 
 	BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1);
 	bconv->socket = -1;
-	bconv->tx_buf = purple_circ_buffer_new(512);
+	bconv->tx_buf = purple_circular_buffer_new(512);
 	bconv->tx_handler = 0;
 	bconv->rx_handler = 0;
 	bconv->pb = pb;
@@ -277,7 +277,7 @@ _send_data_write_cb(gpointer data, gint 
 	BonjourJabberConversation *bconv = bb->conversation;
 	int ret, writelen;
 
-	writelen = purple_circ_buffer_get_max_read(bconv->tx_buf);
+	writelen = purple_circular_buffer_get_max_read(bconv->tx_buf);
 
 	if (writelen == 0) {
 		purple_input_remove(bconv->tx_handler);
@@ -285,7 +285,7 @@ _send_data_write_cb(gpointer data, gint 
 		return;
 	}
 
-	ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0);
+	ret = send(bconv->socket, purple_circular_buffer_get_output(bconv->tx_buf), writelen, 0);
 
 	if (ret < 0 && errno == EAGAIN)
 		return;
@@ -310,7 +310,7 @@ _send_data_write_cb(gpointer data, gint 
 		return;
 	}
 
-	purple_circ_buffer_mark_read(bconv->tx_buf, ret);
+	purple_circular_buffer_mark_read(bconv->tx_buf, ret);
 }
 
 static gint
@@ -326,7 +326,7 @@ _send_data(PurpleBuddy *pb, char *messag
 			|| bconv->connect_data != NULL
 			|| bconv->sent_stream_start != FULLY_SENT
 			|| !bconv->recv_stream_start
-			|| purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) {
+			|| purple_circular_buffer_get_max_read(bconv->tx_buf) > 0) {
 		ret = -1;
 		errno = EAGAIN;
 	} else {
@@ -361,7 +361,7 @@ _send_data(PurpleBuddy *pb, char *messag
 		if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start && bconv->tx_handler == 0)
 			bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE,
 				_send_data_write_cb, pb);
-		purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret);
+		purple_circular_buffer_append(bconv->tx_buf, message + ret, len - ret);
 	}
 
 	return ret;
@@ -618,7 +618,7 @@ void bonjour_jabber_stream_started(Bonjo
 	/* If the stream has been completely started and we know who we're talking to, we can start doing stuff. */
 	/* I don't think the circ_buffer can actually contain anything without a buddy being associated, but lets be explicit. */
 	if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start
-			&& bconv->pb && purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) {
+			&& bconv->pb && purple_circular_buffer_get_max_read(bconv->tx_buf) > 0) {
 		/* Watch for when we can write the buffered messages */
 		bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE,
 			_send_data_write_cb, bconv->pb);
@@ -1180,7 +1180,7 @@ bonjour_jabber_close_conversation(Bonjou
 			purple_input_remove(bconv->tx_handler);
 
 		/* Free all the data related to the conversation */
-		purple_circ_buffer_destroy(bconv->tx_buf);
+		g_object_unref(G_OBJECT(bconv->tx_buf));
 		if (bconv->connect_data != NULL)
 			purple_proxy_connect_cancel(bconv->connect_data);
 		if (bconv->stream_data != NULL) {
============================================================
--- libpurple/protocols/bonjour/jabber.h	c2277098331059135ab10da92ebe8c3d9ff4f75e
+++ libpurple/protocols/bonjour/jabber.h	86ef0df049d2a4fb92b528f7567f873724c767c3
@@ -50,7 +50,7 @@ typedef struct _BonjourJabberConversatio
 	guint rx_handler;
 	guint tx_handler;
 	guint close_timeout;
-	PurpleCircBuffer *tx_buf;
+	PurpleCircularBuffer *tx_buf;
 	int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */
 	gboolean recv_stream_start;
 	PurpleProxyConnectData *connect_data;


More information about the Commits mailing list