diff src/protocols/oscar/tlv.c @ 6101:e4a5085fb870

[gaim-migrate @ 6560] This should fix some icon uploading looping. Sean, the problem was that, when adding the md5 sum to ssi, the code was checking if it existed by looking for an item named "0", but it was actually adding an item named "1." So for accounts with no icon info yet, Gaim would end up getting in a loop and spiraling into oblivion, only far less dramatic. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 12 Jul 2003 19:08:19 +0000
parents 858979ab3867
children 4375bf2d9020
line wrap: on
line diff
--- a/src/protocols/oscar/tlv.c	Sat Jul 12 17:38:06 2003 +0000
+++ b/src/protocols/oscar/tlv.c	Sat Jul 12 19:08:19 2003 +0000
@@ -262,6 +262,39 @@
 	return new;
 }
 
+/*
+ * Compare two TLV lists for equality.  This probably is not the most 
+ * efficient way to do this.
+ *
+ * @param one One of the TLV chains to compare.
+ * @param two The other TLV chain to compare.
+ * @preturn Retrun 0 if the lists are the same, return 1 if they are different.
+ */
+faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two)
+{
+	aim_bstream_t bs1, bs2;
+
+	if (aim_sizetlvchain(&one) != aim_sizetlvchain(&two))
+		return 1;
+
+	aim_bstream_init(&bs1, ((fu8_t *)malloc(aim_sizetlvchain(&one)*sizeof(fu8_t))), aim_sizetlvchain(&one));
+	aim_bstream_init(&bs2, ((fu8_t *)malloc(aim_sizetlvchain(&two)*sizeof(fu8_t))), aim_sizetlvchain(&two));
+
+	aim_writetlvchain(&bs1, &one);
+	aim_writetlvchain(&bs2, &two);
+
+	if (memcmp(bs1.data, bs2.data, bs1.len)) {
+		free(bs1.data);
+		free(bs2.data);
+		return 1;
+	}
+
+	free(bs1.data);
+	free(bs2.data);
+
+	return 0;
+}
+
 /**
  * aim_freetlvchain - Free a TLV chain structure
  * @list: Chain to be freed