mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
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
This commit is contained in:
parent
c5c2466d36
commit
7fb9cd453b
1 changed files with 14 additions and 5 deletions
|
@ -683,15 +683,24 @@ subrip_unescape_formatting (gchar * txt)
|
|||
}
|
||||
|
||||
for (pos = txt; pos != NULL && *pos != '\0'; ++pos) {
|
||||
if (g_ascii_strncasecmp (pos, "</u>", 10) == 0 ||
|
||||
g_ascii_strncasecmp (pos, "</i>", 10) == 0 ||
|
||||
g_ascii_strncasecmp (pos, "</b>", 10) == 0) {
|
||||
gchar *tag;
|
||||
|
||||
/* look for start of an escaped closing tag */
|
||||
if (g_ascii_strncasecmp (pos, "</", 5) != 0)
|
||||
continue;
|
||||
tag = pos + 5;
|
||||
while (*tag == ' ')
|
||||
++tag;
|
||||
if ((*tag == 'u' || *tag == 'i' || *tag == 'b') &&
|
||||
g_ascii_strncasecmp (tag + 1, ">", 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue