Mercurial > pidgin
diff libpurple/protocols/msn/directconn.c @ 30023:ecd237d3f578
Minor cleanups.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 11 Apr 2010 05:53:02 +0000 |
parents | ca7dec8303cb |
children | db0f95b6a2cf |
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c Sun Apr 11 05:27:20 2010 +0000 +++ b/libpurple/protocols/msn/directconn.c Sun Apr 11 05:53:02 2010 +0000 @@ -94,8 +94,7 @@ static void msn_dc_destroy_packet(MsnDirectConnPacket *p) { - if (p->data) - g_free(p->data); + g_free(p->data); if (p->msg) msn_message_unref(p->msg); @@ -647,7 +646,7 @@ { MsnDirectConnPacket *p; const gchar *h; - guint32 l; + guint32 len; g_return_if_fail(dc != NULL); @@ -656,9 +655,8 @@ p->length = 4 + DC_PACKET_HEADER_SIZE; p->data = g_malloc(p->length); - l = DC_PACKET_HEADER_SIZE; - l = GUINT32_TO_LE(l); - memcpy(p->data, &l, 4); + len = GUINT32_TO_LE(DC_PACKET_HEADER_SIZE); + memcpy(p->data, &len, 4); dc->header.session_id = 0; dc->header.id = dc->slpcall->slplink->slp_seq_id++; @@ -679,7 +677,7 @@ { MsnDirectConnPacket *p; const gchar *h; - guint32 l; + guint32 len; g_return_if_fail(dc != NULL); @@ -688,9 +686,8 @@ p->length = 4 + DC_PACKET_HEADER_SIZE; p->data = g_malloc(p->length); - l = DC_PACKET_HEADER_SIZE; - l = GUINT32_TO_LE(l); - memcpy(p->data, &l, 4); + len = GUINT32_TO_LE(DC_PACKET_HEADER_SIZE); + memcpy(p->data, &len, 4); dc->header.id = dc->slpcall->slplink->slp_seq_id++; dc->header.length = 0; @@ -724,8 +721,7 @@ memcpy(p->data + 4 + DC_PACKET_HEADER_SIZE, msg->body, msg->body_len); p->sent_cb = msn_dc_send_packet_cb; - p->msg = msg; - msn_message_ref(msg); + p->msg = msn_message_ref(msg); msn_dc_enqueue_packet(dc, p); } @@ -739,16 +735,15 @@ case DC_STATE_CLOSED: break; - case DC_STATE_FOO: { + case DC_STATE_FOO: /* FOO message is always 4 bytes long */ if (packet_length != 4 || memcmp(dc->in_buffer, "\4\0\0\0foo", 8) != 0) return DC_PROCESS_FALLBACK; dc->state = DC_STATE_HANDSHAKE; break; - } - case DC_STATE_HANDSHAKE: { + case DC_STATE_HANDSHAKE: if (packet_length != DC_PACKET_HEADER_SIZE) return DC_PROCESS_FALLBACK; @@ -759,7 +754,6 @@ msn_slpcall_session_init(dc->slpcall); dc->slpcall = NULL; break; - } case DC_STATE_HANDSHAKE_REPLY: /* TODO: Check! */