summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-09-30 18:17:13 +0100
committerTim-Philipp Müller <tim@centricular.com>2015-09-30 18:20:48 +0100
commitfd8d3af85c7414eda6d12c056d36929e842a1ca5 (patch)
tree713ede3b56c7f1a45214080973841530cfb50fb6
parent3e4c521775c0f346aae2a22e69de09a57e72e3c0 (diff)
downloadgstreamer-plugins-base-fd8d3af85c7414eda6d12c056d36929e842a1ca5.tar.gz
subparse: detect closing tags even if there's a space after the slash
</ i> should be handled like </i> https://bugzilla.gnome.org/show_bug.cgi?id=755875
-rw-r--r--gst/subparse/gstsubparse.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c
index 5dadb0a33..e3069399d 100644
--- a/gst/subparse/gstsubparse.c
+++ b/gst/subparse/gstsubparse.c
@@ -683,15 +683,24 @@ subrip_unescape_formatting (gchar * txt)
}
for (pos = txt; pos != NULL && *pos != '\0'; ++pos) {
- if (g_ascii_strncasecmp (pos, "&lt;/u&gt;", 10) == 0 ||
- g_ascii_strncasecmp (pos, "&lt;/i&gt;", 10) == 0 ||
- g_ascii_strncasecmp (pos, "&lt;/b&gt;", 10) == 0) {
+ gchar *tag;
+
+ /* look for start of an escaped closing tag */
+ if (g_ascii_strncasecmp (pos, "&lt;/", 5) != 0)
+ continue;
+ tag = pos + 5;
+ while (*tag == ' ')
+ ++tag;
+ if ((*tag == 'u' || *tag == 'i' || *tag == 'b') &&
+ g_ascii_strncasecmp (tag + 1, "&gt;", 4) == 0) {
+ gsize tag_len = (guintptr) (tag + 1 + 4 - pos);
+
pos[0] = '<';
pos[1] = '/';
- pos[2] = g_ascii_tolower (pos[5]);
+ pos[2] = g_ascii_tolower (*tag);
pos[3] = '>';
/* move NUL terminator as well */
- memmove (pos + 4, pos + 10, strlen (pos + 10) + 1);
+ memmove (pos + 4, pos + tag_len, strlen (pos + tag_len) + 1);
pos += 3;
}
}