/pidgin/main: ba7dbf5e91d3: PurpleXfer API: Added a buffer size ...

Ankit Vani a at nevitus.org
Mon Dec 23 04:56:43 EST 2013


Changeset: ba7dbf5e91d3d0814a55850d17e00ebcec7b85ac
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-12-23 15:23 +0530
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/ba7dbf5e91d3

Description:

PurpleXfer API: Added a buffer size parameter to the 'read' callback

diffstat:

 libpurple/protocols/jabber/si.c |  2 +-
 libpurple/protocols/msn/ft.c    |  2 +-
 libpurple/protocols/msn/ft.h    |  2 +-
 libpurple/xfer.c                |  6 +++---
 libpurple/xfer.h                |  2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diffs (78 lines):

diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c
--- a/libpurple/protocols/jabber/si.c
+++ b/libpurple/protocols/jabber/si.c
@@ -1024,7 +1024,7 @@ jabber_si_xfer_ibb_recv_data_cb(JabberIB
 }
 
 static gssize
-jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer)
+jabber_si_xfer_ibb_read(guchar **out_buffer, size_t buf_size, PurpleXfer *xfer)
 {
 	JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
 	guchar *buffer;
diff --git a/libpurple/protocols/msn/ft.c b/libpurple/protocols/msn/ft.c
--- a/libpurple/protocols/msn/ft.c
+++ b/libpurple/protocols/msn/ft.c
@@ -116,7 +116,7 @@ msn_xfer_write(const guchar *data, gsize
 }
 
 gssize
-msn_xfer_read(guchar **data, PurpleXfer *xfer)
+msn_xfer_read(guchar **data, gsize size, PurpleXfer *xfer)
 {
 	MsnSlpCall *slpcall;
 	gsize len;
diff --git a/libpurple/protocols/msn/ft.h b/libpurple/protocols/msn/ft.h
--- a/libpurple/protocols/msn/ft.h
+++ b/libpurple/protocols/msn/ft.h
@@ -55,7 +55,7 @@ void msn_xfer_init(PurpleXfer *xfer);
 void msn_xfer_cancel(PurpleXfer *xfer);
 
 gssize msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer);
-gssize msn_xfer_read(guchar **data, PurpleXfer *xfer);
+gssize msn_xfer_read(guchar **data, gsize size, PurpleXfer *xfer);
 
 void msn_xfer_completed_cb(MsnSlpCall *slpcall,
 						   const guchar *body, gsize size);
diff --git a/libpurple/xfer.c b/libpurple/xfer.c
--- a/libpurple/xfer.c
+++ b/libpurple/xfer.c
@@ -93,7 +93,7 @@ struct _PurpleXferPrivate {
 		void (*end)(PurpleXfer *xfer);
 		void (*cancel_send)(PurpleXfer *xfer);
 		void (*cancel_recv)(PurpleXfer *xfer);
-		gssize (*read)(guchar **buffer, PurpleXfer *xfer);
+		gssize (*read)(guchar **buffer, size_t size, PurpleXfer *xfer);
 		gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer);
 		void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size);
 	} ops;
@@ -1087,7 +1087,7 @@ void purple_xfer_set_request_denied_fnc(
 }
 
 void
-purple_xfer_set_read_fnc(PurpleXfer *xfer, gssize (*fnc)(guchar **, PurpleXfer *))
+purple_xfer_set_read_fnc(PurpleXfer *xfer, gssize (*fnc)(guchar **, size_t, PurpleXfer *))
 {
 	PurpleXferPrivate *priv = PURPLE_XFER_GET_PRIVATE(xfer);
 
@@ -1182,7 +1182,7 @@ purple_xfer_read(PurpleXfer *xfer, gucha
 		s = MIN((gssize)purple_xfer_get_bytes_remaining(xfer), (gssize)priv->current_buffer_size);
 
 	if (priv->ops.read != NULL)	{
-		r = (priv->ops.read)(buffer, xfer);
+		r = (priv->ops.read)(buffer, s, xfer);
 	}
 	else {
 		*buffer = g_malloc0(s);
diff --git a/libpurple/xfer.h b/libpurple/xfer.h
--- a/libpurple/xfer.h
+++ b/libpurple/xfer.h
@@ -503,7 +503,7 @@ PurpleXferUiOps *purple_xfer_get_ui_ops(
  * @param fnc  The read function.
  */
 void purple_xfer_set_read_fnc(PurpleXfer *xfer,
-		gssize (*fnc)(guchar **, PurpleXfer *));
+		gssize (*fnc)(guchar **, size_t, PurpleXfer *));
 
 /**
  * Sets the write function for the file transfer.



More information about the Commits mailing list