src/protocols/oscar/oscar.c

changeset 9407
51d14211393c
parent 9381
a075315bedbf
child 9455
b16e0c0ac03c
--- a/src/protocols/oscar/oscar.c	Sat Jun 26 20:33:01 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Jun 27 03:13:04 2004 +0000
@@ -418,12 +418,14 @@
 	return utf8;
 }
 
-static char *oscar_caps_to_string(guint caps)
+gchar *oscar_caps_to_string(guint caps)
 {
-	static char buf[512], *tmp;
-	int count = 0, i = 0;
+	GString *str;
+	gchar *tmp;
 	guint bit = 1;
 
+	str = g_string_new("");
+
 	if (!caps) {
 		return NULL;
 	} else while (bit <= AIM_CAPS_LAST) {
@@ -505,13 +507,12 @@
 				break;
 			}
 			if (tmp)
-				i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""),
-						tmp);
-			count++;
+				g_string_append_printf(str, "%s%s", (bit == 1 ? "" : ", "), tmp);
 		}
 		bit <<= 1;
 	}
-	return buf; 
+
+	return g_string_free(str, FALSE);
 }
 
 static char *oscar_icqstatus(int state) {
@@ -596,6 +597,7 @@
 	if ((userinfo != NULL) && (userinfo->capabilities != 0)) {
 		tmp = oscar_caps_to_string(userinfo->capabilities);
 		oscar_string_append(str, newline, _("Capabilities"), tmp);
+		g_free(tmp);
 	}
 
 	if ((b != NULL) && (b->name != NULL) && (g != NULL) && (g->name != NULL)) {

mercurial