Mercurial > pidgin.yaz
changeset 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 | c70082d525d2 |
children | a8a7730db73c |
files | src/protocols/oscar/admin.c src/protocols/oscar/aim.h src/protocols/oscar/auth.c src/protocols/oscar/chat.c src/protocols/oscar/chatnav.c src/protocols/oscar/im.c src/protocols/oscar/locate.c src/protocols/oscar/odir.c src/protocols/oscar/ssi.c src/protocols/oscar/tlv.c |
diffstat | 10 files changed, 74 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/admin.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/admin.c Thu Jun 09 03:58:58 2005 +0000 @@ -17,7 +17,7 @@ * 0x0011 - Email address * 0x0013 - Unknown * - */ + */ faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info) { aim_frame_t *fr; @@ -110,11 +110,11 @@ snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); - aim_tlvlist_add_raw(&tl, 0x0001, strlen(newnick), newnick); - + aim_tlvlist_add_string(&tl, 0x0001, newnick); + aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); - + aim_tx_enqueue(sess, fr); @@ -138,10 +138,10 @@ aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); /* new password TLV t(0002) */ - aim_tlvlist_add_raw(&tl, 0x0002, strlen(newpw), newpw); + aim_tlvlist_add_string(&tl, 0x0002, newpw); /* current password TLV t(0012) */ - aim_tlvlist_add_raw(&tl, 0x0012, strlen(curpw), curpw); + aim_tlvlist_add_string(&tl, 0x0012, curpw); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); @@ -167,7 +167,7 @@ snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); - aim_tlvlist_add_raw(&tl, 0x0011, strlen(newemail), newemail); + aim_tlvlist_add_string(&tl, 0x0011, newemail); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl);
--- a/src/protocols/oscar/aim.h Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/aim.h Thu Jun 09 03:58:58 2005 +0000 @@ -1412,6 +1412,7 @@ faim_internal int aim_tlvlist_add_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); faim_internal int aim_tlvlist_add_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); faim_internal int aim_tlvlist_add_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); +faim_internal int aim_tlvlist_add_string(aim_tlvlist_t **list, const fu16_t type, const char *value); faim_internal int aim_tlvlist_add_caps(aim_tlvlist_t **list, const fu16_t type, const fu32_t caps); faim_internal int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *userinfo); faim_internal int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, fu16_t type, fu16_t exchange, const char *roomname, fu16_t instance);
--- a/src/protocols/oscar/auth.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/auth.c Thu Jun 09 03:58:58 2005 +0000 @@ -158,19 +158,19 @@ aim_encode_password(password, password_encoded); aimbs_put32(&fr->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); + aim_tlvlist_add_string(&tl, 0x0001, sn); aim_tlvlist_add_raw(&tl, 0x0002, passwdlen, password_encoded); if (ci->clientstring) - aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); + aim_tlvlist_add_string(&tl, 0x0003, ci->clientstring); aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid); aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major); aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor); aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); /* distribution chan */ - aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); - aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); + aim_tlvlist_add_string(&tl, 0x000f, ci->lang); + aim_tlvlist_add_string(&tl, 0x000e, ci->country); aim_tlvlist_write(&fr->data, &tl); @@ -234,7 +234,7 @@ snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid); - aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); + aim_tlvlist_add_string(&tl, 0x0001, sn); /* Truncate ICQ passwords, if necessary */ if (isdigit(sn[0]) && (strlen(password) > MAXICQPASSLEN)) @@ -256,15 +256,15 @@ #endif if (ci->clientstring) - aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); + aim_tlvlist_add_string(&tl, 0x0003, ci->clientstring); aim_tlvlist_add_16(&tl, 0x0016, (fu16_t)ci->clientid); aim_tlvlist_add_16(&tl, 0x0017, (fu16_t)ci->major); aim_tlvlist_add_16(&tl, 0x0018, (fu16_t)ci->minor); aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); - aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); - aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); + aim_tlvlist_add_string(&tl, 0x000f, ci->lang); + aim_tlvlist_add_string(&tl, 0x000e, ci->country); /* * If set, old-fashioned buddy lists will not work. You will need @@ -494,7 +494,7 @@ snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); - aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); + aim_tlvlist_add_string(&tl, 0x0001, sn); /* Tell the server we support SecurID logins. */ aim_tlvlist_add_noval(&tl, 0x004b);
--- a/src/protocols/oscar/chat.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/chat.c Thu Jun 09 03:58:58 2005 +0000 @@ -382,13 +382,13 @@ * SubTLV: Type 2: Encoding */ if (encoding != NULL) - aim_tlvlist_add_raw(&itl, 0x0002, strlen(encoding), encoding); + aim_tlvlist_add_string(&itl, 0x0002, encoding); /* * SubTLV: Type 3: Language */ if (language != NULL) - aim_tlvlist_add_raw(&itl, 0x0003, strlen(language), language); + aim_tlvlist_add_string(&itl, 0x0003, language); /* * Type 5: Message block. Contains more TLVs.
--- a/src/protocols/oscar/chatnav.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/chatnav.c Thu Jun 09 03:58:58 2005 +0000 @@ -67,9 +67,9 @@ /* detail level */ aimbs_put8(&fr->data, 0x01); - aim_tlvlist_add_raw(&tl, 0x00d3, strlen(name), name); - aim_tlvlist_add_raw(&tl, 0x00d6, strlen(charset), charset); - aim_tlvlist_add_raw(&tl, 0x00d7, strlen(lang), lang); + aim_tlvlist_add_string(&tl, 0x00d3, name); + aim_tlvlist_add_string(&tl, 0x00d6, charset); + aim_tlvlist_add_string(&tl, 0x00d7, lang); /* tlvcount */ aimbs_put16(&fr->data, aim_tlvlist_count(&tl));
--- a/src/protocols/oscar/im.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/im.c Thu Jun 09 03:58:58 2005 +0000 @@ -487,7 +487,7 @@ aim_tlvlist_add_16(&itl, 0x000a, 0x0001); aim_tlvlist_add_noval(&itl, 0x000f); - aim_tlvlist_add_raw(&itl, 0x000c, strlen(msg), msg); + aim_tlvlist_add_string(&itl, 0x000c, msg); aim_tlvlist_add_chatroom(&itl, 0x2711, exchange, roomname, instance); aim_tlvlist_write(&hdrbs, &itl);
--- a/src/protocols/oscar/locate.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/locate.c Thu Jun 09 03:58:58 2005 +0000 @@ -1003,7 +1003,7 @@ return -ENOMEM; } snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); - aim_tlvlist_add_raw(&tl, 0x0001, strlen(encoding), encoding); + aim_tlvlist_add_string(&tl, 0x0001, encoding); aim_tlvlist_add_raw(&tl, 0x0002, profile_len, profile); free(encoding); } @@ -1023,7 +1023,7 @@ return -ENOMEM; } snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); - aim_tlvlist_add_raw(&tl, 0x0003, strlen(encoding), encoding); + aim_tlvlist_add_string(&tl, 0x0003, encoding); aim_tlvlist_add_raw(&tl, 0x0004, awaymsg_len, awaymsg); free(encoding); } else @@ -1183,26 +1183,26 @@ aim_tlvlist_add_16(&tl, 0x000a, privacy); if (first) - aim_tlvlist_add_raw(&tl, 0x0001, strlen(first), first); + aim_tlvlist_add_string(&tl, 0x0001, first); if (last) - aim_tlvlist_add_raw(&tl, 0x0002, strlen(last), last); + aim_tlvlist_add_string(&tl, 0x0002, last); if (middle) - aim_tlvlist_add_raw(&tl, 0x0003, strlen(middle), middle); + aim_tlvlist_add_string(&tl, 0x0003, middle); if (maiden) - aim_tlvlist_add_raw(&tl, 0x0004, strlen(maiden), maiden); + aim_tlvlist_add_string(&tl, 0x0004, maiden); if (state) - aim_tlvlist_add_raw(&tl, 0x0007, strlen(state), state); + aim_tlvlist_add_string(&tl, 0x0007, state); if (city) - aim_tlvlist_add_raw(&tl, 0x0008, strlen(city), city); + aim_tlvlist_add_string(&tl, 0x0008, city); if (nickname) - aim_tlvlist_add_raw(&tl, 0x000c, strlen(nickname), nickname); + aim_tlvlist_add_string(&tl, 0x000c, nickname); if (zip) - aim_tlvlist_add_raw(&tl, 0x000d, strlen(zip), zip); + aim_tlvlist_add_string(&tl, 0x000d, zip); if (street) - aim_tlvlist_add_raw(&tl, 0x0021, strlen(street), street); + aim_tlvlist_add_string(&tl, 0x0021, street); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; @@ -1266,15 +1266,15 @@ aim_tlvlist_add_16(&tl, 0x000a, privacy); if (interest1) - aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest1), interest1); + aim_tlvlist_add_string(&tl, 0x0000b, interest1); if (interest2) - aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest2), interest2); + aim_tlvlist_add_string(&tl, 0x0000b, interest2); if (interest3) - aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest3), interest3); + aim_tlvlist_add_string(&tl, 0x0000b, interest3); if (interest4) - aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest4), interest4); + aim_tlvlist_add_string(&tl, 0x0000b, interest4); if (interest5) - aim_tlvlist_add_raw(&tl, 0x0000b, strlen(interest5), interest5); + aim_tlvlist_add_string(&tl, 0x0000b, interest5); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM;
--- a/src/protocols/oscar/odir.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/odir.c Thu Jun 09 03:58:58 2005 +0000 @@ -30,9 +30,9 @@ return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); + aim_tlvlist_add_string(&tl, 0x001c, region); aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ - aim_tlvlist_add_raw(&tl, 0x0005, strlen(email), email); + aim_tlvlist_add_string(&tl, 0x0005, email); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; @@ -79,28 +79,28 @@ return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); + aim_tlvlist_add_string(&tl, 0x001c, region); aim_tlvlist_add_16(&tl, 0x000a, 0x0000); /* Type of search */ if (first) - aim_tlvlist_add_raw(&tl, 0x0001, strlen(first), first); + aim_tlvlist_add_string(&tl, 0x0001, first); if (last) - aim_tlvlist_add_raw(&tl, 0x0002, strlen(last), last); + aim_tlvlist_add_string(&tl, 0x0002, last); if (middle) - aim_tlvlist_add_raw(&tl, 0x0003, strlen(middle), middle); + aim_tlvlist_add_string(&tl, 0x0003, middle); if (maiden) - aim_tlvlist_add_raw(&tl, 0x0004, strlen(maiden), maiden); + aim_tlvlist_add_string(&tl, 0x0004, maiden); if (country) - aim_tlvlist_add_raw(&tl, 0x0006, strlen(country), country); + aim_tlvlist_add_string(&tl, 0x0006, country); if (state) - aim_tlvlist_add_raw(&tl, 0x0007, strlen(state), state); + aim_tlvlist_add_string(&tl, 0x0007, state); if (city) - aim_tlvlist_add_raw(&tl, 0x0008, strlen(city), city); + aim_tlvlist_add_string(&tl, 0x0008, city); if (nick) - aim_tlvlist_add_raw(&tl, 0x000c, strlen(nick), nick); + aim_tlvlist_add_string(&tl, 0x000c, nick); if (zip) - aim_tlvlist_add_raw(&tl, 0x000d, strlen(zip), zip); + aim_tlvlist_add_string(&tl, 0x000d, zip); if (address) - aim_tlvlist_add_raw(&tl, 0x0021, strlen(address), address); + aim_tlvlist_add_string(&tl, 0x0021, address); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM; @@ -134,10 +134,10 @@ return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_raw(&tl, 0x001c, strlen(region), region); + aim_tlvlist_add_string(&tl, 0x001c, region); aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ if (interest) - aim_tlvlist_add_raw(&tl, 0x0001, strlen(interest), interest); + aim_tlvlist_add_string(&tl, 0x0001, interest); if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) return -ENOMEM;
--- a/src/protocols/oscar/ssi.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/ssi.c Thu Jun 09 03:58:58 2005 +0000 @@ -722,11 +722,11 @@ if (needauth) aim_tlvlist_add_noval(&data, 0x0066); if (alias) - aim_tlvlist_add_raw(&data, 0x0131, strlen(alias), alias); + aim_tlvlist_add_string(&data, 0x0131, alias); if (smsnum) - aim_tlvlist_add_raw(&data, 0x013a, strlen(smsnum), smsnum); + aim_tlvlist_add_string(&data, 0x013a, smsnum); if (comment) - aim_tlvlist_add_raw(&data, 0x013c, strlen(comment), comment); + aim_tlvlist_add_string(&data, 0x013c, comment); /* Add that bad boy */ aim_ssi_itemlist_add(&sess->ssi.local, name, parent->gid, 0xFFFF, AIM_SSI_TYPE_BUDDY, data);
--- a/src/protocols/oscar/tlv.c Thu Jun 09 02:22:36 2005 +0000 +++ b/src/protocols/oscar/tlv.c Thu Jun 09 03:58:58 2005 +0000 @@ -20,7 +20,7 @@ if (!oldtlv || !*oldtlv) return; - + free((*oldtlv)->value); free(*oldtlv); *oldtlv = NULL; @@ -48,7 +48,7 @@ faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs) { aim_tlvlist_t *list = NULL, *cur; - + while (aim_bstream_empty(bs) > 0) { fu16_t type, length; @@ -316,7 +316,7 @@ for (cur = *list; cur; ) { aim_tlvlist_t *tmp; - + freetlv(&cur->tlv); tmp = cur->next; @@ -463,6 +463,19 @@ } /** + * Add a string to a TLV chain. + * + * @param list Destination chain. + * @param type TLV type to add. + * @param value Value to add. + * @return The size of the value added. + */ +faim_internal int aim_tlvlist_add_string(aim_tlvlist_t **list, const fu16_t type, const char *value) +{ + return aim_tlvlist_add_raw(list, type, strlen(value), (fu8_t)value); +} + +/** * Adds a block of capability blocks to a TLV chain. The bitfield * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: * @@ -528,7 +541,7 @@ aim_bstream_t bs; len = 2 + 1 + strlen(roomname) + 2; - + if (!(buf = malloc(len))) return 0;