comparison src/gtkimhtml.c @ 7287:3a41c3f80228

[gaim-migrate @ 7868] more fun html entity stuff committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 17 Oct 2003 05:58:16 +0000
parents 0f7dd6715a90
children c7f0a4397d9e
comparison
equal deleted inserted replaced
7286:0b961945c8ae 7287:3a41c3f80228
755 static gboolean 755 static gboolean
756 gtk_imhtml_is_amp_escape (const gchar *string, 756 gtk_imhtml_is_amp_escape (const gchar *string,
757 gchar **replace, 757 gchar **replace,
758 gint *length) 758 gint *length)
759 { 759 {
760 static char buf[6]; 760 static char buf[7];
761 g_return_val_if_fail (string != NULL, FALSE); 761 g_return_val_if_fail (string != NULL, FALSE);
762 g_return_val_if_fail (replace != NULL, FALSE); 762 g_return_val_if_fail (replace != NULL, FALSE);
763 g_return_val_if_fail (length != NULL, FALSE); 763 g_return_val_if_fail (length != NULL, FALSE);
764 764
765 if (!g_ascii_strncasecmp (string, "&amp;", 5)) { 765 if (!g_ascii_strncasecmp (string, "&amp;", 5)) {
787 *replace = "\'"; 787 *replace = "\'";
788 *length = 6; 788 *length = 6;
789 } else if (*(string + 1) == '#') { 789 } else if (*(string + 1) == '#') {
790 guint pound = 0; 790 guint pound = 0;
791 if ((sscanf (string, "&#%u;", &pound) == 1) && pound != 0) { 791 if ((sscanf (string, "&#%u;", &pound) == 1) && pound != 0) {
792 int buflen;
792 if (*(string + 3 + (gint)log10 (pound)) != ';') 793 if (*(string + 3 + (gint)log10 (pound)) != ';')
793 return FALSE; 794 return FALSE;
794 g_unichar_to_utf8((gunichar)pound, buf); 795 buflen = g_unichar_to_utf8((gunichar)pound, buf);
796 buf[buflen] = '\0';
795 *replace = buf; 797 *replace = buf;
796 *length = 2; 798 *length = 2;
797 while (isdigit ((gint) string [*length])) (*length)++; 799 while (isdigit ((gint) string [*length])) (*length)++;
798 if (string [*length] == ';') (*length)++; 800 if (string [*length] == ';') (*length)++;
799 } else { 801 } else {