From: Tim-Philipp Müller Date: Thu, 19 Oct 2006 09:00:21 +0000 (+0000) Subject: gst/subparse/gstsubparse.c: Strip trailing newlines from subtitle text output. X-Git-Tag: 1.19.3~511^2~11521 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d39d9c68f34f8eaa2037a79f28ddcbb76a40f270;p=platform%2Fupstream%2Fgstreamer.git gst/subparse/gstsubparse.c: Strip trailing newlines from subtitle text output. Original commit message from CVS: * gst/subparse/gstsubparse.c: (strip_trailing_newlines), (parse_subrip): Strip trailing newlines from subtitle text output. --- diff --git a/ChangeLog b/ChangeLog index 6d73e7c..f6cf285 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-10-19 Tim-Philipp Müller + + * gst/subparse/gstsubparse.c: (strip_trailing_newlines), + (parse_subrip): + Strip trailing newlines from subtitle text output. + 2006-10-18 Tim-Philipp Müller * gst/subparse/gstsubparse.c: (gst_sub_parse_dispose), diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 26409ed..d17be39 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -476,6 +476,20 @@ parse_mdvdsub (ParserState * state, const gchar * line) return ret; } +static void +strip_trailing_newlines (gchar * txt) +{ + if (txt) { + guint len; + + len = strlen (txt); + while (len > 1 && txt[len - 1] == '\n') { + txt[len - 1] = '\0'; + --len; + } + } +} + /* we want to escape text in general, but retain basic markup like * , , and . The easiest and safest way is to * just unescape a white list of allowed markups again after @@ -572,6 +586,7 @@ parse_subrip (ParserState * state, const gchar * line) g_string_truncate (state->buf, 0); state->state = 0; subrip_unescape_formatting (ret); + strip_trailing_newlines (ret); return ret; } return NULL;