diff libpurple/protocols/qq/utils.c @ 24897:1300601041ac

g_strsplit_set is new in glib 2.4 g_strv_length is new in glib 2.6 This is one reason I didn't get around to making RPMs for 2.5.3, I don't (yet) know if there are other glib version dependencies to deal with...
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 07 Jan 2009 01:15:36 +0000
parents fecedf6d9ee1
children 151004519917
line wrap: on
line diff
--- a/libpurple/protocols/qq/utils.c	Wed Jan 07 01:13:27 2009 +0000
+++ b/libpurple/protocols/qq/utils.c	Wed Jan 07 01:15:36 2009 +0000
@@ -95,8 +95,8 @@
 gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields)
 {
 	guint8 *input;
-	gchar **segments;
-	gint count, j;
+	gchar **segments, **seg;
+	gint count = 0, j;
 
 	g_return_val_if_fail(data != NULL && len != 0 && delimit != 0, NULL);
 
@@ -106,11 +106,12 @@
 	g_memmove(input, data, len);
 	input[len] = 0x00;
 
-	segments = g_strsplit_set((gchar *) input, delimit, 0);
+	segments = g_strsplit((gchar *) input, delimit, 0);
 	if (expected_fields <= 0)
 		return segments;
 
-	count = g_strv_length(segments);
+	for (seg = segments; *seg != NULL; seg++)
+		count++;
 	if (count < expected_fields) {	/* not enough fields */
 		purple_debug_error("QQ", "Less fields %d then %d\n", count, expected_fields);
 		return NULL;