comparison src/protocols/oscar/tlv.c @ 10986:ecc0f22db510

[gaim-migrate @ 12822] This gets rid of a fair number of signedness warnings with gcc4 -Wall committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 09 Jun 2005 03:58:58 +0000
parents cee849d17167
children 8d74ae785a46
comparison
equal deleted inserted replaced
10985:c70082d525d2 10986:ecc0f22db510
18 static void freetlv(aim_tlv_t **oldtlv) 18 static void freetlv(aim_tlv_t **oldtlv)
19 { 19 {
20 20
21 if (!oldtlv || !*oldtlv) 21 if (!oldtlv || !*oldtlv)
22 return; 22 return;
23 23
24 free((*oldtlv)->value); 24 free((*oldtlv)->value);
25 free(*oldtlv); 25 free(*oldtlv);
26 *oldtlv = NULL; 26 *oldtlv = NULL;
27 27
28 return; 28 return;
46 * @return Return the TLV chain read 46 * @return Return the TLV chain read
47 */ 47 */
48 faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs) 48 faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs)
49 { 49 {
50 aim_tlvlist_t *list = NULL, *cur; 50 aim_tlvlist_t *list = NULL, *cur;
51 51
52 while (aim_bstream_empty(bs) > 0) { 52 while (aim_bstream_empty(bs) > 0) {
53 fu16_t type, length; 53 fu16_t type, length;
54 54
55 type = aimbs_get16(bs); 55 type = aimbs_get16(bs);
56 length = aimbs_get16(bs); 56 length = aimbs_get16(bs);
314 if (!list || !*list) 314 if (!list || !*list)
315 return; 315 return;
316 316
317 for (cur = *list; cur; ) { 317 for (cur = *list; cur; ) {
318 aim_tlvlist_t *tmp; 318 aim_tlvlist_t *tmp;
319 319
320 freetlv(&cur->tlv); 320 freetlv(&cur->tlv);
321 321
322 tmp = cur->next; 322 tmp = cur->next;
323 free(cur); 323 free(cur);
324 cur = tmp; 324 cur = tmp;
461 461
462 return aim_tlvlist_add_raw(list, type, 4, v32); 462 return aim_tlvlist_add_raw(list, type, 4, v32);
463 } 463 }
464 464
465 /** 465 /**
466 * Add a string to a TLV chain.
467 *
468 * @param list Destination chain.
469 * @param type TLV type to add.
470 * @param value Value to add.
471 * @return The size of the value added.
472 */
473 faim_internal int aim_tlvlist_add_string(aim_tlvlist_t **list, const fu16_t type, const char *value)
474 {
475 return aim_tlvlist_add_raw(list, type, strlen(value), (fu8_t)value);
476 }
477
478 /**
466 * Adds a block of capability blocks to a TLV chain. The bitfield 479 * Adds a block of capability blocks to a TLV chain. The bitfield
467 * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: 480 * passed in should be a bitwise %OR of any of the %AIM_CAPS constants:
468 * 481 *
469 * %AIM_CAPS_BUDDYICON Supports Buddy Icons 482 * %AIM_CAPS_BUDDYICON Supports Buddy Icons
470 * %AIM_CAPS_TALK Supports Voice Chat 483 * %AIM_CAPS_TALK Supports Voice Chat
526 fu8_t *buf; 539 fu8_t *buf;
527 int len; 540 int len;
528 aim_bstream_t bs; 541 aim_bstream_t bs;
529 542
530 len = 2 + 1 + strlen(roomname) + 2; 543 len = 2 + 1 + strlen(roomname) + 2;
531 544
532 if (!(buf = malloc(len))) 545 if (!(buf = malloc(len)))
533 return 0; 546 return 0;
534 547
535 aim_bstream_init(&bs, buf, len); 548 aim_bstream_init(&bs, buf, len);
536 549