soc.2010.msn-tlc: f6d84b11: Get rid of the offset field in the SlpMe...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Thu Aug 5 22:01:20 EDT 2010


----------------------------------------------------------------------
Revision: f6d84b11bd9095bf43f54f60076e1ff78ca9bdb5
Parent:   e4ced57913d1bb22869ad3ff736de5b64dd63425
Author:   masca at cpw.pidgin.im
Date:     08/05/10 17:58:13
Branch:   im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/f6d84b11bd9095bf43f54f60076e1ff78ca9bdb5

Changelog: 

Get rid of the offset field in the SlpMessage in favor of the one in the Header.

Changes against parent e4ced57913d1bb22869ad3ff736de5b64dd63425

  patched  libpurple/protocols/msn/p2p.h
  patched  libpurple/protocols/msn/slpcall.c
  patched  libpurple/protocols/msn/slplink.c
  patched  libpurple/protocols/msn/slpmsg.h

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpcall.c	7fc47487216663a4568d0b5422e339490ec8fb7b
+++ libpurple/protocols/msn/slpcall.c	6c9cf6c3990540e68a119ada39221311735aa81e
@@ -1060,7 +1060,7 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 
 	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)
 	{
============================================================
--- libpurple/protocols/msn/slplink.c	a752b08eba7dc5d71feb2454640ef443e6c22faa
+++ libpurple/protocols/msn/slplink.c	ec6861e98466c74ebfac9fceb1989940f01c5492
@@ -578,14 +578,14 @@ slpmsg_add_part(MsnSlpMessage *slpmsg, M
 	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;
 		}
 	}
 }
============================================================
--- libpurple/protocols/msn/slpmsg.h	f8b11a300450cbaa1e93c91ef128bfff1e4eaea7
+++ libpurple/protocols/msn/slpmsg.h	9eeaeb5d9d36d2d9d0fc24acd88dd2ab9bd489c1
@@ -61,13 +61,6 @@ struct _MsnSlpMessage
 	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.
 	 */
============================================================
--- libpurple/protocols/msn/p2p.h	174937ed1b63cad8a8029085adc646aed1150b63
+++ libpurple/protocols/msn/p2p.h	ad6bcb4c567f1c537418cc2197b90d44b259207a
@@ -6,6 +6,12 @@ typedef struct {
 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;


More information about the Commits mailing list