Mercurial > pidgin.yaz
diff libpurple/protocols/msn/slpmsg.c @ 31491:7b771e6f1142
Change SLP P2P functions to use the new buffer access functions
instead of mapping to a struct. I don't mind this since it's limited
to just one pair of functions. This means that we don't need to use
any packing there.
Refs #12856.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 17 Dec 2010 07:49:47 +0000 |
parents | 05e05d96ba75 |
children | a8cc50c2279f |
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpmsg.c Fri Dec 17 07:12:21 2010 +0000 +++ b/libpurple/protocols/msn/slpmsg.c Fri Dec 17 07:49:47 2010 +0000 @@ -263,21 +263,21 @@ char *msn_slpmsg_serialize(MsnSlpMessage *slpmsg, size_t *ret_size) { - MsnP2PHeader *header; - MsnP2PFooter *footer; + char *header; + char *footer; char *base; char *tmp; size_t siz; - base = g_malloc(P2P_PACKET_HEADER_SIZE + slpmsg->size + sizeof(MsnP2PFooter)); + base = g_malloc(P2P_PACKET_HEADER_SIZE + slpmsg->size + P2P_PACKET_FOOTER_SIZE); tmp = base; header = msn_p2p_header_to_wire(slpmsg->header); footer = msn_p2p_footer_to_wire(slpmsg->footer); - siz = sizeof(MsnP2PHeader); + siz = P2P_PACKET_HEADER_SIZE; /* Copy header */ - memcpy(tmp, (char*)header, siz); + memcpy(tmp, header, siz); tmp += siz; /* Copy body */ @@ -285,8 +285,8 @@ tmp += slpmsg->size; /* Copy footer */ - siz = sizeof(MsnP2PFooter); - memcpy(tmp, (char*)footer, siz); + siz = P2P_PACKET_FOOTER_SIZE; + memcpy(tmp, footer, siz); tmp += siz; *ret_size = tmp - base;