summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorJun Zhao <mypopydev@gmail.com>2018-04-09 23:05:42 +0800
committerJun Zhao <jun.zhao@intel.com>2018-04-12 16:04:58 +0800
commitcdd107b96586916508f8665b08be7de54d9633cf (patch)
treedb8cd45be9bd0954d55f3a28407a530c0bd8da26 /libavformat/aviobuf.c
parentbc62d20dc415caf949b6452b2707b9eba78cb098 (diff)
lavf/aviobuf: add ff_get_chomp_line
Same as ff_get_line but strip the white-space characters in the string tail. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 95b3364478..e752d0e1a6 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -823,6 +823,14 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen)
return i;
}
+int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen)
+{
+ int len = ff_get_line(s, buf, maxlen);
+ while (len > 0 && av_isspace(buf[len - 1]))
+ buf[--len] = '\0';
+ return len;
+}
+
int64_t ff_read_line_to_bprint(AVIOContext *s, AVBPrint *bp)
{
int len, end;