diff libpurple/protocols/oscar/family_icbm.c @ 30393:bbb27d65681f

Bstream cleanups: 1. g_return_val_if_fail()'s in place of XXX's. 2. byte_stream_empty() -> byte_stream_bytes_left(). I think the world is a better place now.
author ivan.komarov@soc.pidgin.im
date Wed, 28 Jul 2010 23:53:25 +0000
parents 5661f30d1b8e
children 3eb2dd8a1cc7
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_icbm.c	Wed Jul 28 23:13:25 2010 +0000
+++ b/libpurple/protocols/oscar/family_icbm.c	Wed Jul 28 23:53:25 2010 +0000
@@ -919,7 +919,7 @@
 	/*
 	 * We're interested in the inner TLV 0x101, which contains precious, precious message.
 	 */
-	while (byte_stream_empty(message) >= 4) {
+	while (byte_stream_bytes_left(message) >= 4) {
 		guint16 type = byte_stream_get16(message);
 		guint16 length = byte_stream_get16(message);
 		if (type == 0x101) {
@@ -952,12 +952,12 @@
 	 * I've changed it to process the TLVs in-place.  This avoids lots
 	 * of per-IM memory allocations.
 	 */
-	while (byte_stream_empty(bs) >= 4)
+	while (byte_stream_bytes_left(bs) >= 4)
 	{
 		type = byte_stream_get16(bs);
 		length = byte_stream_get16(bs);
 
-		if (length > byte_stream_empty(bs))
+		if (length > byte_stream_bytes_left(bs))
 		{
 			purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s.  They are probably trying to do something malicious.\n", userinfo->bn);
 			break;
@@ -1050,7 +1050,7 @@
 	 *     ...
 	 *   ...
 	 */
-	while (byte_stream_empty(servdata))
+	while (byte_stream_bytes_left(servdata))
 	{
 		guint16 gnlen, numb;
 		int i;
@@ -1550,7 +1550,7 @@
 	guint16 channel, nummissed, reason;
 	aim_userinfo_t userinfo;
 
-	while (byte_stream_empty(bs)) {
+	while (byte_stream_bytes_left(bs)) {
 
 		channel = byte_stream_get16(bs);
 		aim_info_extract(od, bs, &userinfo);