changeset 10993:b6ca6d3c5332

[gaim-migrate @ 12831] *** empty log message *** committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 09 Jun 2005 04:47:18 +0000
parents 2bda44d66641
children b45613311dab
files src/protocols/oscar/aim.h src/protocols/oscar/bstream.c src/protocols/oscar/ssi.c src/protocols/oscar/tlv.c
diffstat 4 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Thu Jun 09 04:42:27 2005 +0000
+++ b/src/protocols/oscar/aim.h	Thu Jun 09 04:47:18 2005 +0000
@@ -1419,6 +1419,7 @@
 faim_internal int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl);
 
 faim_internal int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t lenth, const fu8_t *value);
+faim_internal int aim_tlvlist_replace_str(aim_tlvlist_t **list, const fu16_t type, const char *str);
 faim_internal int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const fu16_t type);
 faim_internal int aim_tlvlist_replace_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value);
 faim_internal int aim_tlvlist_replace_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value);
--- a/src/protocols/oscar/bstream.c	Thu Jun 09 04:42:27 2005 +0000
+++ b/src/protocols/oscar/bstream.c	Thu Jun 09 04:47:18 2005 +0000
@@ -162,10 +162,10 @@
 {
 	char *ob;
 
-	if (!(ob = malloc(len+1)))
+	if (!(ob = malloc(len + 1)))
 		return NULL;
 
-	if (aimbs_getrawbuf(bs, ob, len) < len) {
+	if (aimbs_getrawbuf(bs, (fu8_t *)ob, len) < len) {
 		free(ob);
 		return NULL;
 	}
@@ -256,7 +256,7 @@
 
 faim_internal int aimbs_putstr(aim_bstream_t *bs, const char *str)
 {
-	aimbs_putraw(bs, str, strlen(str));
+	return aimbs_putraw(bs, (fu8_t *)str, strlen(str));
 }
 
 faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len)
--- a/src/protocols/oscar/ssi.c	Thu Jun 09 04:42:27 2005 +0000
+++ b/src/protocols/oscar/ssi.c	Thu Jun 09 04:47:18 2005 +0000
@@ -396,7 +396,7 @@
 		aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x0131, 1);
 		if (tlv && tlv->length) {
 			char *alias = (char *)malloc((tlv->length+1)*sizeof(char));
-			strncpy(alias, tlv->value, tlv->length);
+			strncpy(alias, (char *)tlv->value, tlv->length);
 			alias[tlv->length] = 0;
 			return alias;
 		}
@@ -421,7 +421,7 @@
 		aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x013c, 1);
 		if (tlv && tlv->length) {
 			char *alias = (char *)malloc((tlv->length+1)*sizeof(char));
-			strncpy(alias, tlv->value, tlv->length);
+			strncpy(alias, (char *)tlv->value, tlv->length);
 			alias[tlv->length] = 0;
 			return alias;
 		}
@@ -922,7 +922,7 @@
 
 	/* Either add or remove the 0x0131 TLV from the TLV chain */
 	if ((alias != NULL) && (strlen(alias) > 0))
-		aim_tlvlist_replace_raw(&tmp->data, 0x0131, strlen(alias), alias);
+		aim_tlvlist_replace_str(&tmp->data, 0x0131, alias);
 	else
 		aim_tlvlist_remove(&tmp->data, 0x0131);
 
@@ -954,7 +954,7 @@
 
 	/* Either add or remove the 0x0131 TLV from the TLV chain */
 	if ((comment != NULL) && (strlen(comment) > 0))
-		aim_tlvlist_replace_raw(&tmp->data, 0x013c, strlen(comment), comment);
+		aim_tlvlist_replace_str(&tmp->data, 0x013c, comment);
 	else
 		aim_tlvlist_remove(&tmp->data, 0x013c);
 
--- a/src/protocols/oscar/tlv.c	Thu Jun 09 04:42:27 2005 +0000
+++ b/src/protocols/oscar/tlv.c	Thu Jun 09 04:47:18 2005 +0000
@@ -648,6 +648,21 @@
 /**
  * Substitute a TLV of a given type with a new TLV of the same type.  If 
  * you attempt to replace a TLV that does not exist, this function will 
+ * just add a new TLV as if you called aim_tlvlist_add_str().
+ *
+ * @param list Desination chain (%NULL pointer if empty).
+ * @param type TLV type.
+ * @param str String to add.
+ * @return The length of the TLV.
+ */
+faim_internal int aim_tlvlist_replace_str(aim_tlvlist_t **list, const fu16_t type, const char *str)
+{
+	return aim_tlvlist_replace_raw(list, type, strlen(str), str);
+}
+
+/**
+ * Substitute a TLV of a given type with a new TLV of the same type.  If 
+ * you attempt to replace a TLV that does not exist, this function will 
  * just add a new TLV as if you called aim_tlvlist_add_raw().
  *
  * @param list Desination chain (%NULL pointer if empty).