changeset 10990:8d74ae785a46

[gaim-migrate @ 12828] More compile warning getting rid of. Also fix the crash from my last batch of comile warning getting rid ofs. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 09 Jun 2005 04:33:52 +0000
parents b4919e8c634c
children 1798ad0be460
files src/protocols/oscar/aim_internal.h src/protocols/oscar/auth.c src/protocols/oscar/bart.c src/protocols/oscar/bos.c src/protocols/oscar/bstream.c src/protocols/oscar/buddylist.c src/protocols/oscar/ft.c src/protocols/oscar/im.c src/protocols/oscar/locate.c src/protocols/oscar/search.c src/protocols/oscar/service.c src/protocols/oscar/ssi.c src/protocols/oscar/tlv.c
diffstat 13 files changed, 83 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim_internal.h	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/aim_internal.h	Thu Jun 09 04:33:52 2005 +0000
@@ -77,16 +77,17 @@
 faim_internal fu8_t aimbs_getle8(aim_bstream_t *bs);
 faim_internal fu16_t aimbs_getle16(aim_bstream_t *bs);
 faim_internal fu32_t aimbs_getle32(aim_bstream_t *bs);
+faim_internal int aimbs_getrawbuf(aim_bstream_t *bs, fu8_t *buf, int len);
+faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len);
+faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len);
 faim_internal int aimbs_put8(aim_bstream_t *bs, fu8_t v);
 faim_internal int aimbs_put16(aim_bstream_t *bs, fu16_t v);
 faim_internal int aimbs_put32(aim_bstream_t *bs, fu32_t v);
 faim_internal int aimbs_putle8(aim_bstream_t *bs, fu8_t v);
 faim_internal int aimbs_putle16(aim_bstream_t *bs, fu16_t v);
 faim_internal int aimbs_putle32(aim_bstream_t *bs, fu32_t v);
-faim_internal int aimbs_getrawbuf(aim_bstream_t *bs, fu8_t *buf, int len);
-faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len);
-faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len);
 faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len);
+faim_internal int aimbs_putstr(aim_bstream_t *bs, const char *str);
 faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len);
 
 /* conn.c */
--- a/src/protocols/oscar/auth.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/auth.c	Thu Jun 09 04:33:52 2005 +0000
@@ -580,7 +580,7 @@
 	aim_putsnac(&fr->data, AIM_CB_FAM_ATH, AIM_CB_ATH_SECURID_RESPONSE, 0x0000, 0);
 
 	aimbs_put16(&fr->data, len);
-	aimbs_putraw(&fr->data, securid, len);
+	aimbs_putstr(&fr->data, securid);
 
 	aim_tx_enqueue(sess, fr);
 
--- a/src/protocols/oscar/bart.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/bart.c	Thu Jun 09 04:33:52 2005 +0000
@@ -92,7 +92,7 @@
 
 	/* Screen name */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	/* Some numbers.  You like numbers, right? */
 	aimbs_put8(&fr->data, 0x01);
--- a/src/protocols/oscar/bos.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/bos.c	Thu Jun 09 04:33:52 2005 +0000
@@ -132,7 +132,7 @@
 		tmpptr = aimutil_itemindex(localcpy, i, '&');
 
 		aimbs_put8(&fr->data, strlen(tmpptr));
-		aimbs_putraw(&fr->data, tmpptr, strlen(tmpptr));
+		aimbs_putstr(&fr->data, tmpptr);
 
 		free(tmpptr);
 	}
--- a/src/protocols/oscar/bstream.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/bstream.c	Thu Jun 09 04:33:52 2005 +0000
@@ -131,6 +131,50 @@
 	return aimutil_getle32(bs->data + bs->offset - 4);
 }
 
+faim_internal int aimbs_getrawbuf(aim_bstream_t *bs, fu8_t *buf, int len)
+{
+
+	if (aim_bstream_empty(bs) < len)
+		return 0;
+
+	memcpy(buf, bs->data + bs->offset, len);
+	bs->offset += len;
+
+	return len;
+}
+
+faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len)
+{
+	fu8_t *ob;
+
+	if (!(ob = malloc(len)))
+		return NULL;
+
+	if (aimbs_getrawbuf(bs, ob, len) < len) {
+		free(ob);
+		return NULL;
+	}
+
+	return ob;
+}
+
+faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len)
+{
+	char *ob;
+
+	if (!(ob = malloc(len+1)))
+		return NULL;
+
+	if (aimbs_getrawbuf(bs, ob, len) < len) {
+		free(ob);
+		return NULL;
+	}
+
+	ob[len] = '\0';
+
+	return ob;
+}
+
 faim_internal int aimbs_put8(aim_bstream_t *bs, fu8_t v)
 {
 
@@ -197,49 +241,6 @@
 	return 1;
 }
 
-faim_internal int aimbs_getrawbuf(aim_bstream_t *bs, fu8_t *buf, int len)
-{
-
-	if (aim_bstream_empty(bs) < len)
-		return 0;
-
-	memcpy(buf, bs->data + bs->offset, len);
-	bs->offset += len;
-
-	return len;
-}
-
-faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len)
-{
-	fu8_t *ob;
-
-	if (!(ob = malloc(len)))
-		return NULL;
-
-	if (aimbs_getrawbuf(bs, ob, len) < len) {
-		free(ob);
-		return NULL;
-	}
-
-	return ob;
-}
-
-faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len)
-{
-	char *ob;
-
-	if (!(ob = malloc(len+1)))
-		return NULL;
-
-	if (aimbs_getrawbuf(bs, ob, len) < len) {
-		free(ob);
-		return NULL;
-	}
-
-	ob[len] = '\0';
-
-	return ob;
-}
 
 faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len)
 {
@@ -253,6 +254,11 @@
 	return len;
 }
 
+faim_internal int aimbs_putstr(aim_bstream_t *bs, const char *str)
+{
+	aimbs_putraw(bs, str, strlen(str));
+}
+
 faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len)
 {
 
--- a/src/protocols/oscar/buddylist.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/buddylist.c	Thu Jun 09 04:33:52 2005 +0000
@@ -88,7 +88,7 @@
 	aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid);
 
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	aim_tx_enqueue(sess, fr);
 
@@ -135,7 +135,7 @@
 		faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
 
 		aimbs_put8(&fr->data, strlen(tmpptr));
-		aimbs_putraw(&fr->data, tmpptr, strlen(tmpptr));
+		aimbs_putstr(&fr->data, tmpptr);
 		tmpptr = strtok(NULL, "&");
 	}
 
@@ -168,7 +168,7 @@
 	aim_putsnac(&fr->data, 0x0003, 0x0005, 0x0000, snacid);
 
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	aim_tx_enqueue(sess, fr);
 
@@ -223,7 +223,7 @@
 
 	aim_putsnac(&fr->data, 0x0003, 0x000c, 0x0000, snacid);
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	aim_tx_enqueue(sess, fr);
 
--- a/src/protocols/oscar/ft.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/ft.c	Thu Jun 09 04:33:52 2005 +0000
@@ -293,7 +293,7 @@
 
 	aimbs_put16(hdrbs, 0x0000);
 	aimbs_put16(hdrbs, 0x0000);
-	aimbs_putraw(hdrbs, sess->sn, strlen(sess->sn));
+	aimbs_putstr(hdrbs, sess->sn);
 
 	aim_bstream_setpos(hdrbs, 52); /* bleeehh */
 
@@ -368,7 +368,7 @@
 
 	aimbs_put16(hdrbs, 0x0000);
 	aimbs_put16(hdrbs, 0x0000);
-	aimbs_putraw(hdrbs, sess->sn, strlen(sess->sn));
+	aimbs_putstr(hdrbs, sess->sn);
 
 	aim_bstream_setpos(hdrbs, 52); /* bleeehh */
 
--- a/src/protocols/oscar/im.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/im.c	Thu Jun 09 04:33:52 2005 +0000
@@ -48,7 +48,7 @@
 	aimbs_putraw(bs, c, 8);
 	aimbs_put16(bs, ch);
 	aimbs_put8(bs, strlen(sn));
-	aimbs_putraw(bs, sn, strlen(sn));
+	aimbs_putstr(bs, sn);
 	return 8+2+1+strlen(sn);
 }
 
@@ -465,7 +465,7 @@
 	aimbs_putraw(&fr->data, ck, 8); /* Cookie */
 	aimbs_put16(&fr->data, 0x0002); /* Channel */
 	aimbs_put8(&fr->data, strlen(sn)); /* Screename length */
-	aimbs_putraw(&fr->data, sn, strlen(sn)); /* Screenname */
+	aimbs_putstr(&fr->data, sn); /* Screenname */
 
 	/*
 	 * TLV t(0005)
@@ -565,7 +565,7 @@
 	aimbs_put32(&fr->data, iconlen);
 	aimbs_put32(&fr->data, stamp);
 	aimbs_putraw(&fr->data, icon, iconlen);
-	aimbs_putraw(&fr->data, AIM_ICONIDENT, strlen(AIM_ICONIDENT));
+	aimbs_putstr(&fr->data, AIM_ICONIDENT);
 
 	/* TLV t(0003) */
 	aimbs_put16(&fr->data, 0x0003);
@@ -801,7 +801,7 @@
 		aimbs_put32(&bs, oft_info->fh.totsize);
 
 		/* Filename - NULL terminated, for some odd reason */
-		aimbs_putraw(&bs, oft_info->fh.name, strlen(oft_info->fh.name));
+		aimbs_putstr(&bs, oft_info->fh.name);
 		aimbs_put8(&bs, 0x00);
 
 		aim_tlvlist_add_raw(&subtl, 0x2711, bs.len, bs.data);
@@ -2102,7 +2102,7 @@
 
 	aimbs_put16(&fr->data, (flags & AIM_WARN_ANON) ? 0x0001 : 0x0000);
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	aim_tx_enqueue(sess, fr);
 
@@ -2162,7 +2162,7 @@
 
 	aimbs_put16(&fr->data, 0x0002); /* channel */
 	aimbs_put8(&fr->data, strlen(sender));
-	aimbs_putraw(&fr->data, sender, strlen(sender));
+	aimbs_putstr(&fr->data, sender);
 
 	aim_tlvlist_add_16(&tl, 0x0003, code);
 	aim_tlvlist_write(&fr->data, &tl);
@@ -2331,7 +2331,7 @@
 	 * Dest sn
 	 */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	/*
 	 * Type 2 (should be 0x0000, 0x0001, or 0x0002 for mtn)
--- a/src/protocols/oscar/locate.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/locate.c	Thu Jun 09 04:33:52 2005 +0000
@@ -827,7 +827,7 @@
 		return -EINVAL;
 
 	aimbs_put8(bs, strlen(info->sn));
-	aimbs_putraw(bs, info->sn, strlen(info->sn));
+	aimbs_putstr(bs, info->sn);
 
 	aimbs_put16(bs, info->warnlevel);
 
@@ -1239,7 +1239,7 @@
 	
 	aim_putsnac(&fr->data, 0x0002, 0x000b, 0x0000, snacid);
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	aim_tx_enqueue(sess, fr);
 
@@ -1319,7 +1319,7 @@
 	aim_putsnac(&fr->data, 0x0002, 0x0015, 0x0000, snacid);
 	aimbs_put32(&fr->data, flags);
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	aim_tx_enqueue(sess, fr);
 
--- a/src/protocols/oscar/search.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/search.c	Thu Jun 09 04:33:52 2005 +0000
@@ -54,7 +54,7 @@
 	snacid = aim_cachesnac(sess, 0x000a, 0x0002, 0x0000, strdup(address), strlen(address)+1);
 	aim_putsnac(&fr->data, 0x000a, 0x0002, 0x0000, snacid);
 	
-	aimbs_putraw(&fr->data, address, strlen(address)); 
+	aimbs_putstr(&fr->data, address); 
 
 	aim_tx_enqueue(sess, fr);
 
--- a/src/protocols/oscar/service.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/service.c	Thu Jun 09 04:33:52 2005 +0000
@@ -860,7 +860,7 @@
 		aimbs_put8(&fr->data, 0x04);
 		aimbs_put8(&fr->data, strlen(msg)+4);
 		aimbs_put16(&fr->data, strlen(msg));
-		aimbs_putraw(&fr->data, msg, strlen(msg));
+		aimbs_putstr(&fr->data, msg);
 		aimbs_put16(&fr->data, 0x0000);
 	} else {
 		if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + 8)))
--- a/src/protocols/oscar/ssi.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/ssi.c	Thu Jun 09 04:33:52 2005 +0000
@@ -1331,7 +1331,7 @@
 	for (cur=sess->ssi.pending; cur; cur=cur->next) {
 		aimbs_put16(&fr->data, cur->item->name ? strlen(cur->item->name) : 0);
 		if (cur->item->name)
-			aimbs_putraw(&fr->data, cur->item->name, strlen(cur->item->name));
+			aimbs_putstr(&fr->data, cur->item->name);
 		aimbs_put16(&fr->data, cur->item->gid);
 		aimbs_put16(&fr->data, cur->item->bid);
 		aimbs_put16(&fr->data, cur->item->type);
@@ -1678,12 +1678,12 @@
 
 	/* Screen name */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	/* Message (null terminated) */
 	aimbs_put16(&fr->data, msg ? strlen(msg) : 0);
 	if (msg) {
-		aimbs_putraw(&fr->data, msg, strlen(msg));
+		aimbs_putstr(&fr->data, msg);
 		aimbs_put8(&fr->data, 0x00);
 	}
 
@@ -1753,12 +1753,12 @@
 
 	/* Screen name */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	/* Message (null terminated) */
 	aimbs_put16(&fr->data, msg ? strlen(msg) : 0);
 	if (msg) {
-		aimbs_putraw(&fr->data, msg, strlen(msg));
+		aimbs_putstr(&fr->data, msg);
 		aimbs_put8(&fr->data, 0x00);
 	}
 
@@ -1831,7 +1831,7 @@
 
 	/* Screen name */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, sn, strlen(sn));
+	aimbs_putstr(&fr->data, sn);
 
 	/* Grant or deny */
 	aimbs_put8(&fr->data, reply);
@@ -1839,7 +1839,7 @@
 	/* Message (null terminated) */
 	aimbs_put16(&fr->data, msg ? (strlen(msg)+1) : 0);
 	if (msg) {
-		aimbs_putraw(&fr->data, msg, strlen(msg));
+		aimbs_putstr(&fr->data, msg);
 		aimbs_put8(&fr->data, 0x00);
 	}
 
--- a/src/protocols/oscar/tlv.c	Thu Jun 09 04:15:22 2005 +0000
+++ b/src/protocols/oscar/tlv.c	Thu Jun 09 04:33:52 2005 +0000
@@ -472,7 +472,7 @@
  */
 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);
+	return aim_tlvlist_add_raw(list, type, strlen(value), (fu8_t *)value);
 }
 
 /**
@@ -549,7 +549,7 @@
 
 	aimbs_put16(&bs, exchange);
 	aimbs_put8(&bs, strlen(roomname));
-	aimbs_putraw(&bs, roomname, strlen(roomname));
+	aimbs_putstr(&bs, roomname);
 	aimbs_put16(&bs, instance);
 
 	len = aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf);