comparison libgaim/protocols/qq/recv_core.c @ 14629:6b8bc59414f0

[gaim-migrate @ 17375] Get rid of these useless checks. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Tue, 26 Sep 2006 22:54:24 +0000
parents 26bca01c7076
children d1a76ccb93c4
comparison
equal deleted inserted replaced
14628:58202142e9ad 14629:6b8bc59414f0
61 static gboolean _qq_check_packet_set_window(guint16 seq, GaimConnection *gc) 61 static gboolean _qq_check_packet_set_window(guint16 seq, GaimConnection *gc)
62 { 62 {
63 qq_data *qd; 63 qq_data *qd;
64 guint8 *byte, mask; 64 guint8 *byte, mask;
65 65
66 g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE);
67 qd = (qq_data *) gc->proto_data; 66 qd = (qq_data *) gc->proto_data;
68 byte = &(qd->window[seq / 8]); 67 byte = &(qd->window[seq / 8]);
69 mask = (1 << (seq % 8)); 68 mask = (1 << (seq % 8));
70 69
71 if ((*byte) & mask) 70 if ((*byte) & mask)
72 return TRUE; /* check mask */ 71 return TRUE; /* check mask */
73 (*byte) |= mask; 72 (*byte) |= mask;
74 return FALSE; /* set mask */ 73 return FALSE; /* set mask */
75 } /* _qq_check_packet_set_window */ 74 }
76 75
77 /* default process, decrypt and dump */ 76 /* default process, decrypt and dump */
78 static void _qq_process_packet_default(guint8 *buf, gint buf_len, guint16 cmd, guint16 seq, GaimConnection *gc) 77 static void _qq_process_packet_default(guint8 *buf, gint buf_len, guint16 cmd, guint16 seq, GaimConnection *gc)
79 { 78 {
80 qq_data *qd; 79 qq_data *qd;
81 guint8 *data; 80 guint8 *data;
82 gchar *msg_utf8; 81 gchar *msg_utf8;
83 gint len; 82 gint len;
84 83
85 g_return_if_fail(gc != NULL && gc->proto_data != NULL);
86 g_return_if_fail(buf != NULL && buf_len != 0); 84 g_return_if_fail(buf != NULL && buf_len != 0);
87 85
88 qd = (qq_data *) gc->proto_data; 86 qd = (qq_data *) gc->proto_data;
89 len = buf_len; 87 len = buf_len;
90 data = g_newa(guint8, len); 88 data = g_newa(guint8, len);
109 guint16 buf_len_read; /* two bytes in the begining of TCP packet */ 107 guint16 buf_len_read; /* two bytes in the begining of TCP packet */
110 guint8 *cursor; 108 guint8 *cursor;
111 qq_recv_msg_header header; 109 qq_recv_msg_header header;
112 packet_before_login *b4_packet; 110 packet_before_login *b4_packet;
113 111
114 g_return_if_fail(gc != NULL && gc->proto_data != NULL);
115 g_return_if_fail(buf != NULL && buf_len > 0); 112 g_return_if_fail(buf != NULL && buf_len > 0);
116 113
117 qd = (qq_data *) gc->proto_data; 114 qd = (qq_data *) gc->proto_data;
118 bytes_expected = qd->use_tcp ? QQ_TCP_HEADER_LENGTH : QQ_UDP_HEADER_LENGTH; 115 bytes_expected = qd->use_tcp ? QQ_TCP_HEADER_LENGTH : QQ_UDP_HEADER_LENGTH;
119 116
295 guint8 *buf; 292 guint8 *buf;
296 gint len; 293 gint len;
297 294
298 gc = (GaimConnection *) data; 295 gc = (GaimConnection *) data;
299 296
300 g_return_if_fail(gc != NULL && gc->proto_data != NULL);
301
302 if(cond != GAIM_INPUT_READ) { 297 if(cond != GAIM_INPUT_READ) {
303 gaim_connection_error(gc, _("Socket error")); 298 gaim_connection_error(gc, _("Socket error"));
304 return; 299 return;
305 } 300 }
306 301