comparison libpurple/protocols/yahoo/yahoo_packet.c @ 21605:5c74661025dc

disapproval of revision '91ae77ce12a4ab3798e303eea54d3bef749d5ca5'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 21 Nov 2007 21:46:48 +0000
parents 2c45b94ab722
children 3f95ed86fb51
comparison
equal deleted inserted replaced
21604:2c45b94ab722 21605:5c74661025dc
217 pkt->hash = g_slist_reverse(pkt->hash); 217 pkt->hash = g_slist_reverse(pkt->hash);
218 } 218 }
219 219
220 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data) 220 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data)
221 { 221 {
222 GSList *l = pkt->hash;
222 int pos = 0; 223 int pos = 0;
223 224
224 /* This is only called from one place, and the list is 225 /* This is only called from one place, and the list is
225 * always backwards */ 226 * always backwards */
226 227
227 pkt->hash = g_slist_reverse(pkt->hash); 228 l = g_slist_reverse(l);
228 229
229 while (pkt->hash) { 230 while (l) {
230 struct yahoo_pair *pair = pkt->hash->data; 231 struct yahoo_pair *pair = l->data;
231 gchar buf[100]; 232 gchar buf[100];
232 233
233 g_snprintf(buf, sizeof(buf), "%d", pair->key); 234 g_snprintf(buf, sizeof(buf), "%d", pair->key);
234 strcpy((char *)&data[pos], buf); 235 strcpy((char *)&data[pos], buf);
235 pos += strlen(buf); 236 pos += strlen(buf);
239 strcpy((char *)&data[pos], pair->value); 240 strcpy((char *)&data[pos], pair->value);
240 pos += strlen(pair->value); 241 pos += strlen(pair->value);
241 data[pos++] = 0xc0; 242 data[pos++] = 0xc0;
242 data[pos++] = 0x80; 243 data[pos++] = 0x80;
243 244
244 pkt->hash = pkt->hash->next; 245 l = l->next;
245 } 246 }
246 } 247 }
247 248
248 void yahoo_packet_dump(guchar *data, int len) 249 void yahoo_packet_dump(guchar *data, int len)
249 { 250 {