changeset 30863:16ab805406d1

Get rid of the offset field in the SlpMessage in favor of the one in the Header.
author masca@cpw.pidgin.im
date Thu, 05 Aug 2010 21:58:13 +0000
parents 5ad928319db0
children e32332ac385c
files libpurple/protocols/msn/p2p.h libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg.h
diffstat 4 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/p2p.h	Wed Aug 04 04:30:03 2010 +0000
+++ b/libpurple/protocols/msn/p2p.h	Thu Aug 05 21:58:13 2010 +0000
@@ -6,6 +6,12 @@
 typedef struct {
 	guint32 session_id;
 	guint32 id;
+	/**
+	 * In a MsnSlpMessage:
+	 * For outgoing messages this is the number of bytes from buffer that
+	 * have already been sent out.  For incoming messages this is the
+	 * number of bytes that have been written to buffer.
+	 */
 	guint64 offset;
 	guint64 total_size;
 	guint32 length;
--- a/libpurple/protocols/msn/slpcall.c	Wed Aug 04 04:30:03 2010 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Thu Aug 05 21:58:13 2010 +0000
@@ -1060,7 +1060,7 @@
 
 	slpcall = NULL;
 	body = slpmsg->buffer;
-	body_len = slpmsg->offset;
+	body_len = slpmsg->header->offset;
 
 	if (slpmsg->flags == P2P_NO_FLAG || slpmsg->flags == P2P_WML2009_COMP)
 	{
--- a/libpurple/protocols/msn/slplink.c	Wed Aug 04 04:30:03 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Thu Aug 05 21:58:13 2010 +0000
@@ -578,14 +578,14 @@
 	else if (slpmsg->size && slpmsg->buffer) {
 		if (G_MAXSIZE - part->size < part->header->offset
 				|| (part->header->offset + part->size) > slpmsg->size
-				|| slpmsg->offset != part->header->offset) {
+				|| slpmsg->header->offset != part->header->offset) {
 			purple_debug_error("msn",
 				"Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n",
 				slpmsg->size, part->header->offset, part->size);
 			g_return_if_reached();
 		} else {
 			memcpy(slpmsg->buffer + part->header->offset, part->buffer, part->size);
-			slpmsg->offset += part->size;
+			slpmsg->header->offset += part->size;
 		}
 	}
 }
--- a/libpurple/protocols/msn/slpmsg.h	Wed Aug 04 04:30:03 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.h	Thu Aug 05 21:58:13 2010 +0000
@@ -61,13 +61,6 @@
 	guchar *buffer;
 
 	/**
-	 * For outgoing messages this is the number of bytes from buffer that
-	 * have already been sent out.  For incoming messages this is the
-	 * number of bytes that have been written to buffer.
-	 */
-	long long offset;
-
-	/**
 	 * This is the size of buffer, unless this is an outgoing file transfer,
 	 * in which case this is the size of the file.
 	 */