pidgin: 7f5138e6: Remove extra variables, and this sizeof(...

qulogic at pidgin.im qulogic at pidgin.im
Fri Dec 17 04:11:23 EST 2010


----------------------------------------------------------------------
Revision: 7f5138e6a3c1380f94724c17a7d99cda3e0f2fad
Parent:   753113a148c133b26f36171d552fcbde0a35c27f
Author:   qulogic at pidgin.im
Date:     12/17/10 02:58:33
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/7f5138e6a3c1380f94724c17a7d99cda3e0f2fad

Changelog: 

Remove extra variables, and this sizeof() is wrong.

Changes against parent 753113a148c133b26f36171d552fcbde0a35c27f

  patched  libpurple/protocols/msn/slpmsg_part.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpmsg_part.c	d4232974551e15dbfed62e577ba7d9f9fb4f9349
+++ libpurple/protocols/msn/slpmsg_part.c	19e57a64cd10530e1018f1a57e74a09d4b5ed77b
@@ -48,20 +48,17 @@ MsnSlpMessagePart *msn_slpmsgpart_new_fr
 MsnSlpMessagePart *msn_slpmsgpart_new_from_data(const char *data, size_t data_len)
 {
 	MsnSlpMessagePart *part;
-	MsnP2PHeader *header;
-	const char *tmp;
 	int body_len;
 
-	if (data_len < sizeof(*header)) {
+	if (data_len < P2P_PACKET_HEADER_SIZE) {
 		return NULL;
 	}
 
 	part = msn_slpmsgpart_new(NULL, NULL);
-	tmp = data;
 
 	/* Extract the binary SLP header */
-	part->header = msn_p2p_header_from_wire(tmp);
-	tmp += P2P_PACKET_HEADER_SIZE;
+	part->header = msn_p2p_header_from_wire(data);
+	data += P2P_PACKET_HEADER_SIZE;
 
 	/* Extract the body */
 	body_len = data_len - P2P_PACKET_HEADER_SIZE - P2P_PACKET_FOOTER_SIZE;
@@ -70,13 +67,13 @@ MsnSlpMessagePart *msn_slpmsgpart_new_fr
 	if (body_len > 0) {
 		part->size = body_len;
 		part->buffer = g_malloc(body_len);
-		memcpy(part->buffer, tmp, body_len);
-		tmp += body_len;
+		memcpy(part->buffer, data, body_len);
+		data += body_len;
 	}
 
 	/* Extract the footer */
 	if (body_len >= 0) 
-		part->footer = msn_p2p_footer_from_wire(tmp);
+		part->footer = msn_p2p_footer_from_wire(data);
 
 	return part;
 }


More information about the Commits mailing list