changeset 22313:bb1dc0095856

Revert some bits of the earlier patch not related to custom smileys.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 19 Feb 2008 19:51:03 +0000
parents f1475ca224a8
children 76fa93017695
files libpurple/util.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Tue Feb 19 19:46:49 2008 +0000
+++ b/libpurple/util.c	Tue Feb 19 19:51:03 2008 +0000
@@ -921,6 +921,7 @@
 {
 	const char *pln;
 	int len, pound;
+	char temp[2];
 
 	if (!text || *text != '&')
 		return NULL;
@@ -943,8 +944,10 @@
 		pln = "\302\256";      /* or use g_unichar_to_utf8(0xae); */
 	else if(IS_ENTITY("&apos;"))
 		pln = "\'";
-	else if(*(text+1) == '#' && (sscanf(text, "&#%u;", &pound) == 1) &&
-			pound != 0 && *(text+3+(gint)log10(pound)) == ';') {
+	else if(*(text+1) == '#' &&
+			(sscanf(text, "&#%u%1[;]", &pound, temp) == 2 ||
+			 sscanf(text, "&#x%x%1[;]", &pound, temp) == 2) &&
+			pound != 0) {
 		static char buf[7];
 		int buflen = g_unichar_to_utf8((gunichar)pound, buf);
 		buf[buflen] = '\0';